r.Water.WaterMesh.ShowTileGenerationGeometry
r.Water.WaterMesh.ShowTileGenerationGeometry
#Overview
name: r.Water.WaterMesh.ShowTileGenerationGeometry
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This debug option will display the geometry used for intersecting the water grid and generating tiles
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.WaterMesh.ShowTileGenerationGeometry is to provide a debug option for displaying the geometry used for intersecting the water grid and generating tiles in Unreal Engine’s water system.
This setting variable is primarily used in the Water plugin, specifically within the WaterMeshComponent module. It is part of the rendering system, focusing on water visualization and debugging.
The value of this variable is set through a console variable (CVar) named CVarWaterMeshShowTileGenerationGeometry. It is initialized with a default value of 0, which means the debug visualization is turned off by default.
The associated variable CVarWaterMeshShowTileGenerationGeometry directly interacts with r.Water.WaterMesh.ShowTileGenerationGeometry. They share the same value and purpose.
Developers should be aware that:
- This variable is intended for debugging purposes and should not be enabled in shipping builds.
- It may have performance implications when enabled, as it adds additional debug rendering.
- The visualization only appears in non-shipping and non-test builds, as evidenced by the #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) preprocessor directives.
Best practices when using this variable include:
- Use it only during development and debugging phases.
- Disable it before final builds or performance testing.
- Be cautious of potential performance impact when enabled.
Regarding the associated variable CVarWaterMeshShowTileGenerationGeometry:
- It is defined as a TAutoConsoleVariable
, allowing it to be changed at runtime through console commands. - It is used in various parts of the WaterMeshComponent to conditionally draw debug geometry.
- The variable is checked using GetValueOnGameThread() to ensure thread-safe access.
- It influences the Update function of UWaterMeshComponent, potentially triggering a rebuild of the water mesh when enabled.
Developers should use this variable in conjunction with other water-related debug options for comprehensive water system debugging and visualization.
#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:43
Scope: file
Source code excerpt:
/** Debug CVars */
static TAutoConsoleVariable<int32> CVarWaterMeshShowTileGenerationGeometry(
TEXT("r.Water.WaterMesh.ShowTileGenerationGeometry"),
0,
TEXT("This debug option will display the geometry used for intersecting the water grid and generating tiles"),
ECVF_Default
);
static TAutoConsoleVariable<int32> CVarWaterMeshForceRebuildMeshPerFrame(
#Associated Variable and Callsites
This variable is associated with another variable named CVarWaterMeshShowTileGenerationGeometry
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:42
Scope: file
Source code excerpt:
/** Debug CVars */
static TAutoConsoleVariable<int32> CVarWaterMeshShowTileGenerationGeometry(
TEXT("r.Water.WaterMesh.ShowTileGenerationGeometry"),
0,
TEXT("This debug option will display the geometry used for intersecting the water grid and generating tiles"),
ECVF_Default
);
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:623
Scope (from outer to inner):
file
lambda-function
Source code excerpt:
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (!!CVarWaterMeshShowTileGenerationGeometry.GetValueOnGameThread())
{
DrawDebugBox(GetWorld(), Box.GetCenter(), Box.GetExtent(), FColor::Red);
}
#endif
}
break;
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:700
Scope (from outer to inner):
file
lambda-function
Source code excerpt:
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (!!CVarWaterMeshShowTileGenerationGeometry.GetValueOnGameThread())
{
float Z = SplineComp->GetLocationAtDistanceAlongSpline(0.0f, ESplineCoordinateSpace::World).Z;
int32 NumVertices = Polygon.Num();
for (int32 i = 0; i < NumVertices; i++)
{
const FVector2D& Point0 = Polygon[i];
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:750
Scope (from outer to inner):
file
lambda-function
Source code excerpt:
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (!!CVarWaterMeshShowTileGenerationGeometry.GetValueOnGameThread())
{
float Z = SplineComp->GetLocationAtDistanceAlongSpline(0.0f, ESplineCoordinateSpace::World).Z;
int32 NumVertices = Polygon.Num();
for (int32 i = 0; i < NumVertices; i++)
{
const FVector2D& Point0 = Polygon[i];
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshComponent.cpp:824
Scope (from outer to inner):
file
function void UWaterMeshComponent::Update
Source code excerpt:
const float NewLODScaleBias = CVarWaterMeshLODScaleBias.GetValueOnGameThread();
if (bNeedsRebuild
|| !!CVarWaterMeshShowTileGenerationGeometry.GetValueOnGameThread()
|| !!CVarWaterMeshForceRebuildMeshPerFrame.GetValueOnGameThread()
|| (NewLODCountBias != LODCountBiasScalability)
|| (NewTessFactorBias != TessFactorBiasScalability)
|| (NewLODScaleBias != LODScaleBiasScalability))
{
LODCountBiasScalability = NewLODCountBias;