r.VolumetricRenderTarget.ReprojectionBoxConstraint
r.VolumetricRenderTarget.ReprojectionBoxConstraint
#Overview
name: r.VolumetricRenderTarget.ReprojectionBoxConstraint
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether reprojected data should be constrained to the new incoming cloud data neighborhod value.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricRenderTarget.ReprojectionBoxConstraint is to control whether reprojected data should be constrained to the new incoming cloud data neighborhood value in the volumetric rendering system of Unreal Engine 5.
This setting variable is primarily used in the rendering system, specifically for volumetric cloud rendering. It is part of the Renderer module of Unreal Engine 5.
The value of this variable is set through a console variable (CVar) system. It is defined as a TAutoConsoleVariable with an integer type, defaulting to 0. This means it can be changed at runtime through console commands or configuration files.
The associated variable CVarVolumetricRenderTargetReprojectionBoxConstraint directly interacts with r.VolumetricRenderTarget.ReprojectionBoxConstraint. They share the same value and purpose.
Developers must be aware that this variable affects the reprojection of volumetric render target data. When enabled (set to a value greater than 0), it constrains the reprojected data to the new incoming cloud data neighborhood value. This can potentially improve the visual quality of volumetric clouds, especially in scenarios where the cloud data is changing rapidly.
Best practices when using this variable include:
- Experimenting with different values to find the optimal balance between performance and visual quality.
- Considering the impact on performance, as enabling this constraint may increase computational cost.
- Using it in conjunction with other volumetric rendering settings for best results.
- Testing the impact in various scenarios, especially those involving fast-moving or rapidly changing volumetric clouds.
Regarding the associated variable CVarVolumetricRenderTargetReprojectionBoxConstraint:
The purpose of CVarVolumetricRenderTargetReprojectionBoxConstraint is identical to r.VolumetricRenderTarget.ReprojectionBoxConstraint. It’s an internal representation of the console variable used within the C++ code.
This variable is used in the Renderer module, specifically in the volumetric rendering system. It’s directly referenced in the ReconstructVolumetricRenderTarget function, where it determines a permutation for the pixel shader used in volumetric render target reconstruction.
The value of this variable is set through the CVar system and can be accessed using the GetValueOnAnyThread() method.
Developers should be aware that changes to this variable will affect shader permutations, potentially impacting both rendering quality and performance. It’s important to profile and test thoroughly when modifying this setting.
Best practices include using this variable in conjunction with other volumetric rendering settings, and considering its impact on different hardware configurations and rendering scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:42
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVolumetricRenderTargetReprojectionBoxConstraint(
TEXT("r.VolumetricRenderTarget.ReprojectionBoxConstraint"), 0,
TEXT("Whether reprojected data should be constrained to the new incoming cloud data neighborhod value."),
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."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarVolumetricRenderTargetReprojectionBoxConstraint
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:41
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarVolumetricRenderTargetReprojectionBoxConstraint(
TEXT("r.VolumetricRenderTarget.ReprojectionBoxConstraint"), 0,
TEXT("Whether reprojected data should be constrained to the new incoming cloud data neighborhod value."),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarVolumetricRenderTargetMinimumDistanceKmToEnableReprojection(
TEXT("r.VolumetricRenderTarget.MinimumDistanceKmToEnableReprojection"), 0.0f,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:599
Scope (from outer to inner):
file
function void ReconstructVolumetricRenderTarget
Source code excerpt:
FReconstructVolumetricRenderTargetPS::FPermutationDomain PermutationVector;
PermutationVector.Set<FReconstructVolumetricRenderTargetPS::FHistoryAvailable>(VolumetricCloudRT.GetHistoryValid());
PermutationVector.Set<FReconstructVolumetricRenderTargetPS::FReprojectionBoxConstraint>(CVarVolumetricRenderTargetReprojectionBoxConstraint.GetValueOnAnyThread() > 0);
PermutationVector.Set<FReconstructVolumetricRenderTargetPS::FCloudMinAndMaxDepth>(ShouldVolumetricCloudTraceWithMinMaxDepth(ViewInfo));
TShaderMapRef<FReconstructVolumetricRenderTargetPS> PixelShader(ViewInfo.ShaderMap, PermutationVector);
FReconstructVolumetricRenderTargetPS::FParameters* PassParameters = GraphBuilder.AllocParameters<FReconstructVolumetricRenderTargetPS::FParameters>();
PassParameters->ViewUniformBuffer = ViewInfo.VolumetricRenderTargetViewUniformBuffer; // Using a special uniform buffer because the view has some special resolution and no split screen offset.
PassParameters->RenderTargets[0] = FRenderTargetBinding(DstVolumetric, ERenderTargetLoadAction::ENoAction);