r.Water.WaterMesh.OcclusionCullExpandBoundsAmountXY

r.Water.WaterMesh.OcclusionCullExpandBoundsAmountXY

#Overview

name: r.Water.WaterMesh.OcclusionCullExpandBoundsAmountXY

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.OcclusionCullExpandBoundsAmountXY is to control the expansion of water tile bounds in the XY plane for occlusion culling in the Unreal Engine 5 water rendering system.

This setting variable is used within the Experimental Water plugin, specifically in the runtime module. It’s primarily utilized in the water mesh rendering and occlusion culling system.

The value of this variable is set as a console variable with a default value of 4800.0f. It can be modified at runtime through the console or in configuration files.

The associated variable CVarWaterMeshOcclusionCullExpandBoundsAmountXY directly interacts with r.Water.WaterMesh.OcclusionCullExpandBoundsAmountXY. They share the same value and purpose.

Developers must be aware that this variable affects the performance and visual quality of water rendering. Increasing the value will expand the culling bounds, potentially reducing occlusion culling efficiency but ensuring that more water tiles are rendered when they might be partially visible. Decreasing the value may improve performance but could cause pop-in effects for water at the edges of the view.

Best practices when using this variable include:

  1. Adjusting it based on the scale of your water bodies and the overall scene.
  2. Testing different values to find the optimal balance between performance and visual quality.
  3. Considering the impact on different hardware configurations, especially for scalability purposes.

Regarding the associated variable CVarWaterMeshOcclusionCullExpandBoundsAmountXY:

When working with this variable, developers should consider its impact on the entire water rendering pipeline and test thoroughly across different scenarios and view distances to ensure optimal performance and visual quality.

#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:148

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarWaterMeshOcclusionCullExpandBoundsAmountXY(
	TEXT("r.Water.WaterMesh.OcclusionCullExpandBoundsAmountXY"), 4800.0f,
	TEXT("Expand the water tile bounds in XY for the purpose of occlusion culling"),
	ECVF_Scalability);

// ----------------------------------------------------------------------------------

template <bool bWithWaterSelectionSupport>

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarWaterMeshOcclusionCullExpandBoundsAmountXY(
	TEXT("r.Water.WaterMesh.OcclusionCullExpandBoundsAmountXY"), 4800.0f,
	TEXT("Expand the water tile bounds in XY for the purpose of occlusion culling"),
	ECVF_Scalability);

// ----------------------------------------------------------------------------------

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

Scope (from outer to inner):

file
function     FWaterMeshSceneProxy::FWaterMeshSceneProxy

Source code excerpt:

	const int32 MaxQueries = CVarWaterMeshOcclusionCullingMaxQueries.GetValueOnGameThread();
	const bool bIncludeFarMeshOcclusionQueries = CVarWaterMeshOcclusionCullingIncludeFarMesh.GetValueOnGameThread() != 0;
	OcclusionCullingBounds = WaterQuadTree.ComputeNodeBounds(MaxQueries, CVarWaterMeshOcclusionCullExpandBoundsAmountXY.GetValueOnGameThread(), bIncludeFarMeshOcclusionQueries, &OcclusionResultsFarMeshOffset);
	EmptyOcclusionCullingBounds.Add(WaterQuadTree.GetBoundsIncludingFarMesh());
	// If this is a GPU quadtree, the CPU root node will have an invalid bounding box, so derive conservative bounds now
	if (bIsGPUQuadTree && !OcclusionCullingBounds.IsEmpty())
	{
		OcclusionCullingBounds[0] = FBox(FVector(WaterQuadTree.GetTileRegion().Min, WaterQuadTreeMinHeight), FVector(WaterQuadTree.GetTileRegion().Max, WaterQuadTreeMaxHeight));
	}