r.VolumetricFog.HistoryMissSupersampleCount
r.VolumetricFog.HistoryMissSupersampleCount
#Overview
name: r.VolumetricFog.HistoryMissSupersampleCount
The value of this variable can be defined or overridden in .ini config files. 3
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of lighting samples to compute for voxels whose history value is not available.\nThis reduces noise when panning or on camera cuts, but introduces a variable cost to volumetric fog computation. Valid range [1, 16].
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricFog.HistoryMissSupersampleCount is to control the number of lighting samples computed for voxels in volumetric fog when their history value is not available. This setting is part of the rendering system, specifically for volumetric fog rendering.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, particularly in the volumetric fog computation subsystem. It’s referenced in the VolumetricFog.cpp file, which is responsible for handling volumetric fog rendering.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 4 and can be changed at runtime using console commands.
The associated variable GVolumetricFogHistoryMissSupersampleCount directly interacts with r.VolumetricFog.HistoryMissSupersampleCount. They share the same value, with GVolumetricFogHistoryMissSupersampleCount being the actual variable used in the C++ code.
Developers must be aware that:
- This variable affects the quality and performance of volumetric fog rendering.
- Higher values reduce noise when panning or during camera cuts but increase computational cost.
- The valid range for this variable is [1, 16].
Best practices when using this variable include:
- Adjusting it based on the specific needs of the scene and target hardware capabilities.
- Using lower values for better performance on less powerful hardware.
- Increasing the value when higher quality fog rendering is required, especially in scenes with frequent camera movements or cuts.
Regarding the associated variable GVolumetricFogHistoryMissSupersampleCount:
- Its purpose is the same as r.VolumetricFog.HistoryMissSupersampleCount, serving as the internal representation in the C++ code.
- It’s used directly in the volumetric fog computation process, particularly in the SetupVolumetricFogIntegrationParameters and ComputeVolumetricFog functions.
- The value is clamped between 1 and 16 before use, ensuring it stays within the valid range.
- It’s used to determine the number of frame jitter offset values and the super sample count for volumetric fog light scattering.
Developers should be aware that changes to r.VolumetricFog.HistoryMissSupersampleCount will directly affect GVolumetricFogHistoryMissSupersampleCount, impacting the volumetric fog rendering process.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:189, section: [ShadowQuality@2]
- INI Section:
ShadowQuality@2
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:216, section: [ShadowQuality@3]
- INI Section:
ShadowQuality@3
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:243, section: [ShadowQuality@Cine]
- INI Section:
ShadowQuality@Cine
- Raw value:
16
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:97
Scope: file
Source code excerpt:
int32 GVolumetricFogHistoryMissSupersampleCount = 4;
FAutoConsoleVariableRef CVarVolumetricFogHistoryMissSupersampleCount(
TEXT("r.VolumetricFog.HistoryMissSupersampleCount"),
GVolumetricFogHistoryMissSupersampleCount,
TEXT("Number of lighting samples to compute for voxels whose history value is not available.\n")
TEXT("This reduces noise when panning or on camera cuts, but introduces a variable cost to volumetric fog computation. Valid range [1, 16]."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named GVolumetricFogHistoryMissSupersampleCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:95
Scope: file
Source code excerpt:
);
int32 GVolumetricFogHistoryMissSupersampleCount = 4;
FAutoConsoleVariableRef CVarVolumetricFogHistoryMissSupersampleCount(
TEXT("r.VolumetricFog.HistoryMissSupersampleCount"),
GVolumetricFogHistoryMissSupersampleCount,
TEXT("Number of lighting samples to compute for voxels whose history value is not available.\n")
TEXT("This reduces noise when panning or on camera cuts, but introduces a variable cost to volumetric fog computation. Valid range [1, 16]."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GInverseSquaredLightDistanceBiasScale = 1.0f;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:215
Scope (from outer to inner):
file
function void SetupVolumetricFogIntegrationParameters
Source code excerpt:
Out.HistoryWeight = IntegrationData.bTemporalHistoryIsValid ? GVolumetricFogHistoryWeight : 0.0f;
extern int32 GVolumetricFogHistoryMissSupersampleCount;
Out.HistoryMissSuperSampleCount = FMath::Clamp(GVolumetricFogHistoryMissSupersampleCount, 1, 16);
}
static const uint32 VolumetricFogGridInjectionGroupSize = 4;
namespace
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:1349
Scope (from outer to inner):
file
function void FSceneRenderer::ComputeVolumetricFog
Source code excerpt:
IntegrationData.FrameJitterOffsetValues[0] = VolumetricFogTemporalRandom(View.Family->FrameNumber);
for (int32 FrameOffsetIndex = 1; FrameOffsetIndex < GVolumetricFogHistoryMissSupersampleCount; FrameOffsetIndex++)
{
IntegrationData.FrameJitterOffsetValues[FrameOffsetIndex] = VolumetricFogTemporalRandom(View.Family->FrameNumber - FrameOffsetIndex);
}
// Mobile has limited capacities with SRV binding so do not enable atlas sampling on there.
const bool bUseLightFunctionAtlas = LightFunctionAtlas::IsEnabled(*Scene, ELightFunctionAtlasSystem::VolumetricFog) && !IsMobilePlatform(View.GetShaderPlatform());
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:1663
Scope (from outer to inner):
file
function void FSceneRenderer::ComputeVolumetricFog
Source code excerpt:
&& !IsMobilePlatform(View.GetShaderPlatform());
const int32 SuperSampleCount = FVolumetricFogLightScatteringCS::GetSuperSampleCount(GVolumetricFogHistoryMissSupersampleCount);
FVolumetricFogLightScatteringCS::FPermutationDomain PermutationVector;
PermutationVector.Set< FVolumetricFogLightScatteringCS::FTemporalReprojection >(bUseTemporalReprojection);
PermutationVector.Set< FVolumetricFogLightScatteringCS::FDistanceFieldSkyOcclusion >(bUseDistanceFieldSkyOcclusion);
PermutationVector.Set< FVolumetricFogLightScatteringCS::FSuperSampleCount >(SuperSampleCount);
PermutationVector.Set< FVolumetricFogLightScatteringCS::FLumenGI >(bUseLumenGI);