r.HeterogeneousVolumes.MaxTraceDistance
r.HeterogeneousVolumes.MaxTraceDistance
#Overview
name: r.HeterogeneousVolumes.MaxTraceDistance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The maximum trace view-distance for direct volume rendering (Default = 30000)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.MaxTraceDistance is to control the maximum trace view-distance for direct volume rendering in Unreal Engine’s heterogeneous volumes system. This setting is primarily used in the rendering system, specifically for volumetric effects.
This setting variable is relied upon by the Renderer module, particularly in the HeterogeneousVolumes subsystem. It’s defined and used within the HeterogeneousVolumes.cpp file, which is part of the Renderer’s private implementation.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 30000.0 units, but can be changed at runtime through console commands or project settings.
The associated variable CVarHeterogeneousVolumesMaxTraceDistance interacts directly with r.HeterogeneousVolumes.MaxTraceDistance. This C++ variable is used to access the value of the console variable within the engine’s code.
Developers must be aware that this variable affects the rendering performance and visual quality of volumetric effects. Setting it too high might impact performance, while setting it too low might result in visual artifacts or reduced quality of volumetric rendering.
Best practices when using this variable include:
- Adjusting it based on the scale and requirements of your specific scene.
- Testing different values to find the optimal balance between visual quality and performance.
- Considering the target hardware when setting this value, as it can have a significant impact on rendering time.
Regarding the associated variable CVarHeterogeneousVolumesMaxTraceDistance:
The purpose of CVarHeterogeneousVolumesMaxTraceDistance is to provide a programmatic interface to access and modify the r.HeterogeneousVolumes.MaxTraceDistance setting within the C++ code of the engine.
This variable is used within the Renderer module, specifically in the HeterogeneousVolumes namespace. It’s defined as a TAutoConsoleVariable, which is Unreal Engine’s way of creating console variables that can be easily accessed and modified.
The value of this variable is set initially when it’s defined, but it can be changed at runtime through console commands or through C++ code using the variable’s setter methods.
CVarHeterogeneousVolumesMaxTraceDistance interacts directly with the r.HeterogeneousVolumes.MaxTraceDistance console variable. It essentially serves as a C++ wrapper for the console variable.
Developers should be aware that this variable is marked as ECVF_RenderThreadSafe, meaning it’s safe to access from the render thread. This is important for maintaining thread safety in the rendering pipeline.
Best practices when using this variable include:
- Accessing its value using the GetValueOnRenderThread() method when in render thread context.
- Being cautious about modifying its value during runtime, as it can affect ongoing rendering processes.
- Using it in conjunction with other heterogeneous volumes settings for a cohesive volumetric rendering setup.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:86
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesMaxTraceDistance(
TEXT("r.HeterogeneousVolumes.MaxTraceDistance"),
30000.0,
TEXT("The maximum trace view-distance for direct volume rendering (Default = 30000)"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesMaxShadowTraceDistance(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesMaxTraceDistance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:85
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesMaxTraceDistance(
TEXT("r.HeterogeneousVolumes.MaxTraceDistance"),
30000.0,
TEXT("The maximum trace view-distance for direct volume rendering (Default = 30000)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:394
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function float GetMaxTraceDistance
Source code excerpt:
float GetMaxTraceDistance()
{
return CVarHeterogeneousVolumesMaxTraceDistance.GetValueOnRenderThread();
}
float GetMaxShadowTraceDistance()
{
return CVarHeterogeneousVolumesMaxShadowTraceDistance.GetValueOnRenderThread();
}