r.Water.WaterMesh.ShowWireframe

r.Water.WaterMesh.ShowWireframe

#Overview

name: r.Water.WaterMesh.ShowWireframe

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Water.WaterMesh.ShowWireframe is to control the wireframe rendering of water meshes in the Unreal Engine’s water simulation system. This setting variable is used for debugging and visualization purposes in the water rendering pipeline.

This setting variable is primarily relied upon by the Experimental Water plugin in Unreal Engine. Specifically, it’s used within the Water module’s runtime implementation.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning the wireframe rendering is off by default.

The associated variable CVarWaterMeshShowWireframe interacts directly with r.Water.WaterMesh.ShowWireframe. They share the same value and purpose, with CVarWaterMeshShowWireframe being the C++ representation of the console variable.

Developers must be aware that this variable is render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed from the render thread. It’s also important to note that this variable is intended for debug purposes and should not be relied upon for gameplay or production-level features.

Best practices when using this variable include:

  1. Only enable it during development and debugging sessions.
  2. Be aware of potential performance impacts when enabled, especially in complex water scenes.
  3. Use it in conjunction with other debug visualization tools for a comprehensive understanding of the water rendering.

Regarding the associated variable CVarWaterMeshShowWireframe:

The purpose of CVarWaterMeshShowWireframe is to provide a C++ accessible representation of the r.Water.WaterMesh.ShowWireframe console variable. It serves the same function of controlling wireframe rendering for water meshes.

This variable is used within the Water plugin’s runtime module, specifically in the WaterMeshSceneProxy class.

The value of CVarWaterMeshShowWireframe is set when the r.Water.WaterMesh.ShowWireframe console variable is set, as they are directly linked.

CVarWaterMeshShowWireframe interacts with the engine’s debug viewmodes and show flags. It’s checked alongside the engine’s wireframe show flag to determine if wireframe rendering should be applied to water meshes.

Developers should be aware that this variable is accessed on the render thread (GetValueOnRenderThread()), which is consistent with its render thread safe nature.

Best practices for using CVarWaterMeshShowWireframe include:

  1. Access it only from render thread contexts.
  2. Use it in conjunction with other debug rendering checks, such as AllowDebugViewmodes().
  3. Consider potential performance implications when enabling wireframe rendering in complex scenes.

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

Scope: file

Source code excerpt:

/** Debug CVars */
static TAutoConsoleVariable<int32> CVarWaterMeshShowWireframe(
	TEXT("r.Water.WaterMesh.ShowWireframe"),
	0,
	TEXT("Forces wireframe rendering on for water"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarWaterMeshShowWireframeAtBaseHeight(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:


/** Debug CVars */
static TAutoConsoleVariable<int32> CVarWaterMeshShowWireframe(
	TEXT("r.Water.WaterMesh.ShowWireframe"),
	0,
	TEXT("Forces wireframe rendering on for water"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
function     void FWaterMeshSceneProxy::GetDynamicMeshElements

Source code excerpt:


	// Set up wireframe material (if needed)
	const bool bWireframe = AllowDebugViewmodes() && (ViewFamily.EngineShowFlags.Wireframe || CVarWaterMeshShowWireframe.GetValueOnRenderThread() == 1);

	FColoredMaterialRenderProxy* WireframeMaterialInstance = nullptr;
	if (bWireframe && CVarWaterMeshShowWireframeAtBaseHeight.GetValueOnRenderThread() == 1)
	{
		WireframeMaterialInstance = new FColoredMaterialRenderProxy(
			GEngine->WireframeMaterial ? GEngine->WireframeMaterial->GetRenderProxy() : NULL,