r.PathTracing.AtmosphereOpticalDepthLUTResolution
r.PathTracing.AtmosphereOpticalDepthLUTResolution
#Overview
name: r.PathTracing.AtmosphereOpticalDepthLUTResolution
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Size of the square lookup texture used for transmittance calculations by the path tracer in reference atmosphere mode. (default = 512)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.AtmosphereOpticalDepthLUTResolution is to control the size of the square lookup texture used for transmittance calculations in the path tracing system when using the reference atmosphere mode.
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 PathTracing.cpp file, which is part of the Renderer module.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 512, but can be changed at runtime through console commands or programmatically.
The associated variable CVarPathTracingAtmosphereOpticalDepthLutResolution directly interacts with r.PathTracing.AtmosphereOpticalDepthLUTResolution. They share the same value and purpose.
Developers should be aware that this variable affects the quality and performance of atmosphere rendering in path tracing. A higher resolution will provide more accurate atmospheric effects but may impact performance.
Best practices when using this variable include:
- Balancing quality and performance based on the project’s needs.
- Testing different resolutions to find the optimal value for your specific scene.
- Considering the target hardware when setting this value, as higher resolutions may be more demanding on less powerful systems.
Regarding the associated variable CVarPathTracingAtmosphereOpticalDepthLutResolution:
This is the actual C++ variable that stores and manages the r.PathTracing.AtmosphereOpticalDepthLUTResolution setting. It’s defined as a TAutoConsoleVariable, which is part of Unreal Engine’s console variable system.
The variable is used in the FAtmosphereConfig struct, where its value is retrieved on the render thread. This suggests that the resolution can be changed dynamically, and the path tracing system will update accordingly.
Developers should note that this variable is marked as ECVF_RenderThreadSafe, meaning it’s safe to modify from the render thread. However, changes to this variable may require regeneration of the lookup texture, which could cause a brief performance hitch if changed frequently.
When working with this variable, developers should:
- Use the appropriate methods to get and set its value, respecting the render thread safety.
- Consider caching the value if used frequently to avoid repeated calls to GetValueOnRenderThread().
- Be aware of the performance implications when changing this value, especially in real-time applications.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:193
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingAtmosphereOpticalDepthLutResolution(
TEXT("r.PathTracing.AtmosphereOpticalDepthLUTResolution"),
512,
TEXT("Size of the square lookup texture used for transmittance calculations by the path tracer in reference atmosphere mode. (default = 512)"),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<int32> CVarPathTracingAtmosphereOpticalDepthLutNumSamples(
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingAtmosphereOpticalDepthLutResolution
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:192
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarPathTracingAtmosphereOpticalDepthLutResolution(
TEXT("r.PathTracing.AtmosphereOpticalDepthLUTResolution"),
512,
TEXT("Size of the square lookup texture used for transmittance calculations by the path tracer in reference atmosphere mode. (default = 512)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:521
Scope (from outer to inner):
file
function FAtmosphereConfig
Source code excerpt:
AtmoParameters(Parameters),
NumSamples(CVarPathTracingAtmosphereOpticalDepthLutNumSamples.GetValueOnRenderThread()),
Resolution(CVarPathTracingAtmosphereOpticalDepthLutResolution.GetValueOnRenderThread()) {}
bool IsDifferent(const FAtmosphereConfig& Other) const
{
// Compare only those parameters which impact the LUT construction
return
AtmoParameters.BottomRadiusKm != Other.AtmoParameters.BottomRadiusKm ||