r.Water.WaterMesh.TessFactorBias
r.Water.WaterMesh.TessFactorBias
#Overview
name: r.Water.WaterMesh.TessFactorBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
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
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.WaterMesh.TessFactorBias is to adjust the tessellation factor of water mesh components in Unreal Engine’s experimental Water system. This setting variable allows developers to control the density and resolution of the vertex grid used for water meshes.
This setting variable is primarily used by the Water plugin, which is an experimental feature in Unreal Engine 5. Specifically, it is utilized within the WaterMeshComponent module of the Water plugin.
The value of this variable is set through a console variable (CVar) system, which allows for runtime adjustments. It is initialized with a default value of 0 in the WaterMeshComponent.cpp file.
The r.Water.WaterMesh.TessFactorBias interacts closely with other water-related variables, particularly CVarWaterMeshLODCountBias and CVarWaterMeshLODScaleBias. These variables work together to control different aspects of water mesh rendering and level of detail (LOD) settings.
Developers must be aware that changing this variable will directly impact the performance and visual quality of water rendering. Negative values will decrease the density/resolution of the vertex grid, potentially improving performance at the cost of visual fidelity. Positive values will increase the density/resolution, potentially enhancing visual quality but at the cost of performance.
Best practices when using this variable include:
- Carefully balancing performance and visual quality requirements.
- Testing different values to find the optimal setting for your specific use case.
- Considering the target hardware capabilities when adjusting this value.
- Using this in conjunction with other water-related settings for a comprehensive approach to water rendering optimization.
Regarding the associated variable CVarWaterMeshTessFactorBias:
This is the actual console variable that stores and manages the r.Water.WaterMesh.TessFactorBias value. It is of type int32 and is used to retrieve the current tessellation factor bias value at runtime.
The purpose of CVarWaterMeshTessFactorBias is to provide a way to access and modify the tessellation factor bias through the console variable system. This allows for dynamic adjustments during development or runtime.
This variable is used within the Water plugin, specifically in the WaterMeshComponent’s Update() function. It’s checked every frame to determine if the tessellation factor bias has changed, which might trigger a rebuild of the water mesh.
Developers should be aware that changes to this variable will take effect immediately, potentially causing visual or performance changes in real-time. It’s important to use this variable responsibly and in conjunction with proper performance monitoring tools.
Best practices for using CVarWaterMeshTessFactorBias include:
- Using it for debugging and fine-tuning water rendering during development.
- Considering exposing it as a user-adjustable setting for different quality presets in your game.
- Documenting the impacts of different values for your specific water implementation to aid in future optimizations.
#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:25
Scope: file
Source code excerpt:
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 "),
ECVF_Scalability);
static TAutoConsoleVariable<float> CVarWaterMeshLODScaleBias(
TEXT("r.Water.WaterMesh.LODScaleBias"), 0.0f,
TEXT("This value is added to the LOD Scale of each Mesh Component. Negative values will lower the overall density/resolution or the vertex grid and make the LODs smaller, higher values will increase the density/resolution and make the LODs larger. Smallest value is -0.5. That will make the inner LOD as tight and optimized as possible"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarWaterMeshTessFactorBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:24
Scope: file
Source code excerpt:
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 "),
ECVF_Scalability);
static TAutoConsoleVariable<float> CVarWaterMeshLODScaleBias(
TEXT("r.Water.WaterMesh.LODScaleBias"), 0.0f,
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:821
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)
|| (NewTessFactorBias != TessFactorBiasScalability)
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Public/WaterMeshComponent.h:130
Scope (from outer to inner):
file
function class WATER_API UWaterMeshComponent : public UMeshComponent { GENERATED_BODY
Source code excerpt:
int32 LODCountBiasScalability = 0;
/** Cached CVarWaterMeshTessFactorBias to detect changes in scalability */
int32 TessFactorBiasScalability = 0;
/** Cached CVarWaterMeshLODScaleBias to detect changes in scalability */
float LODScaleBiasScalability = 0.0f;
/** Highest tessellation factor of a water tile. Max number of verts on the side of a tile will be (2^TessellationFactor)+1) */