r.Decal.FadeScreenSizeMult
r.Decal.FadeScreenSizeMult
#Overview
name: r.Decal.FadeScreenSizeMult
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Control the per decal fade screen size. Multiplies with the per-decal screen size fade threshold. Smaller means decals fade less aggressively.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Decal.FadeScreenSizeMult is to control the fade behavior of decals based on their screen size in Unreal Engine 5’s rendering system. This setting allows developers to adjust how aggressively decals fade out as they become smaller on the screen.
This setting variable is primarily used by the Renderer module of Unreal Engine 5, specifically in the decal rendering subsystem. It’s implemented in the DecalRenderingShared.cpp file, which is part of the core rendering functionality.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1.0f, but can be changed at runtime or through configuration files.
The r.Decal.FadeScreenSizeMult variable interacts directly with its associated variable CVarDecalFadeScreenSizeMultiplier. They share the same value and purpose. The CVarDecalFadeScreenSizeMultiplier is used internally in the engine code to access the value set by r.Decal.FadeScreenSizeMult.
Developers should be aware that this variable affects all decals in the scene. A smaller value will cause decals to fade less aggressively, potentially improving visual quality at a distance but possibly impacting performance. Conversely, a larger value will make decals fade more quickly, which could improve performance but might reduce visual fidelity for distant decals.
Best practices when using this variable include:
- Fine-tuning the value based on the specific needs of your project, balancing between visual quality and performance.
- Testing the setting with various types of decals and at different viewing distances to ensure optimal results.
- Considering the target hardware when adjusting this value, as it can impact rendering performance.
Regarding the associated variable CVarDecalFadeScreenSizeMultiplier:
The purpose of CVarDecalFadeScreenSizeMultiplier is to provide internal engine access to the r.Decal.FadeScreenSizeMult setting. It’s used within the rendering code to retrieve the current value of the decal fade screen size multiplier.
This variable is used in the Renderer module, specifically in the decal rendering system. It’s accessed in the FDeferredDecalPS class, which is likely responsible for pixel shading of deferred decals.
The value of CVarDecalFadeScreenSizeMultiplier is set automatically based on the r.Decal.FadeScreenSizeMult console variable. Developers don’t need to set this variable directly; instead, they should use r.Decal.FadeScreenSizeMult to control the behavior.
CVarDecalFadeScreenSizeMultiplier interacts directly with r.Decal.FadeScreenSizeMult, as they share the same value. It’s also used in calculations related to decal fade alpha, as seen in the CalculateDecalFadeAlpha function.
Developers should be aware that this variable is intended for internal engine use. Any modifications to decal fade behavior should be done through r.Decal.FadeScreenSizeMult rather than attempting to modify CVarDecalFadeScreenSizeMultiplier directly.
Best practices for CVarDecalFadeScreenSizeMultiplier include understanding its relationship with r.Decal.FadeScreenSizeMult and using the appropriate console variable (r.Decal.FadeScreenSizeMult) when adjusting decal fade behavior in your project.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:18
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarDecalFadeScreenSizeMultiplier(
TEXT("r.Decal.FadeScreenSizeMult"),
1.0f,
TEXT("Control the per decal fade screen size. Multiplies with the per-decal screen size fade threshold.")
TEXT(" Smaller means decals fade less aggressively.")
);
static TAutoConsoleVariable<bool> CVarDecalVisibilityMultithreaded(
#Associated Variable and Callsites
This variable is associated with another variable named CVarDecalFadeScreenSizeMultiplier
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:17
Scope: file
Source code excerpt:
#include "Async/ParallelFor.h"
static TAutoConsoleVariable<float> CVarDecalFadeScreenSizeMultiplier(
TEXT("r.Decal.FadeScreenSizeMult"),
1.0f,
TEXT("Control the per decal fade screen size. Multiplies with the per-decal screen size fade threshold.")
TEXT(" Smaller means decals fade less aggressively.")
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:227
Scope (from outer to inner):
file
class class FDeferredDecalVS : public FGlobalShader
function IMPLEMENT_MATERIAL_SHADER_TYPE
Source code excerpt:
float GetDecalFadeScreenSizeMultiplier()
{
return CVarDecalFadeScreenSizeMultiplier.GetValueOnRenderThread();
}
float CalculateDecalFadeAlpha(float DecalFadeScreenSize, const FMatrix& ComponentToWorldMatrix, const FViewInfo& View, float FadeMultiplier)
{
check(View.IsPerspectiveProjection());