r.Water.WaterMesh.GPUQuadTree.ConservativeRasterization

r.Water.WaterMesh.GPUQuadTree.ConservativeRasterization

#Overview

name: r.Water.WaterMesh.GPUQuadTree.ConservativeRasterization

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.ConservativeRasterization is to enable software conservative rasterization for rasterizing water body meshes into the water quadtree in Unreal Engine 5’s water rendering system. This setting is part of the experimental Water plugin and affects the rendering of water surfaces.

This setting variable is primarily used in the Water plugin, specifically in the water mesh rendering subsystem. It’s referenced in the WaterMeshSceneProxy.cpp file, which is part of the Water plugin’s runtime module.

The value of this variable is set through a console variable (CVarWaterMeshGPUQuadTreeConservativeRasterization) with a default value of 0 (disabled). Users can change this value at runtime using console commands or through project settings.

This variable interacts with other water rendering settings, particularly those related to the GPU quadtree used for water mesh rendering. It’s closely associated with CVarWaterMeshGPUQuadTreeConservativeRasterization, which is essentially the same variable.

Developers should be aware that enabling this feature (by setting it to a non-zero value) will disable jittered draws for water meshes. This can affect the visual quality and performance of water rendering.

Best practices when using this variable include:

  1. Only enable it if you’re experiencing specific issues with water mesh rendering that conservative rasterization might solve.
  2. Test thoroughly after enabling, as it can impact both visual quality and performance.
  3. Consider the trade-off between the potential benefits of conservative rasterization and the loss of jittered draws.

Regarding the associated variable CVarWaterMeshGPUQuadTreeConservativeRasterization:

This is essentially the same variable as r.Water.WaterMesh.GPUQuadTree.ConservativeRasterization, just accessed through a C++ console variable interface. It serves the same purpose and has the same implications as discussed above. The main difference is in how it’s accessed in the code:

When working with this variable in C++ code, developers should use CVarWaterMeshGPUQuadTreeConservativeRasterization.GetValueOnRenderThread() to access its current value safely in render thread 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:60

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeConservativeRasterization(
	TEXT("r.Water.WaterMesh.GPUQuadTree.ConservativeRasterization"), 0,
	TEXT("Enables software conservative rasterization for rasterizing water body meshes into the water quadtree. Disables jittered draws. Default: 0"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeNumQuads(
	TEXT("r.Water.WaterMesh.GPUQuadTree.NumQuadsPerTileSide"), 8,
	TEXT("Number of quads per side of each tile mesh used to draw the water surface. A lower number results in more draw calls, a higher number in wasted VS invocations. Default: 8"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeConservativeRasterization(
	TEXT("r.Water.WaterMesh.GPUQuadTree.ConservativeRasterization"), 0,
	TEXT("Enables software conservative rasterization for rasterizing water body meshes into the water quadtree. Disables jittered draws. Default: 0"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeNumQuads(
	TEXT("r.Water.WaterMesh.GPUQuadTree.NumQuadsPerTileSide"), 8,

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

Scope (from outer to inner):

file
function     void FWaterMeshSceneProxy::BuildGPUQuadTree

Source code excerpt:

	Params.CaptureDepthRange = WaterQuadTreeDepthRange;
	Params.bUseMSAAJitterPattern = CVarWaterMeshGPUQuadTreeJitterPattern.GetValueOnRenderThread() == 1;
	Params.bUseConservativeRasterization = bAllDrawsAreConservativeRasterCompatible && CVarWaterMeshGPUQuadTreeConservativeRasterization.GetValueOnRenderThread() != 0;

	QuadTreeGPU.Init(GraphBuilder, Params, Draws);
}