r.Water.WaterMesh.GPUQuadTree.NumJitterSamples
r.Water.WaterMesh.GPUQuadTree.NumJitterSamples
#Overview
name: r.Water.WaterMesh.GPUQuadTree.NumJitterSamples
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Rasterizes water meshes into the GPU water quadtree with multiple jittered draw calls, reducing missing water tile artifacts near the edges of water bodies. Default: 4, Min: 1, Max : 16. 1 disables this feature.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.WaterMesh.GPUQuadTree.NumJitterSamples is to control the number of jittered draw calls used when 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 Experimental Water plugin, specifically within the water mesh rendering subsystem. It’s referenced in the WaterMeshSceneProxy.cpp file, which is part of the water rendering pipeline.
The value of this variable is set as a console variable with a default value of 4. It can be changed at runtime through the console or configuration files.
This variable interacts with several other water-related variables, such as CVarWaterMeshGPUQuadTreeJitterPattern, CVarWaterMeshGPUQuadTreeSuperSampling, and CVarWaterMeshGPUQuadTreeMultiSampling. Together, these variables control various aspects of water mesh rendering quality and performance.
Developers should be aware that this variable has a significant impact on the quality of water rendering, particularly near the edges of water bodies. Increasing the number of jitter samples can reduce missing water tile artifacts but may also impact performance.
Best practices when using this variable include:
- Keeping the value between 1 and 16, as enforced by the code.
- Balancing visual quality with performance requirements.
- Testing different values to find the optimal setting for specific scenes.
Regarding the associated variable CVarWaterMeshGPUQuadTreeNumJitterSamples:
This is the actual console variable object that stores and manages the r.Water.WaterMesh.GPUQuadTree.NumJitterSamples setting. It’s defined using TAutoConsoleVariable, which allows it to be changed at runtime.
The purpose of this variable is the same as r.Water.WaterMesh.GPUQuadTree.NumJitterSamples - to control the number of jittered draw calls for water mesh rasterization.
This variable is used directly in the BuildGPUQuadTree function of the FWaterMeshSceneProxy class. Its value is retrieved using the GetValueOnRenderThread() method and then clamped between 1 and 16 before being used to set the NumJitterSamples parameter for GPU quadtree initialization.
Developers should be aware that changes to this console variable will take effect on the render thread, which means the changes may not be immediate but will occur on the next frame or render pass.
Best practices for using this variable include:
- Modifying it through the console or configuration files rather than hard-coding values.
- Considering its impact on both visual quality and performance when adjusting its value.
- Using it in conjunction with other water rendering settings for optimal results.
#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:45
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeNumJitterSamples(
TEXT("r.Water.WaterMesh.GPUQuadTree.NumJitterSamples"), 4,
TEXT("Rasterizes water meshes into the GPU water quadtree with multiple jittered draw calls, reducing missing water tile artifacts near the edges of water bodies. Default: 4, Min: 1, Max : 16. 1 disables this feature."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeJitterPattern(
TEXT("r.Water.WaterMesh.GPUQuadTree.JitterPattern"), 1,
TEXT("Jitter pattern when using multiple jittered draw calls to rasterize water meshes into the GPU water quadtree. 0: Halton, 1: MSAA. Default 1"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarWaterMeshGPUQuadTreeNumJitterSamples
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshSceneProxy.cpp:44
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeNumJitterSamples(
TEXT("r.Water.WaterMesh.GPUQuadTree.NumJitterSamples"), 4,
TEXT("Rasterizes water meshes into the GPU water quadtree with multiple jittered draw calls, reducing missing water tile artifacts near the edges of water bodies. Default: 4, Min: 1, Max : 16. 1 disables this feature."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeJitterPattern(
TEXT("r.Water.WaterMesh.GPUQuadTree.JitterPattern"), 1,
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshSceneProxy.cpp:1246
Scope (from outer to inner):
file
function void FWaterMeshSceneProxy::BuildGPUQuadTree
Source code excerpt:
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;
QuadTreeGPU.Init(GraphBuilder, Params, Draws);