r.VT.RVT.HighQualityPerPixelHeight

r.VT.RVT.HighQualityPerPixelHeight

#Overview

name: r.VT.RVT.HighQualityPerPixelHeight

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.VT.RVT.HighQualityPerPixelHeight is to control the quality of sampling for per-pixel heightmaps when rendering to Runtime Virtual Textures (RVT). This setting variable is primarily used in the rendering system, specifically for virtual texturing and landscape rendering.

The Unreal Engine subsystems that rely on this setting variable are the Renderer module and the Landscape module. It is used in the Runtime Virtual Texture rendering process and affects landscape rendering to virtual textures.

The value of this variable is set as a console variable (CVar) in the Renderer module. It is initialized with a default value of 1, meaning high-quality sampling is enabled by default.

This variable interacts with the ‘bVirtualTextureRenderWithQuadHQ’ property in the LandscapeProxy class. When both are enabled, the highest quality heightmap interpolation is used for rendering landscapes to runtime virtual texture pages.

Developers must be aware that this setting affects rendering performance and quality. Enabling high-quality sampling may increase rendering time but improve the visual quality of heightmaps in virtual textures.

Best practices when using this variable include:

  1. Consider the performance impact when enabling high-quality sampling, especially for large landscapes or complex scenes.
  2. Use in conjunction with the ‘bVirtualTextureRenderWithQuadHQ’ property for landscapes to achieve the best results.
  3. Test the visual impact and performance with both enabled and disabled states to find the optimal balance for your specific use case.
  4. Keep in mind that this setting is marked as read-only (ECVF_ReadOnly), so it should be set at startup and not changed during runtime.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/RuntimeVirtualTextureRender.cpp:33

Scope (from outer to inner):

file
namespace    RuntimeVirtualTexture

Source code excerpt:


	static TAutoConsoleVariable<int32> CVarVTHighQualityPerPixelHeight(
		TEXT("r.VT.RVT.HighQualityPerPixelHeight"),
		1,
		TEXT("Use higher quality sampling of per pixel heightmaps when rendering to Runtime Virtual Texture.\n"),
		ECVF_ReadOnly);

	static TAutoConsoleVariable<int32> CVarVTDirectCompress(
		TEXT("r.VT.RVT.DirectCompress"),

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Classes/LandscapeProxy.h:575

Scope: file

Source code excerpt:

	/** 
	 * Use highest quality heightmap interpolation when using a single quad to render this landscape to runtime virtual texture pages.
	 * This also requires the project setting: r.VT.RVT.HighQualityPerPixelHeight.
	 */
	UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category = VirtualTexture, meta = (DisplayName = "High Quality PerPixel Height", EditCondition = "bVirtualTextureRenderWithQuad", LandscapeOverridable))
	bool bVirtualTextureRenderWithQuadHQ = true;

	/** 
	 * Number of mesh levels to use when rendering landscape into runtime virtual texture.
	 * Lower values reduce vertex count when rendering to the runtime virtual texture but decrease accuracy when using values that require vertex interpolation.
	 */
	UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category = VirtualTexture, meta = (DisplayName = "Virtual Texture Num LODs", EditCondition = "!bVirtualTextureRenderWithQuad", UIMin = "0", UIMax = "7", LandscapeOverridable))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/RuntimeVirtualTextureRender.cpp:148

Scope (from outer to inner):

file
class        class FShader_VirtualTextureMaterialDraw : public FMeshMaterialShader
function     static void ModifyCompilationEnvironment

Source code excerpt:

			OutEnvironment.SetDefine(TEXT("IS_VIRTUAL_TEXTURE_MATERIAL"), 1);

			static FShaderPlatformCachedIniValue<bool> HighQualityPerPixelHeightValue(TEXT("r.VT.RVT.HighQualityPerPixelHeight"));
			const bool bHighQualityPerPixelHeight = (HighQualityPerPixelHeightValue.Get((EShaderPlatform)Parameters.Platform) != 0);
			OutEnvironment.SetDefine(TEXT("PER_PIXEL_HEIGHTMAP_HQ"), bHighQualityPerPixelHeight ? 1 : 0);
		}

		FShader_VirtualTextureMaterialDraw()
		{}