r.Water.WaterMesh.GPUQuadTree.SuperSampling

r.Water.WaterMesh.GPUQuadTree.SuperSampling

#Overview

name: r.Water.WaterMesh.GPUQuadTree.SuperSampling

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.Water.WaterMesh.GPUQuadTree.SuperSampling is to control the supersampling factor for rasterizing water meshes into the GPU water quadtree. This setting is part of the water rendering system in Unreal Engine 5.

This setting variable is primarily used in the Water plugin, specifically in the runtime module. It’s referenced in the WaterMeshSceneProxy.cpp file, which suggests it’s involved in the rendering of water meshes.

The value of this variable is set as a console variable with a default value of 2. It can be changed at runtime through the console or configuration files.

This variable interacts closely with CVarWaterMeshGPUQuadTreeMultiSampling, which controls multisampling for the same purpose. Together, these variables work to reduce missing water tile artifacts near the edges of water bodies.

Developers must be aware that this variable has a direct impact on rendering quality and performance. Higher values will result in better quality but may impact performance.

Best practices when using this variable include:

  1. Keep the value between 1 and 8, as enforced by the code.
  2. Balance the supersampling value with the multisampling value for optimal results.
  3. Consider performance implications when increasing the value, especially on lower-end hardware.

The associated variable CVarWaterMeshGPUQuadTreeSuperSampling is the actual console variable that stores and provides access to the r.Water.WaterMesh.GPUQuadTree.SuperSampling value. It’s used in the BuildGPUQuadTree function of the FWaterMeshSceneProxy class to set the SuperSamplingFactor parameter.

This associated variable is crucial for the actual implementation of the supersampling feature. It’s accessed on the render thread, indicating its use during the rendering process. Developers should be cautious about changing its value during runtime, as it could affect ongoing rendering operations.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshSceneProxy.cpp:35

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeSuperSampling(
	TEXT("r.Water.WaterMesh.GPUQuadTree.SuperSampling"), 2,
	TEXT("Rasterizes water meshes into the GPU water quadtree at a higher resolution, reducing missing water tile artifacts near the edges of water bodies. Default: 2, Min: 1, Max : 8"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeMultiSampling(
	TEXT("r.Water.WaterMesh.GPUQuadTree.MultiSampling"), 1,
	TEXT("Rasterizes water meshes into the GPU water quadtree with a multisampled rendertarget, reducing missing water tile artifacts near the edges of water bodies. Default: 1, Min: 1, Max : 8"),

#Associated Variable and Callsites

This variable is associated with another variable named CVarWaterMeshGPUQuadTreeSuperSampling. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshSceneProxy.cpp:34

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeSuperSampling(
	TEXT("r.Water.WaterMesh.GPUQuadTree.SuperSampling"), 2,
	TEXT("Rasterizes water meshes into the GPU water quadtree at a higher resolution, reducing missing water tile artifacts near the edges of water bodies. Default: 2, Min: 1, Max : 8"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeMultiSampling(
	TEXT("r.Water.WaterMesh.GPUQuadTree.MultiSampling"), 1,

#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshSceneProxy.cpp:1244

Scope (from outer to inner):

file
function     void FWaterMeshSceneProxy::BuildGPUQuadTree

Source code excerpt:

	Params.WaterBodyRenderData = WaterBodyRenderDataGPU;
	Params.RequestedQuadTreeResolution = Resolution;
	Params.SuperSamplingFactor = FMath::Clamp(CVarWaterMeshGPUQuadTreeSuperSampling.GetValueOnRenderThread(), 1, 8);
	Params.NumMSAASamples = FMath::Clamp(CVarWaterMeshGPUQuadTreeMultiSampling.GetValueOnRenderThread(), 1, 8);
	Params.NumJitterSamples = FMath::Clamp(CVarWaterMeshGPUQuadTreeNumJitterSamples.GetValueOnRenderThread(), 1, 16);
	Params.JitterSampleFootprint = FMath::Max(CVarWaterMeshGPUQuadTreeJitterSampleFootprint.GetValueOnRenderThread(), 0.0f);
	Params.CaptureDepthRange = WaterQuadTreeDepthRange;
	Params.bUseMSAAJitterPattern = CVarWaterMeshGPUQuadTreeJitterPattern.GetValueOnRenderThread() == 1;
	Params.bUseConservativeRasterization = bAllDrawsAreConservativeRasterCompatible && CVarWaterMeshGPUQuadTreeConservativeRasterization.GetValueOnRenderThread() != 0;