r.PathTracing.MeshDecalRoughnessCutoff
r.PathTracing.MeshDecalRoughnessCutoff
#Overview
name: r.PathTracing.MeshDecalRoughnessCutoff
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Do not evaluate mesh 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.MeshDecalRoughnessCutoff is to improve performance in path tracing by setting a roughness threshold beyond which mesh decals are not evaluated.
This setting variable is primarily used in the rendering system, specifically in the path tracing subsystem of Unreal Engine 5. It is part of the Renderer module, as evidenced by its location in the PathTracing.cpp file within the Renderer directory.
The value of this variable is set using a TAutoConsoleVariable, which allows it to be changed at runtime through the console. Its default value is 0.15f, as seen in the source code.
This variable interacts closely with other path tracing settings, particularly those related to decals. It works in conjunction with CVarPathTracingDecalRoughnessCutoff to determine whether decals should be evaluated based on the scene’s properties and the presence of ray tracing decals.
Developers should be aware that this setting can significantly impact performance and visual quality in path-traced scenes. Setting it too low might cause unnecessary performance overhead, while setting it too high might result in visual artifacts or missing decal details on rougher surfaces.
Best practices when using this variable include:
- Adjusting it based on the specific needs of the scene and the target performance.
- Testing different values to find the optimal balance between performance and visual quality.
- Considering the interaction with other decal-related settings in the path tracing system.
Regarding the associated variable CVarPathTracingMeshDecalRoughnessCutoff:
This is the actual console variable that stores the value of r.PathTracing.MeshDecalRoughnessCutoff. It is used to retrieve the current value of the setting at runtime, as seen in the PreparePathTracingData function.
The purpose of CVarPathTracingMeshDecalRoughnessCutoff is to provide a way to access and modify the mesh decal roughness cutoff value dynamically during runtime. It is used in the same rendering subsystem and module as r.PathTracing.MeshDecalRoughnessCutoff.
The value of this variable is set when the TAutoConsoleVariable is initialized, but it can be changed at runtime through console commands.
This variable interacts directly with the PathTracingData structure, specifically setting the MeshDecalRoughnessCutoff field based on certain conditions (presence of decals and ray tracing instances).
Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.
Best practices for using this variable include:
- Using it for runtime adjustments and debugging of path tracing performance.
- Considering its impact on both performance and visual quality when modifying its value.
- Being mindful of the conditions under which it is applied (presence of decals and ray tracing instances).
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:308
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarPathTracingMeshDecalRoughnessCutoff(
TEXT("r.PathTracing.MeshDecalRoughnessCutoff"),
0.15f,
TEXT("Do not evaluate mesh decals beyond this roughness level to improve performance (default=0.15)"),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<float> CVarPathTracingMeshDecalBias(
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingMeshDecalRoughnessCutoff
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:307
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<float> CVarPathTracingMeshDecalRoughnessCutoff(
TEXT("r.PathTracing.MeshDecalRoughnessCutoff"),
0.15f,
TEXT("Do not evaluate mesh decals beyond this roughness level to improve performance (default=0.15)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:675
Scope (from outer to inner):
file
function static void PreparePathTracingData
Source code excerpt:
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();
// NOTE: Diffuse and Specular show flags also modify the override colors, but we prefer to tie those to the lighting contribution mechanism below which is more principled
PathTracingData.ApplyDiffuseSpecularOverrides =