r.PathTracing.Substrate.UseSimplifiedMaterials
r.PathTracing.Substrate.UseSimplifiedMaterials
#Overview
name: r.PathTracing.Substrate.UseSimplifiedMaterials
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Instead of evaluating all layers, use an optimized material in which all slabs have been merged. This is mainly intended for debugging and requires r.PathTracing.Substrate.CompileSimplifiedMaterials to be true.\n0: off (default)\n1: on\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.Substrate.UseSimplifiedMaterials is to control the use of simplified materials in path tracing rendering within Unreal Engine 5. It is specifically related to the rendering system, particularly the path tracing subsystem.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the path tracing functionality. Based on the callsites, it’s clear that this variable is closely tied to the Substrate system, which is likely a part of UE5’s advanced material rendering pipeline.
The value of this variable is set through a console variable (CVarPathTracingSubstrateUseSimplifiedMaterial). It’s initialized with a default value of 0 (off) and can be changed at runtime.
This variable interacts closely with another console variable, CVarPathTracingSubstrateCompileSimplifiedMaterial. The use of simplified materials is only enabled when both variables are set to non-zero values.
Developers must be aware that:
- This setting is mainly intended for debugging purposes.
- It requires r.PathTracing.Substrate.CompileSimplifiedMaterials to be true to take effect.
- When enabled, it uses an optimized material where all slabs have been merged, instead of evaluating all layers.
Best practices when using this variable include:
- Only enable it for debugging or performance testing purposes.
- Always ensure r.PathTracing.Substrate.CompileSimplifiedMaterials is also enabled when using this feature.
- Be aware that using simplified materials may not accurately represent the final rendered output, as it’s an optimization technique.
Regarding the associated variable CVarPathTracingSubstrateUseSimplifiedMaterial:
This is the actual console variable that controls the r.PathTracing.Substrate.UseSimplifiedMaterials setting. It’s defined as an integer variable, where 0 means off (default) and 1 means on. It’s marked as render thread safe (ECVF_RenderThreadSafe), meaning it can be safely changed at runtime without causing rendering issues.
The variable is used in the path tracing mesh processing logic to determine whether to use simplified materials. It’s also used in the preparation of path tracing data to set specific flags in the rendering configuration.
Developers should be cautious when modifying this variable, as it can significantly impact the rendering output and performance. It should primarily be used for debugging and optimization purposes, not for final production 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:356
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingSubstrateUseSimplifiedMaterial(
TEXT("r.PathTracing.Substrate.UseSimplifiedMaterials"),
0,
TEXT("Instead of evaluating all layers, use an optimized material in which all slabs have been merged. This is mainly intended for debugging and requires r.PathTracing.Substrate.CompileSimplifiedMaterials to be true.\n")
TEXT("0: off (default)\n")
TEXT("1: on\n"),
ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingSubstrateUseSimplifiedMaterial
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:355
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarPathTracingSubstrateUseSimplifiedMaterial(
TEXT("r.PathTracing.Substrate.UseSimplifiedMaterials"),
0,
TEXT("Instead of evaluating all layers, use an optimized material in which all slabs have been merged. This is mainly intended for debugging and requires r.PathTracing.Substrate.CompileSimplifiedMaterials to be true.\n")
TEXT("0: off (default)\n")
TEXT("1: on\n"),
ECVF_RenderThreadSafe
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:1630
Scope (from outer to inner):
file
function bool FRayTracingMeshProcessor::ProcessPathTracing
Source code excerpt:
const bool bUseSimplifiedMaterial = Substrate::IsSubstrateEnabled() &&
CVarPathTracingSubstrateCompileSimplifiedMaterial.GetValueOnRenderThread() != 0 &&
CVarPathTracingSubstrateUseSimplifiedMaterial.GetValueOnRenderThread() != 0;
if (NeedsAnyHitShader(MaterialResource))
{
if (bUseSimplifiedMaterial)
{
if (bUseProceduralPrimitive)
ShaderTypes.AddShaderType<FPathTracingMaterialSimplifiedCHS_AHS_IS>();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:2503
Scope: file
Source code excerpt:
if (Substrate::IsSubstrateEnabled() && CVarPathTracingSubstrateCompileSimplifiedMaterial.GetValueOnRenderThread() != 0)
{
Config.LightShowFlags |= CVarPathTracingSubstrateUseSimplifiedMaterial.GetValueOnRenderThread() != 0 ? 1 << 14 : 0;
}
PreparePathTracingData(Scene, View, Config.PathTracingData);
Config.VisibleLights = CVarPathTracingVisibleLights.GetValueOnRenderThread() != 0;
Config.UseMISCompensation = Config.PathTracingData.MISMode == 2 && CVarPathTracingMISCompensation.GetValueOnRenderThread() != 0;