r.VolumetricFog.LightFunction.DirectionalLightSupersampleScale
r.VolumetricFog.LightFunction.DirectionalLightSupersampleScale
#Overview
name: r.VolumetricFog.LightFunction.DirectionalLightSupersampleScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Scales the slice depth distribution.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricFog.LightFunction.DirectionalLightSupersampleScale is to control the scaling of the slice depth distribution in volumetric fog rendering for directional lights with light functions.
This setting variable is primarily used by the rendering system, specifically the volumetric fog rendering module in Unreal Engine 5. It is part of the renderer subsystem and is utilized in the volumetric fog light function calculations.
The value of this variable is set through the console variable system in Unreal Engine. It is initialized with a default value of 2.0f and can be modified at runtime using console commands or through project settings.
The variable interacts directly with its associated C++ variable GVolumetricFogLightFunctionDirectionalLightSupersampleScale. They share the same value, and changes to one will affect the other.
Developers must be aware that this variable affects the resolution and quality of light function rendering for directional lights in volumetric fog. A higher value will increase the resolution and potentially the visual quality, but at the cost of increased performance overhead.
Best practices when using this variable include:
- Adjusting it based on the specific needs of the project, balancing visual quality and performance.
- Testing different values to find the optimal setting for your scene.
- Considering lower values for performance-critical scenarios or on lower-end hardware.
Regarding the associated variable GVolumetricFogLightFunctionDirectionalLightSupersampleScale:
This is the actual C++ variable that stores the value set by the console variable. It is used directly in the volumetric fog light function calculations, specifically to determine the resolution of the light function texture for directional lights.
The variable is used to scale the estimated volume resolution, which in turn determines the light function resolution. This scaling allows for finer control over the quality of the light function rendering in volumetric fog.
Developers should be aware that modifying this variable directly in code will have the same effect as changing the console variable. However, it’s generally recommended to use the console variable system for runtime adjustments, as it provides better flexibility and doesn’t require code changes.
Best practices for using GVolumetricFogLightFunctionDirectionalLightSupersampleScale include:
- Avoiding direct modification in code unless absolutely necessary.
- Using it in conjunction with other volumetric fog settings for a cohesive rendering approach.
- Profiling its impact on performance, especially when used with high values in complex scenes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFogLightFunction.cpp:16
Scope: file
Source code excerpt:
float GVolumetricFogLightFunctionDirectionalLightSupersampleScale = 2.0f;
FAutoConsoleVariableRef CVarVolumetricFogLightFunctionSupersampleScale(
TEXT("r.VolumetricFog.LightFunction.DirectionalLightSupersampleScale"),
GVolumetricFogLightFunctionDirectionalLightSupersampleScale,
TEXT("Scales the slice depth distribution."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
extern int GVolumetricFogLightFunction;
#Associated Variable and Callsites
This variable is associated with another variable named GVolumetricFogLightFunctionDirectionalLightSupersampleScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFogLightFunction.cpp:14
Scope: file
Source code excerpt:
#include "ShadowRendering.h"
float GVolumetricFogLightFunctionDirectionalLightSupersampleScale = 2.0f;
FAutoConsoleVariableRef CVarVolumetricFogLightFunctionSupersampleScale(
TEXT("r.VolumetricFog.LightFunction.DirectionalLightSupersampleScale"),
GVolumetricFogLightFunctionDirectionalLightSupersampleScale,
TEXT("Scales the slice depth distribution."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
extern int GVolumetricFogLightFunction;
static bool inline LocalLightLighFunctionsEnabled()
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFogLightFunction.cpp:173
Scope: file
Source code excerpt:
AxisWeights.Z = FMath::Abs(LightDirection | ViewForward) * VolumetricFogGridSize.Z;
const float VolumeResolutionEstimate = FMath::Max(AxisWeights.X, FMath::Max(AxisWeights.Y, AxisWeights.Z)) * GVolumetricFogLightFunctionDirectionalLightSupersampleScale;
LightFunctionResolution = FIntPoint(FMath::TruncToInt(VolumeResolutionEstimate), FMath::TruncToInt(VolumeResolutionEstimate));
// Snap the resolution to allow render target pool hits most of the time
const int32 ResolutionSnapFactor = 32;
LightFunctionResolution.X = FMath::DivideAndRoundUp(LightFunctionResolution.X, ResolutionSnapFactor) * ResolutionSnapFactor;
LightFunctionResolution.Y = FMath::DivideAndRoundUp(LightFunctionResolution.Y, ResolutionSnapFactor) * ResolutionSnapFactor;