r.Water.WaterInfo.DilationOverwriteMinimumDistance
r.Water.WaterInfo.DilationOverwriteMinimumDistance
#Overview
name: r.Water.WaterInfo.DilationOverwriteMinimumDistance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The minimum distance below the ground when we allow dilation to write on top of water
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.WaterInfo.DilationOverwriteMinimumDistance is to control the minimum distance below the ground where water dilation is allowed to overwrite existing water information in the water rendering system of Unreal Engine 5.
This setting variable is primarily used in the water rendering subsystem of Unreal Engine 5. Based on the callsites, it’s utilized in the WaterInfoTextureRendering module and the Experimental Water plugin.
The value of this variable is set as a console variable with a default value of 128.0f. It can be modified at runtime through the console or programmatically.
The associated variable CVarWaterInfoDilationOverwriteMinimumDistance interacts directly with r.Water.WaterInfo.DilationOverwriteMinimumDistance, as they share the same value. This associated variable is used to retrieve the current value of the setting in the render thread.
Developers must be aware that this variable affects the water rendering process, specifically how water information is dilated and merged with depth information. Changing this value can impact the visual appearance of water, especially in areas where water intersects with terrain or other objects.
Best practices when using this variable include:
- Carefully adjusting the value to achieve the desired visual effect without introducing artifacts.
- Testing the changes across various water scenarios in the game to ensure consistent results.
- Considering performance implications, as changes to this value may affect the complexity of water rendering.
Regarding the associated variable CVarWaterInfoDilationOverwriteMinimumDistance:
- Its purpose is to provide a convenient way to access the r.Water.WaterInfo.DilationOverwriteMinimumDistance value within the rendering code.
- It’s used in the water info texture rendering process, specifically in the RenderWaterInfoTexture function.
- The value is retrieved using GetValueOnRenderThread() to ensure thread-safe access during rendering.
- Developers should be aware that modifying the console variable will affect this associated variable as well.
- Best practices include using this variable consistently throughout the water rendering code for accessing the dilation overwrite minimum distance, rather than directly accessing the console variable in multiple places.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/WaterInfoTextureRendering.cpp:21
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarWaterInfoDilationOverwriteMinimumDistance(
TEXT("r.Water.WaterInfo.DilationOverwriteMinimumDistance"),
128.f,
TEXT("The minimum distance below the ground when we allow dilation to write on top of water"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRenderCaptureNextWaterInfoDraws(
TEXT("r.Water.WaterInfo.RenderCaptureNextWaterInfoDraws"),
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterInfoRendering.cpp:115
Scope (from outer to inner):
file
namespace UE::WaterInfo
function static void MergeWaterInfoAndDepth
Source code excerpt:
{
static auto* CVarDilationOverwriteMinimumDistance = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.Water.WaterInfo.DilationOverwriteMinimumDistance"));
static auto* CVarUndergroundDilationDepthOffset = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.Water.WaterInfo.UndergroundDilationDepthOffset"));
FWaterInfoMergePS::FParameters* PassParameters = GraphBuilder.AllocParameters<FWaterInfoMergePS::FParameters>();
PassParameters->View = View.ViewUniformBuffer;
PassParameters->RenderTargets[0] = FRenderTargetBinding(OutputTexture, ERenderTargetLoadAction::ENoAction);
PassParameters->SceneTextures = GetSceneTextureShaderParameters(View);
#Associated Variable and Callsites
This variable is associated with another variable named CVarWaterInfoDilationOverwriteMinimumDistance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/WaterInfoTextureRendering.cpp:20
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarWaterInfoDilationOverwriteMinimumDistance(
TEXT("r.Water.WaterInfo.DilationOverwriteMinimumDistance"),
128.f,
TEXT("The minimum distance below the ground when we allow dilation to write on top of water"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRenderCaptureNextWaterInfoDraws(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/WaterInfoTextureRendering.cpp:982
Scope (from outer to inner):
file
function void RenderWaterInfoTexture
Source code excerpt:
PassParameters->WaterHeightExtents = RenderingParams.WaterHeightExtents;
PassParameters->GroundZMin = RenderingParams.GroundZMin;
PassParameters->DilationOverwriteMinimumDistance = CVarWaterInfoDilationOverwriteMinimumDistance.GetValueOnRenderThread();
PassParameters->UndergroundDilationDepthOffset = CVarWaterInfoUndergroundDilationDepthOffset.GetValueOnRenderThread();
FPixelShaderUtils::AddFullscreenPass(
GraphBuilder,
ShaderMap,
RDG_EVENT_NAME("WaterInfoTextureMerge"),