r.VolumetricFog.InjectShadowedLightsSeparately
r.VolumetricFog.InjectShadowedLightsSeparately
#Overview
name: r.VolumetricFog.InjectShadowedLightsSeparately
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to allow the volumetric fog feature.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricFog.InjectShadowedLightsSeparately is to control the injection of shadowed lights separately in volumetric fog rendering. This setting variable is part of the rendering system, specifically the volumetric fog feature in Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evident from the file path “Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp”.
The value of this variable is set through the console variable system. It’s initialized with a default value of 1 and can be modified at runtime using console commands.
This variable interacts with the associated variable GVolumetricFogInjectShadowedLightsSeparately. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the rendering performance and quality of volumetric fog, particularly when dealing with shadowed lights. Enabling this feature (set to 1) allows for more accurate shadowing in volumetric fog but may come at a performance cost.
Best practices when using this variable include:
- Consider the performance impact when enabling this feature, especially on lower-end hardware.
- Test the visual difference and performance impact with this feature enabled and disabled to determine the best setting for your project.
- Be mindful of the interaction with other lighting and shadowing settings in your project.
Regarding the associated variable GVolumetricFogInjectShadowedLightsSeparately:
The purpose of GVolumetricFogInjectShadowedLightsSeparately is to serve as the internal representation of the r.VolumetricFog.InjectShadowedLightsSeparately console variable within the engine’s C++ code.
This variable is used directly in the rendering code, specifically in the function LightNeedsSeparateInjectionIntoVolumetricFogForOpaqueShadow. It determines whether certain types of lights (point, spot, or rect) that cast dynamic and volumetric shadows should be injected separately into the volumetric fog.
The value of this variable is set through the console variable system, initialized to 1 by default.
Developers should be aware that this variable directly affects the rendering pipeline’s decision-making process for light injection in volumetric fog. Changes to this variable will impact both visual quality and performance.
Best practices for using this variable include:
- Use it in conjunction with other volumetric fog and lighting settings for optimal results.
- Profile your game’s performance with different values to find the right balance between visual quality and performance.
- Consider exposing this setting to end-users as a graphics option if the visual/performance trade-off is significant in your game.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:41
Scope: file
Source code excerpt:
int32 GVolumetricFogInjectShadowedLightsSeparately = 1;
FAutoConsoleVariableRef CVarVolumetricFogInjectShadowedLightsSeparately(
TEXT("r.VolumetricFog.InjectShadowedLightsSeparately"),
GVolumetricFogInjectShadowedLightsSeparately,
TEXT("Whether to allow the volumetric fog feature."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GVolumetricFogDepthDistributionScale = 32.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GVolumetricFogInjectShadowedLightsSeparately
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:39
Scope: file
Source code excerpt:
);
int32 GVolumetricFogInjectShadowedLightsSeparately = 1;
FAutoConsoleVariableRef CVarVolumetricFogInjectShadowedLightsSeparately(
TEXT("r.VolumetricFog.InjectShadowedLightsSeparately"),
GVolumetricFogInjectShadowedLightsSeparately,
TEXT("Whether to allow the volumetric fog feature."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GVolumetricFogDepthDistributionScale = 32.0f;
FAutoConsoleVariableRef CVarVolumetricFogDepthDistributionScale(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:571
Scope (from outer to inner):
file
function bool LightNeedsSeparateInjectionIntoVolumetricFogForOpaqueShadow
Source code excerpt:
const FLightSceneProxy* LightProxy = LightSceneInfo->Proxy;
if (GVolumetricFogInjectShadowedLightsSeparately
&& (LightProxy->GetLightType() == LightType_Point || LightProxy->GetLightType() == LightType_Spot || LightProxy->GetLightType() == LightType_Rect)
&& !LightProxy->HasStaticLighting()
&& LightProxy->CastsDynamicShadow()
&& LightProxy->CastsVolumetricShadow())
{
const FStaticShadowDepthMap* StaticShadowDepthMap = LightProxy->GetStaticShadowDepthMap();