r.Substrate.OpaqueMaterialRoughRefraction.BlurScale

r.Substrate.OpaqueMaterialRoughRefraction.BlurScale

#Overview

name: r.Substrate.OpaqueMaterialRoughRefraction.BlurScale

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Substrate.OpaqueMaterialRoughRefraction.BlurScale is to scale the strength of opaque rough refraction for debugging purposes in the rendering system of Unreal Engine 5.

This setting variable is primarily used in the Substrate subsystem of the Unreal Engine’s rendering module. It’s specifically utilized in the rough refraction pass for opaque materials.

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

The associated variable CVarSubstrateOpaqueMaterialRoughRefractionBlurScale directly interacts with r.Substrate.OpaqueMaterialRoughRefraction.BlurScale. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable affects the blur scale of opaque rough refractions. It’s used in multiple passes of the rendering pipeline, including horizontal blur, vertical blur, and a non-blur pass. The value is clamped to be non-negative using FMath::Max(0.0f, value).

Best practices when using this variable include:

  1. Use it primarily for debugging purposes, as intended.
  2. Be cautious when modifying its value, as it directly impacts the visual quality of opaque rough refractions.
  3. Remember that setting it to 0 will effectively disable the blur effect.
  4. Consider performance implications when increasing the blur scale significantly.

Regarding the associated variable CVarSubstrateOpaqueMaterialRoughRefractionBlurScale:

This is a console variable that directly controls the r.Substrate.OpaqueMaterialRoughRefraction.BlurScale setting. It’s defined as a TAutoConsoleVariable, which allows it to be modified at runtime.

The purpose of this variable is the same as r.Substrate.OpaqueMaterialRoughRefraction.BlurScale - to scale the strength of opaque rough refraction for debugging.

It’s used in the Substrate namespace within the rendering module, specifically in the SubstrateRoughRefraction.cpp file.

The value is set when the variable is initialized, but can be changed at runtime using console commands.

Developers should be aware that this variable is thread-safe (ECVF_RenderThreadSafe), meaning it can be safely accessed from the render thread.

Best practices for using this variable include:

  1. Use GetValueOnAnyThread() to retrieve its value safely from any thread.
  2. Remember that changes to this variable will immediately affect the rendering output.
  3. Use it in conjunction with other debugging tools to isolate and understand issues related to opaque rough refractions.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/SubstrateRoughRefraction.cpp:15

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarSubstrateOpaqueMaterialRoughRefractionBlurScale(
	TEXT("r.Substrate.OpaqueMaterialRoughRefraction.BlurScale"),
	1.0f,
	TEXT("Scale opaque rough refraction strengh for debug purposes."),
	ECVF_RenderThreadSafe);

namespace Substrate
{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/SubstrateRoughRefraction.cpp:14

Scope: file

Source code excerpt:



static TAutoConsoleVariable<float> CVarSubstrateOpaqueMaterialRoughRefractionBlurScale(
	TEXT("r.Substrate.OpaqueMaterialRoughRefraction.BlurScale"),
	1.0f,
	TEXT("Scale opaque rough refraction strengh for debug purposes."),
	ECVF_RenderThreadSafe);

namespace Substrate

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/SubstrateRoughRefraction.cpp:99

Scope (from outer to inner):

file
function     void AddSubstrateOpaqueRoughRefractionPasses

Source code excerpt:

		PassParameters->RenderTargets[0] = FRenderTargetBinding(TempTexture, LoadAction);
		PassParameters->BlurDirection = FVector2f(1.0f, 0.0f);
		PassParameters->BlurScale = FMath::Max(0.0f, CVarSubstrateOpaqueMaterialRoughRefractionBlurScale.GetValueOnAnyThread());

		FOpaqueRoughRefractionPS::FPermutationDomain PermutationVector;
		PermutationVector.Set<FOpaqueRoughRefractionPS::FEnableBlur>(true);
		TShaderMapRef<FOpaqueRoughRefractionPS> PixelShader(View.ShaderMap, PermutationVector);

		Substrate::FSubstrateTilePassVS::FPermutationDomain VSPermutationVector;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/SubstrateRoughRefraction.cpp:156

Scope (from outer to inner):

file
function     void AddSubstrateOpaqueRoughRefractionPasses

Source code excerpt:

		PassParameters->RenderTargets[0] = FRenderTargetBinding(SceneColorTexture, ERenderTargetLoadAction::ELoad);
		PassParameters->BlurDirection = FVector2f(0.0f, 1.0f);
		PassParameters->BlurScale = FMath::Max(0.0f, CVarSubstrateOpaqueMaterialRoughRefractionBlurScale.GetValueOnAnyThread());

		FOpaqueRoughRefractionPS::FPermutationDomain PermutationVector;
		PermutationVector.Set<FOpaqueRoughRefractionPS::FEnableBlur>(true);
		TShaderMapRef<FOpaqueRoughRefractionPS> PixelShader(View.ShaderMap, PermutationVector);

		Substrate::FSubstrateTilePassVS::FPermutationDomain VSPermutationVector;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/SubstrateRoughRefraction.cpp:214

Scope (from outer to inner):

file
function     void AddSubstrateOpaqueRoughRefractionPasses

Source code excerpt:

		PassParameters->RenderTargets[0] = FRenderTargetBinding(SceneColorTexture, ERenderTargetLoadAction::ELoad);
		PassParameters->BlurDirection = FVector2f(0.0f, 0.0f);
		PassParameters->BlurScale = FMath::Max(0.0f, CVarSubstrateOpaqueMaterialRoughRefractionBlurScale.GetValueOnAnyThread());

		FOpaqueRoughRefractionPS::FPermutationDomain PermutationVector;
		PermutationVector.Set<FOpaqueRoughRefractionPS::FEnableBlur>(false);
		TShaderMapRef<FOpaqueRoughRefractionPS> PixelShader(View.ShaderMap, PermutationVector);

		Substrate::FSubstrateTilePassVS::FPermutationDomain VSPermutationVector;