r.RayTracing.Transmission.RejectionSamplingTrials
r.RayTracing.Transmission.RejectionSamplingTrials
#Overview
name: r.RayTracing.Transmission.RejectionSamplingTrials
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Determines the number of rejection-sampling trials (default = 0)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Transmission.RejectionSamplingTrials is to determine the number of rejection-sampling trials in ray-traced transmission calculations for the rendering system, specifically in the context of ray-traced shadows.
This setting variable is primarily used in the Unreal Engine’s renderer module, particularly in the ray tracing subsystem for shadows. It’s referenced in the RayTracingShadows.cpp file, which is part of the ray tracing implementation for shadow rendering.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, but can be changed at runtime through console commands or programmatically.
The associated variable CVarRayTracingTransmissionRejectionSamplingTrials interacts directly with r.RayTracing.Transmission.RejectionSamplingTrials. They share the same value and purpose.
Developers must be aware that this variable affects the quality and performance of ray-traced transmission calculations. A higher number of rejection-sampling trials may result in more accurate transmission effects but at the cost of increased computational overhead.
Best practices when using this variable include:
- Start with the default value (0) and increase it only if necessary for improved visual quality.
- Balance the number of trials against performance requirements, as higher values will increase rendering time.
- Test different values in various lighting scenarios to find the optimal setting for your specific use case.
Regarding the associated variable CVarRayTracingTransmissionRejectionSamplingTrials:
The purpose of CVarRayTracingTransmissionRejectionSamplingTrials is identical to r.RayTracing.Transmission.RejectionSamplingTrials. It’s the actual console variable implementation that controls the number of rejection-sampling trials in ray-traced transmission calculations.
This variable is used in the same renderer module and ray tracing subsystem for shadows. It’s defined and used in the RayTracingShadows.cpp file.
The value of CVarRayTracingTransmissionRejectionSamplingTrials is set when the console variable is initialized, and it can be modified at runtime using console commands.
It interacts directly with the CommonPassParameters struct in the ray tracing shadow pass, where its value is retrieved and assigned to the RejectionSamplingTrials parameter.
Developers should be aware that changes to this variable will directly affect the ray tracing shadow calculations, potentially impacting both visual quality and performance.
Best practices for using CVarRayTracingTransmissionRejectionSamplingTrials are the same as those for r.RayTracing.Transmission.RejectionSamplingTrials, as they represent the same setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:75
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRayTracingTransmissionRejectionSamplingTrials(
TEXT("r.RayTracing.Transmission.RejectionSamplingTrials"),
0,
TEXT("Determines the number of rejection-sampling trials (default = 0)"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarRayTracingShadowsEnableHairVoxel(
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingTransmissionRejectionSamplingTrials
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:74
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarRayTracingTransmissionRejectionSamplingTrials(
TEXT("r.RayTracing.Transmission.RejectionSamplingTrials"),
0,
TEXT("Determines the number of rejection-sampling trials (default = 0)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:428
Scope: file
Source code excerpt:
CommonPassParameters->TransmissionSamplingTechnique = CVarRayTracingTransmissionSamplingTechnique.GetValueOnRenderThread();
CommonPassParameters->TransmissionMeanFreePathType = GetRayTracingTransmissionMeanFreePathType();
CommonPassParameters->RejectionSamplingTrials = CVarRayTracingTransmissionRejectionSamplingTrials.GetValueOnRenderThread();
CommonPassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);
if (bUseHairLighting)
{
const bool bUseHairVoxel = CVarRayTracingShadowsEnableHairVoxel.GetValueOnRenderThread() > 0;
CommonPassParameters->bUseHairVoxel = !bUseHairDeepShadow && bUseHairVoxel ? 1 : 0;