r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled
r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled
#Overview
name: r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Use this to prevent the water info from rendering when world rendering is disabled.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled is to control whether the water info texture should be rendered when world rendering is disabled. This setting is primarily used in the water rendering system of Unreal Engine 5.
This setting variable is primarily used in the Experimental Water plugin and the Movie Render Pipeline module. The Water plugin relies on this variable to determine if it should render the water info texture under certain conditions, while the Movie Render Pipeline uses it to override the default behavior during movie rendering.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1 in the Water plugin’s source code.
This variable interacts closely with another variable named CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled, which is the actual ConsoleVariable object that stores and manages the value. They share the same value and purpose.
Developers must be aware that this variable is part of a temporary solution (described as a “HACK” in the comments) to address issues with water rendering during movie capture. The proper long-term solution involves refactoring the water info texture to make it per-view.
Best practices when using this variable include:
- Be cautious when modifying its value, as it may affect water rendering in unexpected ways.
- Consider the impact on performance and visual quality when enabling or disabling this feature.
- Be aware that this is a temporary solution and may be replaced in future engine versions.
Regarding the associated variable CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled:
This is the actual ConsoleVariable object that controls the behavior described above. It is initialized with the same parameters as r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled and has a callback function associated with it.
The callback function (OnSkipWaterInfoTextureRenderWhenWorldRenderingDisabled_Callback) is triggered when the value changes. It interacts with another console variable (r.Water.WaterInfo.RenderMethod) to modify the water info rendering method based on the current value of CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled.
Developers should be aware that changing the value of this variable not only affects whether the water info texture is rendered when world rendering is disabled but also potentially changes the water info rendering method. This interaction adds complexity to the water rendering system and should be handled with care.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterZoneActor.cpp:42
Scope: file
Source code excerpt:
// HACK [jonathan.bard] : (details underneath)
TAutoConsoleVariable<int32> CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled(
TEXT("r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled"),
1,
TEXT("Use this to prevent the water info from rendering when world rendering is disabled."),
FConsoleVariableDelegate::CreateStatic(OnSkipWaterInfoTextureRenderWhenWorldRenderingDisabled_Callback),
ECVF_Default);
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/Nodes/MovieGraphGlobalGameOverrides.cpp:171
Scope (from outer to inner):
file
function void UMovieGraphGlobalGameOverridesNode::ApplySettings
Source code excerpt:
// Water skips water info texture when the world's game viewport rendering is disabled so we need to prevent this from happening.
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT_IF_EXIST(PreviousSkipWaterInfoTextureRenderWhenWorldRenderingDisabled, TEXT("r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled"), 0, bOverrideValues);
}
// Must come after the above cvars so that if one of those cvars is also specified by the scalability level, then we
// restore to the value in the original scalability level, not the value we cached in the scalability level (if applied).
if (!bOverrideValues)
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineGameOverrideSetting.cpp:138
Scope (from outer to inner):
file
function void UMoviePipelineGameOverrideSetting::ApplyCVarSettings
Source code excerpt:
// Water skips water info texture when the world's game viewport rendering is disabled so we need to prevent this from happening.
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT_IF_EXIST(PreviousSkipWaterInfoTextureRenderWhenWorldRenderingDisabled, TEXT("r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled"), 0, bOverrideValues);
// Must come after the above cvars so that if one of those cvars is also specified by the Scalability level, then we restore to the value in the original scalability level
// not the value we cached in the Cinematic level (if applied).
if (bCinematicQualitySettings)
{
if (!bOverrideValues)
#Associated Variable and Callsites
This variable is associated with another variable named CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterZoneActor.cpp:41
Scope: file
Source code excerpt:
// HACK [jonathan.bard] : (details underneath)
TAutoConsoleVariable<int32> CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled(
TEXT("r.Water.SkipWaterInfoTextureRenderWhenWorldRenderingDisabled"),
1,
TEXT("Use this to prevent the water info from rendering when world rendering is disabled."),
FConsoleVariableDelegate::CreateStatic(OnSkipWaterInfoTextureRenderWhenWorldRenderingDisabled_Callback),
ECVF_Default);
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterZoneActor.cpp:56
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/Plugins/Experimental/Water/Source/Runtime/Private/WaterZoneActor.cpp:608
Scope (from outer to inner):
file
function bool AWaterZone::UpdateWaterInfoTexture
Source code excerpt:
// If world rendering is disabled like in a loading screen, the scene renderer is not called and the water info texture will not be drawn.
UGameViewportClient* GameViewport = World->GetGameViewport();
// HACK [jonathan.bard] : CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled is a temporary hack for MRQ because bDisableWorldRendering is true when capturing for MRQ.
// The proper solution is to refactor the water info texture and make it per-view (also for split screen support) : FWaterViewExtension::SetupViewFamily/SetupView
// are called on the game thread so they might be a good place for doing this.
// For now, we just use this CVar trick to let the water info texture be rendered when MRQ runs :
if ((CVarSkipWaterInfoTextureRenderWhenWorldRenderingDisabled.GetValueOnGameThread() != 0) && GameViewport && GameViewport->bDisableWorldRendering)
{
return false;
}
const ETextureRenderTargetFormat Format = bHalfPrecisionTexture ? ETextureRenderTargetFormat::RTF_RGBA16f : RTF_RGBA32f;
UTextureRenderTarget2D* OldTexture = WaterInfoTexture;