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

Classes

class  FCalculateShadingRateImageCS
 
class  FRescaleVariableRateShadingCS
 
struct  FCASImageData
 
struct  FCASImageData::FCASImageSet
 

Namespaces

namespace  ESRITextureType
 
namespace  ESRIPreviewType
 

Functions

 IMPLEMENT_GLOBAL_SHADER (FCalculateShadingRateImageCS, "/Engine/Private/VariableRateShading/VRSShadingRateCalculate.usf", "CalculateShadingRateImage", SF_Compute)
 
 IMPLEMENT_GLOBAL_SHADER (FRescaleVariableRateShadingCS, "/Engine/Private/VariableRateShading/VRSShadingRateReproject.usf", "RescaleVariableRateShading", SF_Compute)
 
 RDG_REGISTER_BLACKBOARD_STRUCT (FCASImageData)
 
void AddCreateShadingRateImagePass (FRDGBuilder &GraphBuilder, const FSceneViewFamily &ViewFamily, bool bCreateHardwareImages, bool bCreateSoftwareImages)
 
void AddReprojectImageBasedVRSPass (FRDGBuilder &GraphBuilder, const FMinimalSceneTextures &SceneTextures, const FSceneViewFamily &ViewFamily, bool bReprojectSoftwareImages)
 

Variables

TAutoConsoleVariable< int32CVarCASContrastAdaptiveShading (TEXT("r.VRS.ContrastAdaptiveShading"), 0, TEXT("Enables using Variable Rate Shading based on the luminance from the previous frame's post process output \n"), ECVF_RenderThreadSafe)
 
TAutoConsoleVariable< floatCVarCASEdgeThreshold (TEXT("r.VRS.ContrastAdaptiveShading.EdgeThreshold"), 0.2, TEXT(""), ECVF_RenderThreadSafe)
 
TAutoConsoleVariable< floatCVarCASConservativeEdgeThreshold (TEXT("r.VRS.ContrastAdaptiveShading.ConservativeEdgeThreshold"), 0.1, TEXT(""), ECVF_RenderThreadSafe)
 
TAutoConsoleVariable< floatCVarCAS_HDR10CorrectionMultiplier (TEXT("r.VRS.ContrastAdaptiveShading.HDR10CorrectionMultiplier"), 0.55, TEXT("Approximation multiplier to account for how perceptual values are spread out in SDR vs HDR10\n"), ECVF_RenderThreadSafe)
 
TAutoConsoleVariable< int32CVarCASPreview (TEXT("r.VRS.ContrastAdaptiveShading.Preview"), 1, TEXT("0 - off, 1 - on (default)"), ECVF_RenderThreadSafe)
 

Function Documentation

◆ AddCreateShadingRateImagePass()

void AddCreateShadingRateImagePass ( FRDGBuilder GraphBuilder,
const FSceneViewFamily ViewFamily,
bool  bCreateHardwareImages,
bool  bCreateSoftwareImages 
)

◆ AddReprojectImageBasedVRSPass()

void AddReprojectImageBasedVRSPass ( FRDGBuilder GraphBuilder,
const FMinimalSceneTextures SceneTextures,
const FSceneViewFamily ViewFamily,
bool  bReprojectSoftwareImages 
)

◆ IMPLEMENT_GLOBAL_SHADER() [1/2]

IMPLEMENT_GLOBAL_SHADER ( FCalculateShadingRateImageCS  ,
"/Engine/Private/VariableRateShading/VRSShadingRateCalculate.usf"  ,
"CalculateShadingRateImage"  ,
SF_Compute   
)

◆ IMPLEMENT_GLOBAL_SHADER() [2/2]

IMPLEMENT_GLOBAL_SHADER ( FRescaleVariableRateShadingCS  ,
"/Engine/Private/VariableRateShading/VRSShadingRateReproject.usf"  ,
"RescaleVariableRateShading"  ,
SF_Compute   
)

◆ RDG_REGISTER_BLACKBOARD_STRUCT()

RDG_REGISTER_BLACKBOARD_STRUCT ( FCASImageData  )

Variable Documentation

◆ CVarCAS_HDR10CorrectionMultiplier

TAutoConsoleVariable< float > CVarCAS_HDR10CorrectionMultiplier(TEXT("r.VRS.ContrastAdaptiveShading.HDR10CorrectionMultiplier"), 0.55, TEXT("Approximation multiplier to account for how perceptual values are spread out in SDR vs HDR10\n"), ECVF_RenderThreadSafe) ( TEXT("r.VRS.ContrastAdaptiveShading.HDR10CorrectionMultiplier")  ,
0.  55,
TEXT("Approximation multiplier to account for how perceptual values are spread out in SDR vs HDR10\n" ,
ECVF_RenderThreadSafe   
)

◆ CVarCASConservativeEdgeThreshold

TAutoConsoleVariable< float > CVarCASConservativeEdgeThreshold(TEXT("r.VRS.ContrastAdaptiveShading.ConservativeEdgeThreshold"), 0.1, TEXT(""), ECVF_RenderThreadSafe) ( TEXT("r.VRS.ContrastAdaptiveShading.ConservativeEdgeThreshold")  ,
0.  1,
TEXT("")  ,
ECVF_RenderThreadSafe   
)

◆ CVarCASContrastAdaptiveShading

TAutoConsoleVariable< int32 > CVarCASContrastAdaptiveShading(TEXT("r.VRS.ContrastAdaptiveShading"), 0, TEXT("Enables using Variable Rate Shading based on the luminance from the previous frame's post process output \n"), ECVF_RenderThreadSafe) ( TEXT("r.VRS.ContrastAdaptiveShading")  ,
,
TEXT("Enables using Variable Rate Shading based on the luminance from the previous frame's post process output \n" ,
ECVF_RenderThreadSafe   
)

Contrast Adaptive Shading (CAS) is a Tier 2 Variable Rate Shading method which generates a shading rate image (SRI) by examining the contrast from the previous frame. An image is generated which designates lower shading rates for areas of lower contrast in which reductions are unlikely to be noticed. This image is then reprojected and rescaled in accordance with camera movement and dynamic resolution changes before being provided to the manager. CAS Parameters

◆ CVarCASEdgeThreshold

TAutoConsoleVariable< float > CVarCASEdgeThreshold(TEXT("r.VRS.ContrastAdaptiveShading.EdgeThreshold"), 0.2, TEXT(""), ECVF_RenderThreadSafe) ( TEXT("r.VRS.ContrastAdaptiveShading.EdgeThreshold")  ,
0.  2,
TEXT("")  ,
ECVF_RenderThreadSafe   
)

◆ CVarCASPreview

TAutoConsoleVariable< int32 > CVarCASPreview(TEXT("r.VRS.ContrastAdaptiveShading.Preview"), 1, TEXT("0 - off, 1 - on (default)"), ECVF_RenderThreadSafe) ( TEXT("r.VRS.ContrastAdaptiveShading.Preview")  ,
,
TEXT("0 - off, 1 - on (default)")  ,
ECVF_RenderThreadSafe   
)

Debug Settings