r.PathTracing.DecalRoughnessCutoff
r.PathTracing.DecalRoughnessCutoff
#Overview
name: r.PathTracing.DecalRoughnessCutoff
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Do not evaluate decals beyond this roughness level to improve performance (default=0.15)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.DecalRoughnessCutoff is to optimize performance in path tracing by limiting the evaluation of decals based on a roughness threshold.
This setting variable is primarily used in the rendering system, specifically within the path tracing subsystem of Unreal Engine 5. It is referenced in the Renderer module, as evidenced by its location in the PathTracing.cpp file.
The value of this variable is set using a TAutoConsoleVariable, which allows it to be modified at runtime through console commands. The default value is 0.15f, as seen in the source code.
This variable interacts closely with other path tracing and decal-related variables, such as CVarPathTracingMeshDecalRoughnessCutoff and CVarPathTracingUseDBuffer. It’s used in conjunction with these variables to determine how decals are evaluated during path tracing.
Developers should be aware that this variable affects performance and visual quality. Setting a higher value will improve performance by skipping decal evaluation on rougher surfaces, but may result in less accurate rendering of decals on those surfaces.
Best practices when using this variable include:
- Adjusting it based on the specific needs of the scene and performance requirements.
- Testing different values to find the optimal balance between performance and visual quality.
- Considering the types of decals and materials used in the scene when setting this value.
The associated variable CVarPathTracingDecalRoughnessCutoff is the actual console variable that stores and manages the r.PathTracing.DecalRoughnessCutoff value. It’s defined as a TAutoConsoleVariable, which allows for runtime modification.
This associated variable is used in the PreparePathTracingData function to set the DecalRoughnessCutoff field of the PathTracingData structure. It’s only applied when decals are being used in the scene and ray tracing decals are enabled for the view.
Developers should be aware that changes to this console variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag. This means that changes may not be immediately visible and could require a frame or two to take effect.
When working with this variable, it’s important to consider its interaction with other decal and path tracing settings to achieve the desired balance between performance and visual quality in the path-traced rendering.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:301
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarPathTracingDecalRoughnessCutoff(
TEXT("r.PathTracing.DecalRoughnessCutoff"),
0.15f,
TEXT("Do not evaluate decals beyond this roughness level to improve performance (default=0.15)"),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<float> CVarPathTracingMeshDecalRoughnessCutoff(
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingDecalRoughnessCutoff
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:300
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<float> CVarPathTracingDecalRoughnessCutoff(
TEXT("r.PathTracing.DecalRoughnessCutoff"),
0.15f,
TEXT("Do not evaluate decals beyond this roughness level to improve performance (default=0.15)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:673
Scope (from outer to inner):
file
function static void PreparePathTracingData
Source code excerpt:
PathTracingData.EnableDBuffer = CVarPathTracingUseDBuffer.GetValueOnRenderThread();
PathTracingData.DecalRoughnessCutoff = PathTracing::UsesDecals(*View.Family) && View.bHasRayTracingDecals ? CVarPathTracingDecalRoughnessCutoff.GetValueOnRenderThread() : -1.0f;
PathTracingData.MeshDecalRoughnessCutoff = PathTracing::UsesDecals(*View.Family) && Scene->RayTracingScene.GetRHIRayTracingScene()->GetInitializer().NumNativeInstancesPerLayer[(uint32)ERayTracingSceneLayer::Decals] > 0 ? CVarPathTracingMeshDecalRoughnessCutoff.GetValueOnRenderThread() : -1.0f;
PathTracingData.MeshDecalBias = CVarPathTracingMeshDecalBias.GetValueOnRenderThread();
PathTracingData.MaxRaymarchSteps = CVarPathTracingMaxRaymarchSteps.GetValueOnRenderThread();