r.Substrate.Glints.LevelMin
r.Substrate.Glints.LevelMin
#Overview
name: r.Substrate.Glints.LevelMin
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The minimum glint level used to render glints. Mostly affect the look of distance surfaces. A value greater than 0 will force glints to always be visible instead of using the analytic BSDF. Be careful as this might cause aliasing.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Substrate.Glints.LevelMin is to control the minimum glint level used in rendering glints for the Substrate material system in Unreal Engine 5. This setting primarily affects the appearance of distant surfaces in the rendering process.
This setting variable is part of the rendering system, specifically the Substrate material system within Unreal Engine 5. Based on the callsites, it’s primarily used in the RenderCore module, which is a core component of UE5’s rendering pipeline.
The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It’s initialized with a default value of 0.0f, but can be changed via console commands or through engine configuration files.
The associated variable CVarSubstrateGlintsLevelMin directly interacts with r.Substrate.Glints.LevelMin. They share the same value and purpose.
Developers must be aware that setting this value greater than 0 will force glints to always be visible instead of using the analytic BSDF (Bidirectional Scattering Distribution Function). While this can enhance the visibility of glints, it may also cause aliasing issues, especially at a distance.
Best practices when using this variable include:
- Keep the value at 0 or very close to 0 for most scenarios to avoid aliasing.
- Use higher values cautiously, only when necessary for specific visual effects.
- Test thoroughly at various distances when adjusting this value to ensure no unexpected visual artifacts occur.
Regarding the associated variable CVarSubstrateGlintsLevelMin:
- It’s purpose is identical to r.Substrate.Glints.LevelMin, serving as the C++ representation of the console variable.
- It’s used within the Substrate namespace in the RenderCore module.
- The GlintLevelMin() function uses this variable to retrieve the current minimum glint level, ensuring the value is not negative.
- Developers should be aware that changes to this variable will directly affect the rendering of glints in the Substrate material system.
- Best practices include using the GetValueOnAnyThread() method to access its value, as shown in the provided code snippet, to ensure thread-safe access in multi-threaded rendering scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1813
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarSubstrateGlintsLevelMin(
TEXT("r.Substrate.Glints.LevelMin"),
0.0f,
TEXT("The minimum glint level used to render glints. Mostly affect the look of distance surfaces. A value greater than 0 will force glints to always be visible instead of using the analytic BSDF. Be careful as this might cause aliasing."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSubstrateSpecularProfile(
TEXT("r.Substrate.SpecularProfile"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarSubstrateGlintsLevelMin
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1812
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarSubstrateGlintsLevelMin(
TEXT("r.Substrate.Glints.LevelMin"),
0.0f,
TEXT("The minimum glint level used to render glints. Mostly affect the look of distance surfaces. A value greater than 0 will force glints to always be visible instead of using the analytic BSDF. Be careful as this might cause aliasing."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSubstrateSpecularProfile(
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1947
Scope (from outer to inner):
file
namespace Substrate
function float GlintLevelMin
Source code excerpt:
float GlintLevelMin()
{
const float MinLevel = CVarSubstrateGlintsLevelMin.GetValueOnAnyThread();
return MinLevel < 0.0f ? 0.0f : MinLevel;
}
bool IsSpecularProfileEnabled()
{
return IsSubstrateEnabled() && CVarSubstrateSpecularProfile.GetValueOnAnyThread() > 0;