r.Substrate.Glints.LevelMin

r.Substrate.Glints.LevelMin

#Overview

name: r.Substrate.Glints.LevelMin

This variable is created as a Console Variable (cvar).

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:

  1. Keep the value at 0 or very close to 0 for most scenarios to avoid aliasing.
  2. Use higher values cautiously, only when necessary for specific visual effects.
  3. Test thoroughly at various distances when adjusting this value to ensure no unexpected visual artifacts occur.

Regarding the associated variable CVarSubstrateGlintsLevelMin:

#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;