r.VolumetricRenderTarget.MinimumDistanceKmToEnableReprojection
r.VolumetricRenderTarget.MinimumDistanceKmToEnableReprojection
#Overview
name: r.VolumetricRenderTarget.MinimumDistanceKmToEnableReprojection
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This is the distance in kilometer at which the
cloud surfacemust be before we enable reprojection of the previous frame data. One could start with a value of 4km. This helps hide reprojection issues due to imperfect approximation of cloud depth as a single front surface, especially visible when flying through the cloud layer. It is not perfect but will help in lots of cases. The problem when using this method: clouds will look noisier when closer to that distance.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricRenderTarget.MinimumDistanceKmToEnableReprojection is to control the distance at which reprojection of previous frame data is enabled for volumetric cloud rendering. This setting is part of Unreal Engine’s volumetric rendering system, specifically for cloud rendering.
This setting variable is used in the Renderer module of Unreal Engine, particularly in the volumetric rendering subsystem. It’s referenced in the VolumetricRenderTarget.cpp file, which handles the rendering of volumetric effects like clouds.
The value of this variable is set through a console variable (CVarVolumetricRenderTargetMinimumDistanceKmToEnableReprojection). It can be modified at runtime using console commands or through configuration files.
This variable interacts with the volumetric render target system. It’s used in the ReconstructVolumetricRenderTarget function to determine when to enable reprojection based on the distance to the cloud surface.
Developers must be aware that this variable affects the visual quality and performance of volumetric cloud rendering. Setting a higher value will enable reprojection at greater distances, which can help hide reprojection issues when flying through cloud layers. However, it may also result in noisier clouds when closer to the specified distance.
Best practices for using this variable include:
- Start with a value around 4km as suggested in the comments.
- Adjust based on the specific needs of the scene and the desired balance between visual quality and performance.
- Be mindful of the trade-off between hiding reprojection issues and potentially increasing noise in closer clouds.
Regarding the associated variable CVarVolumetricRenderTargetMinimumDistanceKmToEnableReprojection:
This is the actual console variable that stores the value for r.VolumetricRenderTarget.MinimumDistanceKmToEnableReprojection. It’s defined with a default value of 0.0f and can be modified at runtime. The variable is marked as render thread safe and scalable, meaning it can be adjusted based on performance requirements.
When using this variable, developers should:
- Access its value using GetValueOnRenderThread() to ensure thread safety.
- Consider the performance implications of frequent changes to this value.
- Use it in conjunction with other volumetric rendering settings for optimal results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:47
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarVolumetricRenderTargetMinimumDistanceKmToEnableReprojection(
TEXT("r.VolumetricRenderTarget.MinimumDistanceKmToEnableReprojection"), 0.0f,
TEXT("This is the distance in kilometer at which the `cloud surface` must be before we enable reprojection of the previous frame data. One could start with a value of 4km. This helps hide reprojection issues due to imperfect approximation of cloud depth as a single front surface, especially visible when flying through the cloud layer. It is not perfect but will help in lots of cases. The problem when using this method: clouds will look noisier when closer to that distance."),
ECVF_RenderThreadSafe | ECVF_Scalability);
static float GetUvNoiseSampleAcceptanceWeight()
{
return FMath::Max(0.0f, CVarVolumetricRenderTargetUvNoiseSampleAcceptanceWeight.GetValueOnRenderThread());
#Associated Variable and Callsites
This variable is associated with another variable named CVarVolumetricRenderTargetMinimumDistanceKmToEnableReprojection
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:46
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarVolumetricRenderTargetMinimumDistanceKmToEnableReprojection(
TEXT("r.VolumetricRenderTarget.MinimumDistanceKmToEnableReprojection"), 0.0f,
TEXT("This is the distance in kilometer at which the `cloud surface` must be before we enable reprojection of the previous frame data. One could start with a value of 4km. This helps hide reprojection issues due to imperfect approximation of cloud depth as a single front surface, especially visible when flying through the cloud layer. It is not perfect but will help in lots of cases. The problem when using this method: clouds will look noisier when closer to that distance."),
ECVF_RenderThreadSafe | ECVF_Scalability);
static float GetUvNoiseSampleAcceptanceWeight()
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:618
Scope (from outer to inner):
file
function void ReconstructVolumetricRenderTarget
Source code excerpt:
PassParameters->VolumetricRenderTargetMode = VolumetricCloudRT.GetMode();
PassParameters->HalfResDepthTexture = (VolumetricCloudRT.GetMode() == 0 || VolumetricCloudRT.GetMode() == 3) ? HalfResolutionDepthCheckerboardMinMaxTexture : SceneDepthTexture;
PassParameters->MinimumDistanceKmToEnableReprojection = FMath::Max(0.0f, CVarVolumetricRenderTargetMinimumDistanceKmToEnableReprojection.GetValueOnRenderThread());
PassParameters->HistoryPreExposureCorrection = ViewInfo.PreExposure / VolumetricCloudRT.GetPrevViewExposure();
const bool bVisualizeConservativeDensity = ShouldViewVisualizeVolumetricCloudConservativeDensity(ViewInfo, ViewInfo.Family->EngineShowFlags);
PassParameters->HalfResDepthTexture = bVisualizeConservativeDensity ?
((bool)ERHIZBuffer::IsInverted ? SystemTextures.Black : SystemTextures.White) :
((VolumetricCloudRT.GetMode() == 0 || VolumetricCloudRT.GetMode() == 3) ?