r.PathTracing.VolumeMISMode
r.PathTracing.VolumeMISMode
#Overview
name: r.PathTracing.VolumeMISMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Selects the sampling technique for volumetric integration of local lighting (default = 1)\n0: Density sampling\n1: Light sampling (default)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.VolumeMISMode is to control the sampling technique used for volumetric integration of local lighting in path tracing.
This setting variable is primarily used by the rendering system, specifically the path tracing subsystem within Unreal Engine 5. It is part of the Renderer module, as evidenced by its location in the PathTracing.cpp file within the Runtime/Renderer directory.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, which corresponds to light sampling. The variable allows two possible values: 0: Density sampling 1: Light sampling (default)
The associated variable CVarPathTracingVolumeMISMode interacts directly with r.PathTracing.VolumeMISMode. They share the same value and purpose.
Developers must be aware that this variable affects the performance and quality of volumetric lighting in path-traced scenes. Changing this value can impact both rendering speed and the visual appearance of volumetric effects.
Best practices when using this variable include:
- Understanding the trade-offs between density sampling and light sampling for your specific scene.
- Testing both modes to determine which provides the best balance of quality and performance for your project.
- Considering the complexity of your volumetric lighting setup when choosing between the two modes.
Regarding the associated variable CVarPathTracingVolumeMISMode:
- Its purpose is identical to r.PathTracing.VolumeMISMode, serving as the internal representation of the console variable.
- It is used within the Renderer module, specifically in the path tracing implementation.
- Its value is set through the console variable system and can be accessed at runtime using GetValueOnRenderThread().
- It directly interacts with the PathTracingData structure, specifically setting the VolumeMISMode field.
- Developers should be aware that changes to this variable will take effect on the render thread, which is important for thread safety and performance considerations.
- Best practices include using the GetValueOnRenderThread() method when accessing this variable in render thread code to ensure thread-safe access to the current value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:108
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingVolumeMISMode(
TEXT("r.PathTracing.VolumeMISMode"),
1,
TEXT("Selects the sampling technique for volumetric integration of local lighting (default = 1)\n")
TEXT("0: Density sampling\n")
TEXT("1: Light sampling (default)\n"),
ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingVolumeMISMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:107
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarPathTracingVolumeMISMode(
TEXT("r.PathTracing.VolumeMISMode"),
1,
TEXT("Selects the sampling technique for volumetric integration of local lighting (default = 1)\n")
TEXT("0: Density sampling\n")
TEXT("1: Light sampling (default)\n"),
ECVF_RenderThreadSafe
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:627
Scope (from outer to inner):
file
function static void PreparePathTracingData
Source code excerpt:
PathTracingData.MaxNormalBias = GetRaytracingMaxNormalBias();
PathTracingData.MISMode = CVarPathTracingMISMode.GetValueOnRenderThread();
PathTracingData.VolumeMISMode = CVarPathTracingVolumeMISMode.GetValueOnRenderThread();
PathTracingData.MaxPathIntensity = CVarPathTracingMaxPathIntensity.GetValueOnRenderThread();
if (PathTracingData.MaxPathIntensity <= 0)
{
// cvar clamp disabled, use PPV exposure value instad
PathTracingData.MaxPathIntensity = FMath::Pow(2.0f, PPV.PathTracingMaxPathExposure);
}