r.Substrate.Glints.LevelBias

r.Substrate.Glints.LevelBias

#Overview

name: r.Substrate.Glints.LevelBias

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.LevelBias is to control the intensity of glint effects in the rendering system, specifically within the Substrate rendering module of Unreal Engine 5. It allows for fine-tuning of the glint level by applying a constant bias.

This setting variable is utilized by the rendering subsystem of Unreal Engine 5, particularly in the Substrate module which is responsible for advanced material rendering.

The value of this variable is set through a console variable (CVarSubstrateGlintsLevelBias) with a default value of 0.0f. It can be adjusted at runtime through console commands or programmatically.

The associated variable CVarSubstrateGlintsLevelBias interacts directly with r.Substrate.Glints.LevelBias, as they share the same value. This variable is used to retrieve the current glint level bias in the Substrate namespace’s GlintLevelBias() function.

Developers must be aware that modifying this variable can have significant impacts on the visual appearance of glint effects. Negative values will intensify the glint effect, while positive values will attenuate it. It’s important to note that extreme values might cause aliasing artifacts.

Best practices when using this variable include:

  1. Make small, incremental adjustments to find the optimal value for your specific use case.
  2. Test the changes across various lighting conditions and material types to ensure consistent results.
  3. Be cautious of potential aliasing artifacts when using extreme values.
  4. Consider using this in conjunction with other glint-related settings for a comprehensive approach to glint control.

Regarding the associated variable CVarSubstrateGlintsLevelBias:

The purpose of CVarSubstrateGlintsLevelBias is to provide a programmatic interface for accessing and modifying the r.Substrate.Glints.LevelBias setting.

This variable is part of the rendering subsystem, specifically within the Substrate module of Unreal Engine 5.

The value of CVarSubstrateGlintsLevelBias is set when the r.Substrate.Glints.LevelBias console variable is initialized or modified.

It interacts directly with r.Substrate.Glints.LevelBias and is used in the GlintLevelBias() function to retrieve the current glint level bias.

Developers should be aware that this variable is thread-safe (ECVF_RenderThreadSafe) and can be accessed from any thread.

Best practices for using CVarSubstrateGlintsLevelBias include:

  1. Use the GetValueOnAnyThread() method to safely retrieve the current value from any thread.
  2. Consider caching the value if it’s accessed frequently, to reduce potential performance overhead.
  3. Be aware of the potential visual impacts when modifying this value, as discussed for r.Substrate.Glints.LevelBias.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1807

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarSubstrateGlintsLevelBias(
	TEXT("r.Substrate.Glints.LevelBias"),
	0.0f,
	TEXT("Constantly bias the glint level. A negative value will reinforce the glint effect while a positive value will attenuate it. Be careful as this might cause aliasing."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarSubstrateGlintsLevelMin(
	TEXT("r.Substrate.Glints.LevelMin"),

#Associated Variable and Callsites

This variable is associated with another variable named CVarSubstrateGlintsLevelBias. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1806

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarSubstrateGlintsLevelBias(
	TEXT("r.Substrate.Glints.LevelBias"),
	0.0f,
	TEXT("Constantly bias the glint level. A negative value will reinforce the glint effect while a positive value will attenuate it. Be careful as this might cause aliasing."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarSubstrateGlintsLevelMin(

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1942

Scope (from outer to inner):

file
namespace    Substrate
function     float GlintLevelBias

Source code excerpt:

	float GlintLevelBias()
	{
		return CVarSubstrateGlintsLevelBias.GetValueOnAnyThread();
	}

	float GlintLevelMin()
	{
		const float MinLevel = CVarSubstrateGlintsLevelMin.GetValueOnAnyThread();
		return MinLevel < 0.0f ? 0.0f : MinLevel;