r.VolumetricFog.RectLightTexture
r.VolumetricFog.RectLightTexture
#Overview
name: r.VolumetricFog.RectLightTexture
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to allow the volumetric fog to use rect light source texture.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricFog.RectLightTexture is to control whether volumetric fog in Unreal Engine 5 is allowed to use rectangular light source textures. This setting is part of the rendering system, specifically the volumetric fog rendering subsystem.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, as evidenced by its references in the VolumetricFog.cpp file within the Runtime/Renderer/Private directory.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized to 0 (disabled) by default, but can be changed at runtime using console commands or through project settings.
The variable interacts closely with its associated C++ variable GVolumetricFogRectLightTexture. They share the same value, with the console variable acting as an interface for developers to modify the setting.
Developers should be aware that this variable affects the rendering of volumetric fog, particularly when dealing with rectangular lights that have source textures. When enabled, it allows for more detailed and potentially more realistic lighting effects in volumetric fog, but may also have performance implications.
Best practices when using this variable include:
- Only enabling it when necessary, as it may impact performance.
- Testing thoroughly with and without the setting enabled to ensure desired visual results and acceptable performance.
- Considering the types of lights in the scene and whether they have source textures that would benefit from this feature.
Regarding the associated variable GVolumetricFogRectLightTexture:
This is an integer variable used internally by the engine to store the state of the r.VolumetricFog.RectLightTexture setting. It’s used in various parts of the volumetric fog rendering code to determine whether to use rect light source textures.
The variable is checked in several places within the RenderLocalLightsForVolumetricFog function, influencing how local lights are rendered for volumetric fog. It’s often used in conjunction with checks for whether a light has a source texture (LightSceneInfo->Proxy->HasSourceTexture()).
Developers working directly with the engine source code should be aware of this variable when modifying or extending the volumetric fog rendering system. Any changes to how rectangular lights or their textures are handled in volumetric fog should consider the state of this variable.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:122
Scope: file
Source code excerpt:
int32 GVolumetricFogRectLightTexture = 0;
FAutoConsoleVariableRef CVarVolumetricRectLightTexture(
TEXT("r.VolumetricFog.RectLightTexture"),
GVolumetricFogRectLightTexture,
TEXT("Whether to allow the volumetric fog to use rect light source texture."),
ECVF_RenderThreadSafe
);
int32 GVolumetricFogConservativeDepth = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GVolumetricFogRectLightTexture
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:120
Scope: file
Source code excerpt:
);
int32 GVolumetricFogRectLightTexture = 0;
FAutoConsoleVariableRef CVarVolumetricRectLightTexture(
TEXT("r.VolumetricFog.RectLightTexture"),
GVolumetricFogRectLightTexture,
TEXT("Whether to allow the volumetric fog to use rect light source texture."),
ECVF_RenderThreadSafe
);
int32 GVolumetricFogConservativeDepth = 0;
FAutoConsoleVariableRef CVarVolumetricFogConservativeDepth(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:703
Scope (from outer to inner):
file
function void FSceneRenderer::RenderLocalLightsForVolumetricFog
Source code excerpt:
bool bIsShadowed = LightNeedsSeparateInjectionIntoVolumetricFogForOpaqueShadow(View, LightSceneInfo, VisibleLightInfos[LightSceneInfo->Id]);
bool bUsesRectLightTexture = GVolumetricFogRectLightTexture && LightSceneInfo->Proxy->HasSourceTexture();
if (LightSceneInfo->ShouldRenderLightViewIndependent()
&& LightSceneInfo->ShouldRenderLight(View)
&& (bIsShadowed || bUsesRectLightTexture)
&& LightSceneInfo->Proxy->GetVolumetricScatteringIntensity() > 0)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:745
Scope (from outer to inner):
file
function void FSceneRenderer::RenderLocalLightsForVolumetricFog
Source code excerpt:
{
bool bIsShadowed = LightNeedsSeparateInjectionIntoVolumetricFogForOpaqueShadow(View, LightSceneInfo, VisibleLightInfo);
bool bUsesRectLightTexture = GVolumetricFogRectLightTexture && LightSceneInfo->Proxy->HasSourceTexture();
int32 VirtualShadowMapId = VisibleLightInfo.GetVirtualShadowMapId(&View);
const bool bUseVSM = bIsShadowed && VirtualShadowMapArray.IsAllocated() && VirtualShadowMapId != INDEX_NONE;
FInjectShadowedLocalLightPS::FParameters* PassParameters = GraphBuilder.AllocParameters<FInjectShadowedLocalLightPS::FParameters>();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:869
Scope (from outer to inner):
file
function void FSceneRenderer::RenderLocalLightsForVolumetricFog
Source code excerpt:
if (VolumeZBounds.X < VolumeZBounds.Y)
{
bool bUsesRectLightTexture = GVolumetricFogRectLightTexture && LightSceneInfo->Proxy->HasSourceTexture();
FInjectShadowedLocalLightRGS::FParameters* PassParameters = GraphBuilder.AllocParameters<FInjectShadowedLocalLightRGS::FParameters>();
PassParameters->OutVolumeTexture = GraphBuilder.CreateUAV(OutLocalShadowedLightScattering);
PassParameters->TLAS = View.GetRayTracingSceneLayerViewChecked(ERayTracingSceneLayer::Base);
PassParameters->FirstSlice = VolumeZBounds.X;