r.RayTracing.Shadows.MaxTranslucencyHitCount

r.RayTracing.Shadows.MaxTranslucencyHitCount

#Overview

name: r.RayTracing.Shadows.MaxTranslucencyHitCount

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.Shadows.MaxTranslucencyHitCount is to control the number of intersections evaluated for translucent shadow testing in ray-traced shadows. This setting variable is part of Unreal Engine 5’s ray tracing system, specifically for shadow rendering.

This setting variable is primarily used by the Renderer module, particularly in the ray tracing subsystem for shadows. It’s referenced in the RayTracingShadows.cpp file, which is part of the ray-traced shadow implementation.

The value of this variable is set through a console variable (CVarRayTracingShadowsMaxTranslucencyHitCount) using the TAutoConsoleVariable template. It can be modified at runtime through console commands or programmatically.

The associated variable CVarRayTracingShadowsMaxTranslucencyHitCount directly interacts with r.RayTracing.Shadows.MaxTranslucencyHitCount. They share the same value and purpose.

Developers must be aware that:

  1. The default value is -1, which evaluates all intersections.
  2. Setting it to 0 disables translucent shadow testing.
  3. Values greater than 0 limit the number of intersections evaluated.

Best practices when using this variable include:

  1. Use -1 for the highest quality shadows, but be aware of potential performance impact.
  2. Use 0 to disable translucent shadows if they’re not needed or for performance optimization.
  3. Experiment with values >0 to find a balance between shadow quality and performance.
  4. Consider the scene complexity and the importance of accurate translucent shadows when adjusting this value.

Regarding the associated variable CVarRayTracingShadowsMaxTranslucencyHitCount:

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

Scope: file

Source code excerpt:

);
static TAutoConsoleVariable<int32> CVarRayTracingShadowsMaxTranslucencyHitCount(
	TEXT("r.RayTracing.Shadows.MaxTranslucencyHitCount"),
	-1,
	TEXT("-1: Evaluate all intersections (default).")
	TEXT(" 0: Disable translucent shadow testing.")
	TEXT(">0: Limit the number of intersections."),
	ECVF_RenderThreadSafe
);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarRayTracingShadowsMaxTranslucencyHitCount(
	TEXT("r.RayTracing.Shadows.MaxTranslucencyHitCount"),
	-1,
	TEXT("-1: Evaluate all intersections (default).")
	TEXT(" 0: Disable translucent shadow testing.")
	TEXT(">0: Limit the number of intersections."),
	ECVF_RenderThreadSafe

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

Scope (from outer to inner):

file
function     int32 GetRayTracingShadowsMaxTranslucencyHitCount

Source code excerpt:

int32 GetRayTracingShadowsMaxTranslucencyHitCount()
{
	return CVarRayTracingShadowsMaxTranslucencyHitCount.GetValueOnRenderThread();
}

bool EnableRayTracingShadowTwoSidedGeometry()
{
	return CVarRayTracingShadowsEnableTwoSidedGeometry.GetValueOnRenderThread() != 0;
}