r.Water.WaterMesh.LODMorphEnabled

r.Water.WaterMesh.LODMorphEnabled

#Overview

name: r.Water.WaterMesh.LODMorphEnabled

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

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Water.WaterMesh.LODMorphEnabled is to control the smooth LOD morphing for water meshes in Unreal Engine 5’s water rendering system. This setting variable is used to enable or disable the smooth transition between different levels of detail (LODs) for water meshes.

Regarding the associated variable CVarWaterMeshLODMorphEnabled:

The purpose of CVarWaterMeshLODMorphEnabled is to provide a programmatic interface for the r.Water.WaterMesh.LODMorphEnabled setting within the engine’s code.

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

Scope: file

Source code excerpt:

/** Scalability CVars */
static TAutoConsoleVariable<int32> CVarWaterMeshLODMorphEnabled(
	TEXT("r.Water.WaterMesh.LODMorphEnabled"), 1,
	TEXT("If the smooth LOD morph is enabled. Turning this off may cause slight popping between LOD levels but will skip the calculations in the vertex shader, making it cheaper"),
	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"),

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

Scope (from outer to inner):

file
class        class TWaterVertexFactoryShaderParameters : public FVertexFactoryShaderParameters
function     void GetElementShaderBindings

Source code excerpt:

			ShaderBindings.Add(QuadTreePositionParameter, FVector3f(PreViewTranslation + VertexFactory->GetQuadTreePositionWS()));

			static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Water.WaterMesh.LODMorphEnabled"));
			const bool bLODMorphingEnabled = CVar && CVar->GetValueOnRenderThread() != 0;
			ShaderBindings.Add(LODMorphingEnabledParameter, bLODMorphingEnabled ? 1 : 0);
		}
		else if (VertexStreams.Num() > 0)
		{
			for (int32 i = 0; i < WaterInstanceDataBuffersType::NumBuffers; ++i)

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:


/** Scalability CVars */
static TAutoConsoleVariable<int32> CVarWaterMeshLODMorphEnabled(
	TEXT("r.Water.WaterMesh.LODMorphEnabled"), 1,
	TEXT("If the smooth LOD morph is enabled. Turning this off may cause slight popping between LOD levels but will skip the calculations in the vertex shader, making it cheaper"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarWaterMeshGPUQuadTreeSuperSampling(
	TEXT("r.Water.WaterMesh.GPUQuadTree.SuperSampling"), 2,

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

Scope (from outer to inner):

file
function     void FWaterMeshSceneProxy::GetDynamicMeshElements

Source code excerpt:

			WaterQuadTreeGPUTraverseParams.DebugShowTile = CVarWaterMeshShowTileBounds.GetValueOnRenderThread();
			WaterQuadTreeGPUTraverseParams.bWithWaterSelectionSupport = WITH_WATER_SELECTION_SUPPORT != 0;
			WaterQuadTreeGPUTraverseParams.bLODMorphingEnabled = !!CVarWaterMeshLODMorphEnabled.GetValueOnRenderThread();

			bNeedToTraverseGPUQuadTree = true;
		}


		using FWaterVertexFactoryUserDataWrapperType = TWaterVertexFactoryUserDataWrapper<WITH_WATER_SELECTION_SUPPORT>;

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

Scope (from outer to inner):

file
function     void FWaterMeshSceneProxy::GetDynamicMeshElements

Source code excerpt:

			TraversalDesc.PreViewTranslation = View->ViewMatrices.GetPreViewTranslation();
			TraversalDesc.LODScale = LODScale;
			TraversalDesc.bLODMorphingEnabled = !!CVarWaterMeshLODMorphEnabled.GetValueOnRenderThread();
			TraversalDesc.WaterInfoBounds = WaterInfoBounds;
			TraversalDesc.OcclusionCullingResults = nullptr;
			TraversalDesc.OcclusionCullingFarMeshOffset = OcclusionResultsFarMeshOffset;
			if (CVarWaterMeshOcclusionCulling.GetValueOnRenderThread() != 0)
			{
				const FOcclusionCullingResults* CullingResults = OcclusionResults.Find(View->GetViewKey());

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

Scope (from outer to inner):

file
function     void FWaterMeshSceneProxy::GetDynamicRayTracingInstances

Source code excerpt:

	TraversalDesc.Frustum = FConvexVolume(); // Default volume to disable frustum culling
	TraversalDesc.LODScale = LODScale;
	TraversalDesc.bLODMorphingEnabled = !!CVarWaterMeshLODMorphEnabled.GetValueOnRenderThread();
	TraversalDesc.WaterInfoBounds = WaterInfoBounds;

	WaterQuadTree.BuildWaterTileInstanceData(TraversalDesc, WaterInstanceData);

	if (WaterInstanceData.InstanceCount == 0)
	{