r.RayTracing.SkyLight.ScreenPercentage

r.RayTracing.SkyLight.ScreenPercentage

#Overview

name: r.RayTracing.SkyLight.ScreenPercentage

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.ScreenPercentage is to control the screen percentage at which sky occlusion is evaluated in ray-traced sky lighting. This setting variable is part of Unreal Engine 5’s ray tracing system, specifically for sky lighting calculations.

This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the ray tracing subsystem for sky lighting. It’s referenced in the RaytracingSkylight.cpp file, which is responsible for implementing ray-traced sky lighting features.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 100.0f, representing 100% of the screen resolution. The value can be changed at runtime through console commands or programming interfaces.

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

Developers should be aware that this variable affects the performance and quality trade-off in ray-traced sky lighting. A lower percentage will result in faster rendering but potentially lower quality, while a higher percentage will increase quality at the cost of performance.

Best practices when using this variable include:

  1. Adjusting it based on the target hardware capabilities and performance requirements.
  2. Testing different values to find the optimal balance between visual quality and performance for your specific scene.
  3. Considering dynamic adjustment of this value based on the current scene complexity or performance metrics.

Regarding the associated variable CVarRayTracingSkyLightScreenPercentage:

The purpose of CVarRayTracingSkyLightScreenPercentage is the same as r.RayTracing.SkyLight.ScreenPercentage. It’s the actual console variable implementation that controls the screen percentage for ray-traced sky lighting evaluation.

This variable is used in the Renderer module, specifically in the ray tracing subsystem for sky lighting. It’s defined and used in the RaytracingSkylight.cpp file.

The value of CVarRayTracingSkyLightScreenPercentage is set when the console variable is created, with a default value of 100.0f. It can be modified at runtime through console commands or programmatically.

This variable directly interacts with the r.RayTracing.SkyLight.ScreenPercentage setting, as they represent the same concept and share the same value.

Developers should be aware that changes to this variable will immediately affect the ray-traced sky lighting calculations. It’s used to calculate the resolution fraction for rendering, which directly impacts performance and quality.

Best practices for using CVarRayTracingSkyLightScreenPercentage include:

  1. Using it for fine-tuning performance in ray-traced sky lighting scenarios.
  2. Monitoring its impact on both visual quality and rendering performance when adjusting its value.
  3. Considering exposing it as a user-adjustable setting in graphics options for players with varying hardware capabilities.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarRayTracingSkyLightScreenPercentage(
	TEXT("r.RayTracing.SkyLight.ScreenPercentage"),
	100.0f,
	TEXT("Screen percentage at which to evaluate sky occlusion"),
	ECVF_RenderThreadSafe
);

int32 GetRayTracingSkyLightDecoupleSampleGenerationCVarValue()

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarRayTracingSkyLightScreenPercentage(
	TEXT("r.RayTracing.SkyLight.ScreenPercentage"),
	100.0f,
	TEXT("Screen percentage at which to evaluate sky occlusion"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderRayTracingSkyLight

Source code excerpt:

	if (GRayTracingSkyLightDenoiser != 0)
	{
		ResolutionFraction = FMath::Clamp(CVarRayTracingSkyLightScreenPercentage.GetValueOnRenderThread() / 100.0f, 0.25f, 1.0f);
	}

	int32 UpscaleFactor = int32(1.0 / ResolutionFraction);
	ResolutionFraction = 1.0f / UpscaleFactor;