r.TranslucencyLightingVolumeOuterDistance
r.TranslucencyLightingVolumeOuterDistance
#Overview
name: r.TranslucencyLightingVolumeOuterDistance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Distance from the camera that the second volume cascade should end
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TranslucencyLightingVolumeOuterDistance is to control the distance from the camera at which the second volume cascade of the translucency lighting volume should end. This setting is primarily used in the rendering system, specifically for managing translucent lighting effects.
This setting variable is relied upon by the Unreal Engine’s renderer subsystem, particularly in the translucency lighting and Lumen modules. It’s used in the following files:
- TranslucentLighting.cpp
- LumenTranslucencyVolumeLighting.cpp
The value of this variable is set through a console variable (CVar) system, which allows for runtime modification. It’s initialized with a default value of 5000.0f units.
The associated variable CVarTranslucencyLightingVolumeOuterDistance interacts directly with r.TranslucencyLightingVolumeOuterDistance, as they share the same value. This CVar is used to retrieve the current value of the setting in the render thread.
Developers must be aware that:
- This variable affects the range of translucency lighting effects, which can impact both visual quality and performance.
- It’s used in conjunction with CVarTranslucencyLightingVolumeInnerDistance to define the bounds of translucency lighting volumes.
- The value is used in calculations for Lumen’s translucency volume lighting, affecting the end distance from the camera for certain lighting calculations.
Best practices when using this variable include:
- Carefully balancing the value to achieve the desired visual quality without unnecessarily extending the lighting volume and impacting performance.
- Consider the relationship between this value and other related settings, such as CVarTranslucencyLightingVolumeInnerDistance and LumenSceneViewDistance.
- Use the console variable system to experiment with different values during development and fine-tune the setting for optimal results.
Regarding the associated variable CVarTranslucencyLightingVolumeOuterDistance:
- Its purpose is to provide a thread-safe way to access and modify the r.TranslucencyLightingVolumeOuterDistance value.
- It’s used within the renderer subsystem to retrieve the current value of the setting.
- The value is typically set through the console variable system, allowing for runtime modifications.
- It interacts directly with r.TranslucencyLightingVolumeOuterDistance, as they represent the same setting.
- Developers should be aware that this variable is accessed in the render thread, so any modifications should be done with thread safety in mind.
- Best practices include using the appropriate getter methods (GetValueOnRenderThread()) when accessing the value to ensure thread safety.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentLighting.cpp:109
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarTranslucencyLightingVolumeOuterDistance(
TEXT("r.TranslucencyLightingVolumeOuterDistance"),
5000.0f,
TEXT("Distance from the camera that the second volume cascade should end"),
ECVF_RenderThreadSafe | ECVF_Scalability);
/** Function returning current translucency lighting volume dimensions. */
int32 GetTranslucencyLightingVolumeDim()
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:254
Scope (from outer to inner):
file
namespace LumenTranslucencyVolume
function float GetEndDistanceFromCamera
Source code excerpt:
float GetEndDistanceFromCamera(const FViewInfo& View)
{
// Ideally we'd use LumenSceneViewDistance directly, but direct shadowing via translucency lighting volume only covers 5000.0f units by default (r.TranslucencyLightingVolumeOuterDistance),
// so there isn't much point covering beyond that.
const float ViewDistanceScale = FMath::Clamp(View.FinalPostProcessSettings.LumenSceneViewDistance / 20000.0f, .1f, 100.0f);
return FMath::Clamp<float>(GTranslucencyGridEndDistanceFromCamera * ViewDistanceScale, 1.0f, 100000.0f);
}
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarTranslucencyLightingVolumeOuterDistance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentLighting.cpp:108
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarTranslucencyLightingVolumeOuterDistance(
TEXT("r.TranslucencyLightingVolumeOuterDistance"),
5000.0f,
TEXT("Distance from the camera that the second volume cascade should end"),
ECVF_RenderThreadSafe | ECVF_Scalability);
/** Function returning current translucency lighting volume dimensions. */
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentLighting.cpp:126
Scope (from outer to inner):
file
function void FViewInfo::CalcTranslucencyLightingVolumeBounds
Source code excerpt:
{
double InnerDistance = CVarTranslucencyLightingVolumeInnerDistance.GetValueOnRenderThread();
double OuterDistance = CVarTranslucencyLightingVolumeOuterDistance.GetValueOnRenderThread();
const double FrustumStartDistance = CascadeIndex == 0 ? 0 : InnerDistance;
const double FrustumEndDistance = CascadeIndex == 0 ? InnerDistance : OuterDistance;
double FieldOfView = DOUBLE_PI / 4.0;
double AspectRatio = 1.0;