r.RayTracing.Transmission.TransmissionSamplingDistanceCulling

r.RayTracing.Transmission.TransmissionSamplingDistanceCulling

#Overview

name: r.RayTracing.Transmission.TransmissionSamplingDistanceCulling

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RayTracing.Transmission.TransmissionSamplingDistanceCulling is to enable visibility testing for culling transmission sampling distance in ray tracing. This setting is part of Unreal Engine 5’s ray tracing system, specifically related to transmission effects in rendering.

This setting variable is primarily used in the rendering subsystem of Unreal Engine 5, particularly in the ray tracing module. Based on the callsites, it’s evident that this variable is utilized in the RayTracingShadows.cpp file, which is part of the Renderer module.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning the feature is enabled by default. Developers can modify this value at runtime using console commands or through project settings.

The associated variable CVarRayTracingTransmissionSamplingDistanceCulling directly interacts with this setting. It’s used to retrieve the current value of the setting in the render thread.

Developers should be aware that this variable affects the performance and quality of ray-traced transmission effects. Enabling this feature (value set to 1) may improve performance by reducing unnecessary sampling, but it might also affect the visual quality of transmission effects in certain scenarios.

Best practices when using this variable include:

  1. Testing the visual impact of enabling/disabling this feature in different lighting scenarios.
  2. Considering the performance implications, especially in scenes with complex transmission effects.
  3. Potentially exposing this setting to end-users for performance tuning, if appropriate for the project.

Regarding the associated variable CVarRayTracingTransmissionSamplingDistanceCulling:

The purpose of this variable is to provide a programmatic way to access and modify the r.RayTracing.Transmission.TransmissionSamplingDistanceCulling setting within the engine’s C++ code.

This variable is used in the rendering subsystem, specifically in the ray tracing shadow calculations. It’s accessed in the render thread to determine whether transmission sampling distance culling should be applied.

The value of this variable is set automatically based on the console variable it’s associated with. It reflects the current state of the r.RayTracing.Transmission.TransmissionSamplingDistanceCulling setting.

This variable interacts directly with the ray tracing shadow pass parameters, influencing how transmission effects are calculated.

Developers should be aware that this variable is accessed in the render thread, so any modifications should be thread-safe and follow Unreal Engine’s multi-threading best practices.

Best practices for using this variable include:

  1. Using GetValueOnRenderThread() when accessing it in render thread code.
  2. Avoiding frequent changes to this value, as it may impact rendering consistency.
  3. Considering caching the value if used frequently in performance-critical sections of code.

#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:52

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRayTracingTransmissionSamplingDistanceCulling(
	TEXT("r.RayTracing.Transmission.TransmissionSamplingDistanceCulling"),
	1,
	TEXT("Enables visibility testing to cull transmission sampling distance (default = 1)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarRayTracingTransmissionSamplingTechnique(

#Associated Variable and Callsites

This variable is associated with another variable named CVarRayTracingTransmissionSamplingDistanceCulling. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:51

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarRayTracingTransmissionSamplingDistanceCulling(
	TEXT("r.RayTracing.Transmission.TransmissionSamplingDistanceCulling"),
	1,
	TEXT("Enables visibility testing to cull transmission sampling distance (default = 1)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:425

Scope: file

Source code excerpt:

		CommonPassParameters->LightScissor = ScissorRect;
		CommonPassParameters->PixelOffset = PixelOffset;
		CommonPassParameters->bTransmissionSamplingDistanceCulling = CVarRayTracingTransmissionSamplingDistanceCulling.GetValueOnRenderThread();
		CommonPassParameters->TransmissionSamplingTechnique = CVarRayTracingTransmissionSamplingTechnique.GetValueOnRenderThread();
		CommonPassParameters->TransmissionMeanFreePathType = GetRayTracingTransmissionMeanFreePathType();
		CommonPassParameters->RejectionSamplingTrials = CVarRayTracingTransmissionRejectionSamplingTrials.GetValueOnRenderThread();
		CommonPassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);

		if (bUseHairLighting)