r.Water.WaterMesh.ShowWireframeAtBaseHeight
r.Water.WaterMesh.ShowWireframeAtBaseHeight
#Overview
name: r.Water.WaterMesh.ShowWireframeAtBaseHeight
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When rendering in wireframe, show the mesh with no displacement
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.WaterMesh.ShowWireframeAtBaseHeight is to control the wireframe rendering of water meshes in Unreal Engine’s experimental water system. This setting is specifically designed for debugging and visualization purposes within the water rendering system.
This setting variable is used in the Experimental Water plugin, which is part of Unreal Engine’s rendering system. The code references are found in the WaterMeshSceneProxy.cpp file, indicating that it’s primarily used in the water mesh rendering pipeline.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning it’s disabled by default.
The associated variable CVarWaterMeshShowWireframeAtBaseHeight directly interacts with r.Water.WaterMesh.ShowWireframeAtBaseHeight. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable is intended for use in wireframe rendering mode. When enabled (set to 1), it will show the water mesh without any displacement, which can be useful for inspecting the base geometry of the water surface.
Best practices for using this variable include:
- Only enable it when debugging or inspecting water mesh geometry.
- Remember to disable it in production builds or when not needed, as it may impact performance.
- Use it in conjunction with other wireframe rendering tools for a comprehensive view of the water mesh structure.
Regarding the associated variable CVarWaterMeshShowWireframeAtBaseHeight:
This is an internal representation of the r.Water.WaterMesh.ShowWireframeAtBaseHeight console variable. It’s used within the C++ code to access the current value of the setting. The purpose and usage are identical to r.Water.WaterMesh.ShowWireframeAtBaseHeight.
The value of CVarWaterMeshShowWireframeAtBaseHeight is set when the console variable is initialized or changed through the console.
It’s used in the GetDynamicMeshElements function of the FWaterMeshSceneProxy class to determine whether to render the water mesh wireframe at the base height.
Developers should be aware that this variable is accessed on the render thread, as indicated by the GetValueOnRenderThread() method call.
Best practices for using CVarWaterMeshShowWireframeAtBaseHeight include:
- Always access it using GetValueOnRenderThread() when in render thread code.
- Avoid modifying it directly; instead, use the console variable system to change its value.
- Consider caching its value if used frequently in performance-critical sections of 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:93
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarWaterMeshShowWireframeAtBaseHeight(
TEXT("r.Water.WaterMesh.ShowWireframeAtBaseHeight"),
0,
TEXT("When rendering in wireframe, show the mesh with no displacement"),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<int32> CVarWaterMeshEnableRendering(
#Associated Variable and Callsites
This variable is associated with another variable named CVarWaterMeshShowWireframeAtBaseHeight
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshSceneProxy.cpp:92
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarWaterMeshShowWireframeAtBaseHeight(
TEXT("r.Water.WaterMesh.ShowWireframeAtBaseHeight"),
0,
TEXT("When rendering in wireframe, show the mesh with no displacement"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterMeshSceneProxy.cpp:402
Scope (from outer to inner):
file
function void FWaterMeshSceneProxy::GetDynamicMeshElements
Source code excerpt:
FColoredMaterialRenderProxy* WireframeMaterialInstance = nullptr;
if (bWireframe && CVarWaterMeshShowWireframeAtBaseHeight.GetValueOnRenderThread() == 1)
{
WireframeMaterialInstance = new FColoredMaterialRenderProxy(
GEngine->WireframeMaterial ? GEngine->WireframeMaterial->GetRenderProxy() : NULL,
FColor::Cyan);
Collector.RegisterOneFrameMaterialProxy(WireframeMaterialInstance);