r.Water.WaterInfo.RenderMethod
r.Water.WaterInfo.RenderMethod
#Overview
name: r.Water.WaterInfo.RenderMethod
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: SceneCaptures, 1: Custom, 2: CustomRenderPasses
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.WaterInfo.RenderMethod is to control the rendering method used for water information in Unreal Engine 5’s water system. It is primarily used within the experimental Water plugin and affects how water-related information is rendered and processed.
This setting variable is primarily relied upon by the Water plugin, specifically within the Runtime module. It is used in various components and systems related to water rendering and processing, including:
- WaterViewExtension
- WaterBodyInfoMeshComponent
- WaterZoneActor
- LandscapeRender (indirectly)
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1 and can be changed at runtime through console commands or programmatically.
The associated variable CVarWaterInfoRenderMethod interacts directly with r.Water.WaterInfo.RenderMethod. They share the same value and are used interchangeably in the code.
Developers should be aware of the following when using this variable:
-
It has three possible values:
- 0: SceneCaptures
- 1: Custom (default)
- 2: CustomRenderPasses
-
Changing this value can affect the performance and visual quality of water rendering.
-
It may interact with other water-related settings and systems, so changes should be tested thoroughly.
-
The variable is marked as render thread safe, meaning it can be accessed from both game and render threads.
Best practices when using this variable include:
-
Use the GetWaterInfoRenderingMethod() function to retrieve the current value, as it handles potential null cases.
-
Consider performance implications when changing the rendering method, especially in complex scenes with multiple water bodies.
-
Test different values to find the best balance between visual quality and performance for your specific use case.
-
Be cautious when modifying this value in shipping builds, as it may impact performance or visual consistency.
Regarding the associated variable CVarWaterInfoRenderMethod:
This is the actual console variable object that stores and manages the r.Water.WaterInfo.RenderMethod value. It is created using the TAutoConsoleVariable template and is used internally by the engine to handle the console variable functionality. Developers should generally interact with r.Water.WaterInfo.RenderMethod through console commands or the IConsoleManager interface, rather than directly accessing CVarWaterInfoRenderMethod.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterViewExtension.cpp:27
Scope: file
Source code excerpt:
extern void OnCVarWaterInfoSceneProxiesValueChanged(IConsoleVariable*);
static TAutoConsoleVariable<int32> CVarWaterInfoRenderMethod(
TEXT("r.Water.WaterInfo.RenderMethod"),
1,
TEXT("0: SceneCaptures, 1: Custom, 2: CustomRenderPasses"),
FConsoleVariableDelegate::CreateStatic(OnCVarWaterInfoSceneProxiesValueChanged),
ECVF_Default | ECVF_RenderThreadSafe);
// ----------------------------------------------------------------------------------
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterBodyInfoMeshComponent.cpp:30
Scope (from outer to inner):
file
function int32 GetWaterInfoRenderingMethod
Source code excerpt:
int32 GetWaterInfoRenderingMethod()
{
static IConsoleVariable* CVarWaterInfoRenderMethod = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Water.WaterInfo.RenderMethod"));
return CVarWaterInfoRenderMethod ? CVarWaterInfoRenderMethod->GetInt() : 0;
}
UWaterBodyInfoMeshComponent::UWaterBodyInfoMeshComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterZoneActor.cpp:55
Scope (from outer to inner):
file
function void OnSkipWaterInfoTextureRenderWhenWorldRenderingDisabled_Callback
Source code excerpt:
{
static int PreviousWaterInfoRenderMethodValue = 1;
IConsoleVariable* WaterInfoRenderMethodCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Water.WaterInfo.RenderMethod"));
if (CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled.GetValueOnAnyThread() == 0)
{
PreviousWaterInfoRenderMethodValue = WaterInfoRenderMethodCVar->GetInt();
WaterInfoRenderMethodCVar->Set(2);
}
else
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:283
Scope (from outer to inner):
file
namespace UE::Landscape
function bool NeedsFixedGridVertexFactory
Source code excerpt:
// We need the fixed grid vertex factory for rendering the water info texture :
// This cvar is defined in the water plugin and searching for it should return nullptr if the plugin is not loaded
const bool bWaterPluginLoaded = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Water.WaterInfo.RenderMethod")) != nullptr;
bNeedsFixedGridVertexFactory |= bWaterPluginLoaded;
return bNeedsFixedGridVertexFactory;
}
bool ShouldBuildGrassMapRenderingResources()
#Associated Variable and Callsites
This variable is associated with another variable named CVarWaterInfoRenderMethod
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterBodyInfoMeshComponent.cpp:30
Scope (from outer to inner):
file
function int32 GetWaterInfoRenderingMethod
Source code excerpt:
int32 GetWaterInfoRenderingMethod()
{
static IConsoleVariable* CVarWaterInfoRenderMethod = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Water.WaterInfo.RenderMethod"));
return CVarWaterInfoRenderMethod ? CVarWaterInfoRenderMethod->GetInt() : 0;
}
UWaterBodyInfoMeshComponent::UWaterBodyInfoMeshComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
bAffectDistanceFieldLighting = false;
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterViewExtension.cpp:26
Scope: file
Source code excerpt:
extern void OnCVarWaterInfoSceneProxiesValueChanged(IConsoleVariable*);
static TAutoConsoleVariable<int32> CVarWaterInfoRenderMethod(
TEXT("r.Water.WaterInfo.RenderMethod"),
1,
TEXT("0: SceneCaptures, 1: Custom, 2: CustomRenderPasses"),
FConsoleVariableDelegate::CreateStatic(OnCVarWaterInfoSceneProxiesValueChanged),
ECVF_Default | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterViewExtension.cpp:312
Scope (from outer to inner):
file
function void FWaterViewExtension::SetupView
Source code excerpt:
ON_SCOPE_EXIT { bUpdatingWaterInfo = false; };
const int32 WaterInfoRenderMethod = CVarWaterInfoRenderMethod.GetValueOnGameThread();
FSceneInterface* Scene = WorldPtr.Get()->Scene;
check(Scene != nullptr);
for (const TPair<AWaterZone*, UE::WaterInfo::FRenderingContext>& Pair : WaterInfoContextsToRender)
{
AWaterZone* WaterZone = Pair.Key;