UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DistanceFieldLightingPost.cpp File Reference

Classes

class  FUpdateHistoryDepthRejectionPS
 
class  FFilterHistoryPS
 
class  FGeometryAwareUpsamplePS
 
class  FDistanceFieldAOUpsamplePS
 

Functions

bool UseAOHistoryStabilityPass ()
 
bool ShouldCompileDFLightingPostShaders (EShaderPlatform ShaderPlatform)
 
FGeometryAwareUpsampleParameters SetupGeometryAwareUpsampleParameters (const FViewInfo &View, FRDGTextureRef DistanceFieldNormal, FRDGTextureRef DistanceFieldAOBentNormal)
 
 IMPLEMENT_GLOBAL_SHADER (FUpdateHistoryDepthRejectionPS, "/Engine/Private/DistanceFieldLightingPost.usf", "UpdateHistoryDepthRejectionPS", SF_Pixel)
 
 IMPLEMENT_GLOBAL_SHADER (FFilterHistoryPS, "/Engine/Private/DistanceFieldLightingPost.usf", "FilterHistoryPS", SF_Pixel)
 
 IMPLEMENT_SHADER_TYPE (, FGeometryAwareUpsamplePS, TEXT("/Engine/Private/DistanceFieldLightingPost.usf"), TEXT("GeometryAwareUpsamplePS"), SF_Pixel)
 
void AllocateOrReuseAORenderTarget (FRDGBuilder &GraphBuilder, const FViewInfo &View, FRDGTextureRef &Texture, const TCHAR *Name, EPixelFormat Format, ETextureCreateFlags Flags)
 
void GeometryAwareUpsample (FRDGBuilder &GraphBuilder, const FViewInfo &View, FRDGTextureRef DistanceFieldAOBentNormal, FRDGTextureRef DistanceFieldNormal, FRDGTextureRef BentNormalInterpolation, const FDistanceFieldAOParameters &Parameters)
 
bool DistanceFieldAOUseHistory (const FViewInfo &View)
 
void UpdateHistory (FRDGBuilder &GraphBuilder, const FViewInfo &View, const TCHAR *BentNormalHistoryRTName, const FSceneTextures &SceneTextures, FRDGTextureRef VelocityTexture, FRDGTextureRef DistanceFieldNormal, FRDGTextureRef BentNormalInterpolation, FIntRect *DistanceFieldAOHistoryViewRect, TRefCountPtr< IPooledRenderTarget > *BentNormalHistoryState, FRDGTextureRef &BentNormalHistoryOutput, const FDistanceFieldAOParameters &Parameters)
 
 IMPLEMENT_GLOBAL_SHADER (FDistanceFieldAOUpsamplePS, "/Engine/Private/DistanceFieldLightingPost.usf", "AOUpsamplePS", SF_Pixel)
 
void UpsampleBentNormalAO (FRDGBuilder &GraphBuilder, const FViewInfo &View, const FSceneTextures &SceneTextures, FRDGTextureRef SceneColorTexture, FRDGTextureRef DistanceFieldAOBentNormal, bool bModulateSceneColor, bool bModulateToScreenSpaceAO)
 

Variables

int32 GAOUseHistory = 1
 
FAutoConsoleVariableRef CVarAOUseHistory (TEXT("r.AOUseHistory"), GAOUseHistory, TEXT("Whether to apply a temporal filter to the distance field AO, which reduces flickering but also adds trails when occluders are moving."), ECVF_RenderThreadSafe)
 
int32 GAOClearHistory = 0
 
FAutoConsoleVariableRef CVarAOClearHistory (TEXT("r.AOClearHistory"), GAOClearHistory, TEXT(""), ECVF_RenderThreadSafe)
 
int32 GAOHistoryStabilityPass = 1
 
FAutoConsoleVariableRef CVarAOHistoryStabilityPass (TEXT("r.AOHistoryStabilityPass"), GAOHistoryStabilityPass, TEXT("Whether to gather stable results to fill in holes in the temporal reprojection. Adds some GPU cost but improves temporal stability with foliage."), ECVF_RenderThreadSafe)
 
float GAOHistoryWeight = .85f
 
FAutoConsoleVariableRef CVarAOHistoryWeight (TEXT("r.AOHistoryWeight"), GAOHistoryWeight, TEXT("Amount of last frame's AO to lerp into the final result. Higher values increase stability, lower values have less streaking under occluder movement."), ECVF_RenderThreadSafe)
 
float GAOHistoryDistanceThreshold = 30
 
FAutoConsoleVariableRef CVarAOHistoryDistanceThreshold (TEXT("r.AOHistoryDistanceThreshold"), GAOHistoryDistanceThreshold, TEXT("World space distance threshold needed to discard last frame's DFAO results. Lower values reduce ghosting from characters when near a wall but increase flickering artifacts."), ECVF_RenderThreadSafe)
 
float GAOViewFadeDistanceScale = .7f
 
FAutoConsoleVariableRef CVarAOViewFadeDistanceScale (TEXT("r.AOViewFadeDistanceScale"), GAOViewFadeDistanceScale, TEXT("Distance over which AO will fade out as it approaches r.AOMaxViewDistance, as a fraction of r.AOMaxViewDistance."), ECVF_RenderThreadSafe)
 

Function Documentation

◆ AllocateOrReuseAORenderTarget()

void AllocateOrReuseAORenderTarget ( FRDGBuilder GraphBuilder,
const FViewInfo View,
FRDGTextureRef Texture,
const TCHAR Name,
EPixelFormat  Format,
ETextureCreateFlags  Flags 
)

◆ DistanceFieldAOUseHistory()

bool DistanceFieldAOUseHistory ( const FViewInfo View)

◆ GeometryAwareUpsample()

void GeometryAwareUpsample ( FRDGBuilder GraphBuilder,
const FViewInfo View,
FRDGTextureRef  DistanceFieldAOBentNormal,
FRDGTextureRef  DistanceFieldNormal,
FRDGTextureRef  BentNormalInterpolation,
const FDistanceFieldAOParameters Parameters 
)

◆ IMPLEMENT_GLOBAL_SHADER() [1/3]

IMPLEMENT_GLOBAL_SHADER ( FDistanceFieldAOUpsamplePS  ,
"/Engine/Private/DistanceFieldLightingPost.usf"  ,
"AOUpsamplePS"  ,
SF_Pixel   
)

◆ IMPLEMENT_GLOBAL_SHADER() [2/3]

IMPLEMENT_GLOBAL_SHADER ( FFilterHistoryPS  ,
"/Engine/Private/DistanceFieldLightingPost.usf"  ,
"FilterHistoryPS"  ,
SF_Pixel   
)

◆ IMPLEMENT_GLOBAL_SHADER() [3/3]

IMPLEMENT_GLOBAL_SHADER ( FUpdateHistoryDepthRejectionPS  ,
"/Engine/Private/DistanceFieldLightingPost.usf"  ,
"UpdateHistoryDepthRejectionPS"  ,
SF_Pixel   
)

◆ IMPLEMENT_SHADER_TYPE()

IMPLEMENT_SHADER_TYPE ( FGeometryAwareUpsamplePS  ,
TEXT("/Engine/Private/DistanceFieldLightingPost.usf" ,
TEXT("GeometryAwareUpsamplePS")  ,
SF_Pixel   
)

◆ SetupGeometryAwareUpsampleParameters()

FGeometryAwareUpsampleParameters SetupGeometryAwareUpsampleParameters ( const FViewInfo View,
FRDGTextureRef  DistanceFieldNormal,
FRDGTextureRef  DistanceFieldAOBentNormal 
)

◆ ShouldCompileDFLightingPostShaders()

bool ShouldCompileDFLightingPostShaders ( EShaderPlatform  ShaderPlatform)

◆ UpdateHistory()

void UpdateHistory ( FRDGBuilder GraphBuilder,
const FViewInfo View,
const TCHAR BentNormalHistoryRTName,
const FSceneTextures SceneTextures,
FRDGTextureRef  VelocityTexture,
FRDGTextureRef  DistanceFieldNormal,
FRDGTextureRef  BentNormalInterpolation,
FIntRect DistanceFieldAOHistoryViewRect,
TRefCountPtr< IPooledRenderTarget > *  BentNormalHistoryState,
FRDGTextureRef BentNormalHistoryOutput,
const FDistanceFieldAOParameters Parameters 
)
Parameters
DistanceFieldAOHistoryViewRectContains last frame's history, if non-NULL. This will be updated with the new frame's history.
BentNormalHistoryOutputOutput of Temporal Reprojection for the next step in the pipeline.

◆ UpsampleBentNormalAO()

void UpsampleBentNormalAO ( FRDGBuilder GraphBuilder,
const FViewInfo View,
const FSceneTextures SceneTextures,
FRDGTextureRef  SceneColorTexture,
FRDGTextureRef  DistanceFieldAOBentNormal,
bool  bModulateSceneColor,
bool  bModulateToScreenSpaceAO 
)

◆ UseAOHistoryStabilityPass()

bool UseAOHistoryStabilityPass ( )

Variable Documentation

◆ CVarAOClearHistory

FAutoConsoleVariableRef CVarAOClearHistory(TEXT("r.AOClearHistory"), GAOClearHistory, TEXT(""), ECVF_RenderThreadSafe) ( TEXT("r.AOClearHistory")  ,
GAOClearHistory  ,
TEXT("")  ,
ECVF_RenderThreadSafe   
)

◆ CVarAOHistoryDistanceThreshold

◆ CVarAOHistoryStabilityPass

FAutoConsoleVariableRef CVarAOHistoryStabilityPass(TEXT("r.AOHistoryStabilityPass"), GAOHistoryStabilityPass, TEXT("Whether to gather stable results to fill in holes in the temporal reprojection. Adds some GPU cost but improves temporal stability with foliage."), ECVF_RenderThreadSafe) ( TEXT("r.AOHistoryStabilityPass")  ,
GAOHistoryStabilityPass  ,
TEXT("Whether to gather stable results to fill in holes in the temporal reprojection. Adds some GPU cost but improves temporal stability with foliage." ,
ECVF_RenderThreadSafe   
)

◆ CVarAOHistoryWeight

FAutoConsoleVariableRef CVarAOHistoryWeight(TEXT("r.AOHistoryWeight"), GAOHistoryWeight, TEXT("Amount of last frame's AO to lerp into the final result. Higher values increase stability, lower values have less streaking under occluder movement."), ECVF_RenderThreadSafe) ( TEXT("r.AOHistoryWeight")  ,
GAOHistoryWeight  ,
TEXT("Amount of last frame's AO to lerp into the final result. Higher values increase stability, lower values have less streaking under occluder movement." ,
ECVF_RenderThreadSafe   
)

◆ CVarAOUseHistory

FAutoConsoleVariableRef CVarAOUseHistory(TEXT("r.AOUseHistory"), GAOUseHistory, TEXT("Whether to apply a temporal filter to the distance field AO, which reduces flickering but also adds trails when occluders are moving."), ECVF_RenderThreadSafe) ( TEXT("r.AOUseHistory")  ,
GAOUseHistory  ,
TEXT("Whether to apply a temporal filter to the distance field AO, which reduces flickering but also adds trails when occluders are moving." ,
ECVF_RenderThreadSafe   
)

◆ CVarAOViewFadeDistanceScale

FAutoConsoleVariableRef CVarAOViewFadeDistanceScale(TEXT("r.AOViewFadeDistanceScale"), GAOViewFadeDistanceScale, TEXT("Distance over which AO will fade out as it approaches r.AOMaxViewDistance, as a fraction of r.AOMaxViewDistance."), ECVF_RenderThreadSafe) ( TEXT("r.AOViewFadeDistanceScale")  ,
GAOViewFadeDistanceScale  ,
TEXT("Distance over which AO will fade out as it approaches r.AOMaxViewDistance, as a fraction of r.AOMaxViewDistance." ,
ECVF_RenderThreadSafe   
)

◆ GAOClearHistory

int32 GAOClearHistory = 0

◆ GAOHistoryDistanceThreshold

float GAOHistoryDistanceThreshold = 30

◆ GAOHistoryStabilityPass

int32 GAOHistoryStabilityPass = 1

◆ GAOHistoryWeight

float GAOHistoryWeight = .85f

◆ GAOUseHistory

int32 GAOUseHistory = 1

◆ GAOViewFadeDistanceScale

float GAOViewFadeDistanceScale = .7f