ShowFlag.ReflectionOverride
ShowFlag.ReflectionOverride
#Overview
name: ShowFlag.ReflectionOverride
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 11
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.ReflectionOverride is to override all materials in the scene to display smooth, mirror-like reflections. This setting is primarily used for visualization and debugging purposes in the rendering system of Unreal Engine 5.
This setting variable is used by several Unreal Engine subsystems and modules, including:
- The core rendering system (Engine/Runtime/Renderer)
- The editor viewport (Engine/Source/Editor/UnrealEd)
- The game viewport (Engine/Runtime/Engine)
- Various plugins such as Composure, MovieRenderPipeline, and nDisplay
The value of this variable is typically set through the engine’s show flags system, which allows toggling various rendering features on and off. It’s often controlled via the editor UI or programmatically in code.
This variable interacts with several other rendering parameters, particularly:
- DiffuseOverrideParameter
- SpecularOverrideParameter
- NormalOverrideParameter
- RoughnessOverrideParameter
When ReflectionOverride is enabled, these parameters are set to specific values to achieve the mirror-like reflection effect.
Developers should be aware that:
- This flag is primarily for visualization and debugging, not for final rendering in shipping builds.
- It overrides material properties globally, which can significantly change the appearance of the scene.
- It may impact performance, as it changes how materials are rendered.
Best practices when using this variable include:
- Use it temporarily for debugging or specific visualization needs.
- Be cautious when enabling it in production code, as it can drastically alter the scene’s appearance.
- Remember to disable it when it’s no longer needed to avoid unintended visual effects.
The associated variable ReflectionOverride shares the same value and purpose as ShowFlag.ReflectionOverride. It’s used in the same contexts and with the same considerations. The main difference is in how it’s accessed - ShowFlag.ReflectionOverride is typically used when working with the engine’s show flags system, while ReflectionOverride might be used directly in some code paths for the same purpose.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:61
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, LightingOnlyOverride, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightingOnlyOverrideSF", "Lighting Only"))
/** needed for VMI_ReflectionOverride, Whether to override all materials to be smooth, mirror reflections. */
SHOWFLAG_FIXED_IN_SHIPPING(0, ReflectionOverride, SFG_Hidden, NSLOCTEXT("UnrealEd", "ReflectionOverrideSF", "Reflections"))
/** needed for VMI_VisualizeBuffer, Whether to enable the buffer visualization mode. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeBuffer, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeBufferSF", "Buffer Visualization"))
/** Needed for VMI_VisualizeNanite, Whether to enable the Nanite visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeNanite, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeNaniteSF", "Nanite Visualization"))
/** Needed for VMI_VisualizeLumen, Whether to enable the Lumen visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeLumen, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLumenSF", "Lumen Visualization"))
#Associated Variable and Callsites
This variable is associated with another variable named ReflectionOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Compositing/Composure/Source/Composure/Private/ComposureUtils.cpp:27
Scope (from outer to inner):
file
function void FComposureUtils::SetEngineShowFlagsForPostprocessingOnly
Source code excerpt:
#if !UE_BUILD_OPTIMIZED_SHOWFLAGS
// Development-only flags
EngineShowFlags.ReflectionOverride = false;
EngineShowFlags.DepthOfField = false;
#endif
}
// static
FVector2D FComposureUtils::GetRedGreenUVFactorsFromChromaticAberration(float ChromaticAberrationAmount)
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineRenderPasses/Private/MoviePipelineImagePassBase.cpp:427
Scope (from outer to inner):
file
function void UMoviePipelineImagePassBase::SetupViewForViewModeOverride
Source code excerpt:
View->SpecularOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
}
else if (View->Family->EngineShowFlags.ReflectionOverride)
{
View->DiffuseOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
View->SpecularOverrideParameter = FVector4f(1, 1, 1, 0.0f);
View->NormalOverrideParameter = FVector4f(0, 0, 1, 0.0f);
View->RoughnessOverrideParameter = FVector2D(0.0f, 0.0f);
}
#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayCluster/Private/Game/EngineClasses/Basics/DisplayClusterViewportClient.cpp:614
Scope (from outer to inner):
file
function void UDisplayClusterViewportClient::Draw
Source code excerpt:
View->SpecularOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
}
else if (View->Family->EngineShowFlags.ReflectionOverride)
{
View->DiffuseOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
View->SpecularOverrideParameter = FVector4f(1, 1, 1, 0.0f);
View->NormalOverrideParameter = FVector4f(0, 0, 1, 0.0f);
View->RoughnessOverrideParameter = FVector2D(0.0f, 0.0f);
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:4036
Scope (from outer to inner):
file
function void FEditorViewportClient::SetupViewForRendering
Source code excerpt:
View.SpecularOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
}
else if (ViewFamily.EngineShowFlags.ReflectionOverride)
{
View.DiffuseOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
View.SpecularOverrideParameter = FVector4f(1, 1, 1, 0.0f);
View.NormalOverrideParameter = FVector4f(0, 0, 1, 0.0f);
View.RoughnessOverrideParameter = FVector2D(0.0f, 0.0f);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp:1628
Scope (from outer to inner):
file
function void UGameViewportClient::Draw
Source code excerpt:
View->SpecularOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
}
else if (View->Family->EngineShowFlags.ReflectionOverride)
{
View->DiffuseOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
View->SpecularOverrideParameter = FVector4f(1, 1, 1, 0.0f);
View->NormalOverrideParameter = FVector4f(0, 0, 1, 0.0f);
View->RoughnessOverrideParameter = FVector2D(0.0f, 0.0f);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:783
Scope: file
Source code excerpt:
return VMI_LightingOnly;
}
else if (EngineShowFlags.ReflectionOverride)
{
return VMI_ReflectionOverride;
}
else if (EngineShowFlags.Wireframe)
{
if (EngineShowFlags.Brushes)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:61
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, LightingOnlyOverride, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightingOnlyOverrideSF", "Lighting Only"))
/** needed for VMI_ReflectionOverride, Whether to override all materials to be smooth, mirror reflections. */
SHOWFLAG_FIXED_IN_SHIPPING(0, ReflectionOverride, SFG_Hidden, NSLOCTEXT("UnrealEd", "ReflectionOverrideSF", "Reflections"))
/** needed for VMI_VisualizeBuffer, Whether to enable the buffer visualization mode. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeBuffer, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeBufferSF", "Buffer Visualization"))
/** Needed for VMI_VisualizeNanite, Whether to enable the Nanite visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeNanite, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeNaniteSF", "Nanite Visualization"))
/** Needed for VMI_VisualizeLumen, Whether to enable the Lumen visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeLumen, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLumenSF", "Lumen Visualization"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:1184
Scope (from outer to inner):
file
function void FSceneRenderer::GatherAndSortLights
Source code excerpt:
if (LightSceneInfo->ShouldRenderLightViewIndependent()
// Reflection override skips direct specular because it tends to be blindingly bright with a perfectly smooth surface
&& !ViewFamily.EngineShowFlags.ReflectionOverride)
{
// Check if the light is visible in any of the views.
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
if (LightSceneInfo->ShouldRenderLight(Views[ViewIndex]))
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:684
Scope (from outer to inner):
file
function static void PreparePathTracingData
Source code excerpt:
ShowFlags.LightingOnlyOverride != 0 ||
ShowFlags.OverrideDiffuseAndSpecular != 0 ||
ShowFlags.ReflectionOverride != 0;
PathTracingData.EnabledDirectLightingContributions = 0;
if (ShowFlags.DirectLighting != 0)
{
PathTracingData.EnabledDirectLightingContributions |= (PPV.PathTracingIncludeEmissive != 0 ) ? PATHTRACER_CONTRIBUTION_EMISSIVE : 0;
PathTracingData.EnabledDirectLightingContributions |= (PPV.PathTracingIncludeDiffuse != 0 && ShowFlags.Diffuse != 0) ? PATHTRACER_CONTRIBUTION_DIFFUSE : 0;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:2498
Scope: file
Source code excerpt:
Config.LightShowFlags |= View.Family->EngineShowFlags.OverrideDiffuseAndSpecular ? 1 << 10 : 0;
Config.LightShowFlags |= View.Family->EngineShowFlags.LightingOnlyOverride ? 1 << 11 : 0;
Config.LightShowFlags |= View.Family->EngineShowFlags.ReflectionOverride ? 1 << 12 : 0;
Config.LightShowFlags |= View.Family->EngineShowFlags.SubsurfaceScattering ? 1 << 13 : 0;
// the following affects which material shaders get used and therefore change the image
if (Substrate::IsSubstrateEnabled() && CVarPathTracingSubstrateCompileSimplifiedMaterial.GetValueOnRenderThread() != 0)
{
Config.LightShowFlags |= CVarPathTracingSubstrateUseSimplifiedMaterial.GetValueOnRenderThread() != 0 ? 1 << 14 : 0;
}