r.Water.WaterMesh.LODCountBias
r.Water.WaterMesh.LODCountBias
#Overview
name: r.Water.WaterMesh.LODCountBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This value is added to the LOD Count of each Water Mesh Component. Negative values will lower the quality(fewer and larger water tiles at the bottom level of the water quadtree), higher values will increase quality (more and smaller water tiles at the bottom level of the water quadtree)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.WaterMesh.LODCountBias is to control the level of detail (LOD) for water mesh components in Unreal Engine 5’s water rendering system. It allows developers to adjust the quality and performance of water rendering by modifying the number and size of water tiles in the water quadtree structure.
This setting variable is primarily used by the Water plugin, which is an experimental feature in Unreal Engine 5. Specifically, it is utilized in the WaterMeshComponent, which is responsible for rendering water surfaces in the game.
The value of this variable is set through a console variable (CVar) system. It can be adjusted at runtime or set in configuration files. The default value is 0, but it can be changed to positive or negative integers.
The associated variable CVarWaterMeshLODCountBias interacts directly with r.Water.WaterMesh.LODCountBias. They share the same value and purpose. This variable is used within the C++ code to retrieve and apply the LOD count bias.
Developers must be aware that:
- Positive values increase quality but may impact performance.
- Negative values decrease quality but can improve performance.
- Changes to this variable will affect the entire water rendering system.
Best practices when using this variable include:
- Use it for scalability purposes, adjusting based on target hardware capabilities.
- Test thoroughly with different values to find the optimal balance between visual quality and performance.
- Consider exposing this setting to end-users as a graphics quality option.
Regarding the associated variable CVarWaterMeshLODCountBias:
- It is defined as a TAutoConsoleVariable
, allowing for runtime adjustments. - It is used in the UWaterMeshComponent::Update function to detect changes and trigger mesh rebuilds when necessary.
- The value is cached in the UWaterMeshComponent class as LODCountBiasScalability to optimize performance by avoiding frequent CVar queries.
When working with CVarWaterMeshLODCountBias, developers should ensure that changes to this variable are properly handled in the water mesh update logic to maintain consistent rendering quality across different hardware configurations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:20
Scope: file
Source code excerpt:
/** Scalability CVars*/
static TAutoConsoleVariable<int32> CVarWaterMeshLODCountBias(
TEXT("r.Water.WaterMesh.LODCountBias"), 0,
TEXT("This value is added to the LOD Count of each Water Mesh Component. Negative values will lower the quality(fewer and larger water tiles at the bottom level of the water quadtree), higher values will increase quality (more and smaller water tiles at the bottom level of the water quadtree)"),
ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarWaterMeshTessFactorBias(
TEXT("r.Water.WaterMesh.TessFactorBias"), 0,
TEXT("This value is added to the tessellation factor of each Mesh Component. Negative values will lower the overall density/resolution or the vertex grid, higher values will increase the density/resolution "),
#Associated Variable and Callsites
This variable is associated with another variable named CVarWaterMeshLODCountBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:19
Scope: file
Source code excerpt:
/** Scalability CVars*/
static TAutoConsoleVariable<int32> CVarWaterMeshLODCountBias(
TEXT("r.Water.WaterMesh.LODCountBias"), 0,
TEXT("This value is added to the LOD Count of each Water Mesh Component. Negative values will lower the quality(fewer and larger water tiles at the bottom level of the water quadtree), higher values will increase quality (more and smaller water tiles at the bottom level of the water quadtree)"),
ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarWaterMeshTessFactorBias(
TEXT("r.Water.WaterMesh.TessFactorBias"), 0,
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:820
Scope (from outer to inner):
file
function void UWaterMeshComponent::Update
Source code excerpt:
}
const int32 NewLODCountBias = CVarWaterMeshLODCountBias.GetValueOnGameThread();
const int32 NewTessFactorBias = CVarWaterMeshTessFactorBias.GetValueOnGameThread();
const float NewLODScaleBias = CVarWaterMeshLODScaleBias.GetValueOnGameThread();
if (bNeedsRebuild
|| !!CVarWaterMeshShowTileGenerationGeometry.GetValueOnGameThread()
|| !!CVarWaterMeshForceRebuildMeshPerFrame.GetValueOnGameThread()
|| (NewLODCountBias != LODCountBiasScalability)
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Public/WaterMeshComponent.h:127
Scope (from outer to inner):
file
function class WATER_API UWaterMeshComponent : public UMeshComponent { GENERATED_BODY
Source code excerpt:
bool bIsEnabled = false;
/** Cached CVarWaterMeshLODCountBias to detect changes in scalability */
int32 LODCountBiasScalability = 0;
/** Cached CVarWaterMeshTessFactorBias to detect changes in scalability */
int32 TessFactorBiasScalability = 0;
/** Cached CVarWaterMeshLODScaleBias to detect changes in scalability */