r.SSR.TiledComposite.OverrideMaxRoughness
r.SSR.TiledComposite.OverrideMaxRoughness
#Overview
name: r.SSR.TiledComposite.OverrideMaxRoughness
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Ignore pixels with roughness larger than this value.<0: use derived value from ScreenSpaceReflectionMaxRoughness of FinalPostProcessSettings.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SSR.TiledComposite.OverrideMaxRoughness is to control the maximum roughness value for screen space reflections (SSR) in the tiled composite rendering process. This setting is part of Unreal Engine’s rendering system, specifically the screen space reflection implementation.
This setting variable is primarily used in the Renderer module of Unreal Engine, as evidenced by its location in the ScreenSpaceReflectionTiles.cpp file.
The value of this variable is set through a console variable (CVarSSRTiledCompositeOverrideMaxRoughness) with a default value of -1.0f. It can be modified at runtime through console commands or programmatically.
This variable interacts with the ScreenSpaceReflectionMaxRoughness setting from FinalPostProcessSettings. When the value is set to less than 0, the system uses the derived value from ScreenSpaceReflectionMaxRoughness instead.
Developers should be aware that this variable allows for fine-tuning of SSR performance and visual quality. By limiting the maximum roughness, you can potentially improve performance by reducing the number of pixels that need to be processed for reflections.
Best practices when using this variable include:
- Use values between 0 and 1, where 0 is completely smooth and 1 is maximum roughness.
- Set it to -1 if you want to use the value from ScreenSpaceReflectionMaxRoughness in FinalPostProcessSettings.
- Adjust this value in conjunction with other SSR settings for optimal balance between performance and visual quality.
Regarding the associated variable CVarSSRTiledCompositeOverrideMaxRoughness:
This is the actual console variable that stores and manages the r.SSR.TiledComposite.OverrideMaxRoughness setting. It’s defined as a TAutoConsoleVariable
The purpose of CVarSSRTiledCompositeOverrideMaxRoughness is to provide a way to access and modify the r.SSR.TiledComposite.OverrideMaxRoughness setting programmatically and through the console.
This variable is used in the Renderer module, specifically in the GetScreenSpaceReflectionMaxRoughnessScale function, which determines the maximum roughness scale for screen space reflections.
The value of this variable is set when it’s defined, with a default of -1.0f. It can be changed at runtime using console commands or through C++ code.
CVarSSRTiledCompositeOverrideMaxRoughness interacts directly with the View.FinalPostProcessSettings.ScreenSpaceReflectionMaxRoughness when its value is less than 0.
Developers should be aware that this variable uses the ECVF_RenderThreadSafe and ECVF_Scalability flags, meaning it’s safe to access from the render thread and can be used for scalability settings.
Best practices for using this variable include:
- Access its value using GetValueOnRenderThread() when in render thread code.
- Consider exposing it to artists or designers through a user interface for easy tuning of SSR quality and performance.
- Use it in conjunction with other SSR settings for a comprehensive approach to optimizing reflections.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceReflectionTiles.cpp:10
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarSSRTiledCompositeOverrideMaxRoughness(
TEXT("r.SSR.TiledComposite.OverrideMaxRoughness"), -1.0f,
TEXT("Ignore pixels with roughness larger than this value.")
TEXT("<0: use derived value from ScreenSpaceReflectionMaxRoughness of FinalPostProcessSettings."),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSSRTiledCompositeMinSpecular(
TEXT("r.SSR.TiledComposite.MinSpecular"), 0.0f,
#Associated Variable and Callsites
This variable is associated with another variable named CVarSSRTiledCompositeOverrideMaxRoughness
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceReflectionTiles.cpp:9
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSSRTiledCompositeOverrideMaxRoughness(
TEXT("r.SSR.TiledComposite.OverrideMaxRoughness"), -1.0f,
TEXT("Ignore pixels with roughness larger than this value.")
TEXT("<0: use derived value from ScreenSpaceReflectionMaxRoughness of FinalPostProcessSettings."),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSSRTiledCompositeMinSpecular(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceReflectionTiles.cpp:33
Scope (from outer to inner):
file
function static float GetScreenSpaceReflectionMaxRoughnessScale
Source code excerpt:
static float GetScreenSpaceReflectionMaxRoughnessScale(const FViewInfo& View)
{
float MaxRoughness = CVarSSRTiledCompositeOverrideMaxRoughness.GetValueOnRenderThread();
if (MaxRoughness < 0)
{
MaxRoughness = FMath::Clamp(View.FinalPostProcessSettings.ScreenSpaceReflectionMaxRoughness, 0.01f, 1.0f);
}
return MaxRoughness;