r.RayTracing.SkyLight.EnableTwoSidedGeometry

r.RayTracing.SkyLight.EnableTwoSidedGeometry

#Overview

name: r.RayTracing.SkyLight.EnableTwoSidedGeometry

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.SkyLight.EnableTwoSidedGeometry is to control whether two-sided geometry is enabled when tracing shadow rays in the ray-traced skylight rendering system.

This setting variable is primarily used in the Unreal Engine’s rendering system, specifically in the ray tracing subsystem for skylight calculations. It is part of the ray tracing module within the renderer.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, meaning two-sided geometry is enabled by default.

The associated variable CVarRayTracingSkyLightEnableTwoSidedGeometry directly interacts with r.RayTracing.SkyLight.EnableTwoSidedGeometry. They share the same value and purpose.

Developers must be aware that this variable affects the rendering of shadows in ray-traced skylights. Enabling two-sided geometry can potentially impact performance but may improve shadow quality in certain scenarios.

Best practices when using this variable include:

  1. Consider the performance implications of enabling two-sided geometry.
  2. Test the visual impact in various lighting conditions and scenes.
  3. Use it in conjunction with other ray tracing settings for optimal results.

Regarding the associated variable CVarRayTracingSkyLightEnableTwoSidedGeometry:

Its purpose is to provide programmatic access to the r.RayTracing.SkyLight.EnableTwoSidedGeometry setting within the C++ code.

This variable is used in the renderer module, specifically in the ray tracing skylight rendering system.

Its value is set through the CVar system and can be accessed on the render thread using GetValueOnRenderThread().

It directly interacts with the r.RayTracing.SkyLight.EnableTwoSidedGeometry console variable.

Developers should be aware that this variable is used to set a permutation domain for the ray generation shader, which affects how the skylight is rendered.

Best practices include:

  1. Access this variable on the render thread when needed.
  2. Consider caching its value if used frequently to avoid repeated calls to GetValueOnRenderThread().
  3. Be aware of its impact on shader permutations and potential compile times.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RaytracingSkylight.cpp:78

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRayTracingSkyLightEnableTwoSidedGeometry(
	TEXT("r.RayTracing.SkyLight.EnableTwoSidedGeometry"),
	1,
	TEXT("Enables two-sided geometry when tracing shadow rays (default = 1)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarRayTracingSkyLightEnableMaterials(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RaytracingSkylight.cpp:77

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarRayTracingSkyLightEnableTwoSidedGeometry(
	TEXT("r.RayTracing.SkyLight.EnableTwoSidedGeometry"),
	1,
	TEXT("Enables two-sided geometry when tracing shadow rays (default = 1)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RaytracingSkylight.cpp:460

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderRayTracingSkyLight

Source code excerpt:


		FRayTracingSkyLightRGS::FPermutationDomain PermutationVector;
		PermutationVector.Set<FRayTracingSkyLightRGS::FEnableTwoSidedGeometryDim>(CVarRayTracingSkyLightEnableTwoSidedGeometry.GetValueOnRenderThread() != 0);
		PermutationVector.Set<FRayTracingSkyLightRGS::FEnableMaterialsDim>(CVarRayTracingSkyLightEnableMaterials.GetValueOnRenderThread() != 0);
		PermutationVector.Set<FRayTracingSkyLightRGS::FDecoupleSampleGeneration>(CVarRayTracingSkyLightDecoupleSampleGeneration.GetValueOnRenderThread() != 0);
		PermutationVector.Set<FRayTracingSkyLightRGS::FHairLighting>(bUseHairLighting ? 1 : 0);
		TShaderMapRef<FRayTracingSkyLightRGS> RayGenerationShader(GetGlobalShaderMap(FeatureLevel), PermutationVector);
		ClearUnusedGraphResources(RayGenerationShader, PassParameters);