ShowFlag.LightingOnlyOverride
ShowFlag.LightingOnlyOverride
#Overview
name: ShowFlag.LightingOnlyOverride
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 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.LightingOnlyOverride is to control the Lighting Only view mode in Unreal Engine’s rendering system. This setting is used to override material diffuse properties with constants, specifically for the Lighting Only viewmode.
This setting variable is primarily used in the rendering system of Unreal Engine. It is referenced in various subsystems and modules, including:
- The core Engine module
- The Renderer module
- The MovieRenderPipeline plugin
- The nDisplay plugin
- The UnrealEd module (for editor viewports)
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 not explicitly shown where the value is set in the provided code snippets, but it’s likely controlled through user interface options or programmatically in other parts of the engine.
This variable interacts with several other variables and systems:
- It’s often used in conjunction with DiffuseOverrideParameter and SpecularOverrideParameter to modify material properties.
- It affects the ViewMode (VMI) selection in the engine.
- It’s used in path tracing calculations to determine if diffuse and specular overrides should be applied.
Developers should be aware that:
- This variable is primarily used for debugging and visualization purposes.
- It can significantly alter the appearance of materials in the scene.
- It’s not intended for use in shipping builds, as indicated by the SHOWFLAG_FIXED_IN_SHIPPING macro.
Best practices when using this variable include:
- Use it only for debugging and scene analysis purposes.
- Be aware of its impact on material appearance and overall scene lighting.
- Remember to disable it when not needed, as it can affect performance and visual fidelity.
The associated variable LightingOnlyOverride is essentially the same as ShowFlag.LightingOnlyOverride. It’s used in the same context and for the same purpose. The difference is in how it’s accessed - usually through View->Family->EngineShowFlags.LightingOnlyOverride instead of directly as a ShowFlag. The same considerations and best practices apply to this associated variable.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:59
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, OverrideDiffuseAndSpecular, SFG_Hidden, NSLOCTEXT("UnrealEd", "OverrideDiffuseAndSpecularSF", "Override Diffuse And Specular"))
/** needed for VMI_LightingOnly, Whether to override material diffuse with constants, used by the Lighting Only viewmode. */
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"))
#Associated Variable and Callsites
This variable is associated with another variable named LightingOnlyOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineRenderPasses/Private/MoviePipelineImagePassBase.cpp:422
Scope (from outer to inner):
file
function void UMoviePipelineImagePassBase::SetupViewForViewModeOverride
Source code excerpt:
View->SpecularOverrideParameter = FVector4f(.1f, .1f, .1f, 0.0f);
}
else if (View->Family->EngineShowFlags.LightingOnlyOverride)
{
View->DiffuseOverrideParameter = FVector4f(GEngine->LightingOnlyBrightness.R, GEngine->LightingOnlyBrightness.G, GEngine->LightingOnlyBrightness.B, 0.0f);
View->SpecularOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
}
else if (View->Family->EngineShowFlags.ReflectionOverride)
{
#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayCluster/Private/Game/EngineClasses/Basics/DisplayClusterViewportClient.cpp:609
Scope (from outer to inner):
file
function void UDisplayClusterViewportClient::Draw
Source code excerpt:
View->SpecularOverrideParameter = FVector4f(.1f, .1f, .1f, 0.0f);
}
else if (View->Family->EngineShowFlags.LightingOnlyOverride)
{
View->DiffuseOverrideParameter = FVector4f(GEngine->LightingOnlyBrightness.R, GEngine->LightingOnlyBrightness.G, GEngine->LightingOnlyBrightness.B, 0.0f);
View->SpecularOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
}
else if (View->Family->EngineShowFlags.ReflectionOverride)
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:4031
Scope (from outer to inner):
file
function void FEditorViewportClient::SetupViewForRendering
Source code excerpt:
View.SpecularOverrideParameter = FVector4f(.1f, .1f, .1f, 0.0f);
}
else if (ViewFamily.EngineShowFlags.LightingOnlyOverride)
{
View.DiffuseOverrideParameter = FVector4f(GEngine->LightingOnlyBrightness.R, GEngine->LightingOnlyBrightness.G, GEngine->LightingOnlyBrightness.B, 0.0f);
View.SpecularOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
}
else if (ViewFamily.EngineShowFlags.ReflectionOverride)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp:1623
Scope (from outer to inner):
file
function void UGameViewportClient::Draw
Source code excerpt:
View->SpecularOverrideParameter = FVector4f(.1f, .1f, .1f, 0.0f);
}
else if (View->Family->EngineShowFlags.LightingOnlyOverride)
{
View->DiffuseOverrideParameter = FVector4f(GEngine->LightingOnlyBrightness.R, GEngine->LightingOnlyBrightness.G, GEngine->LightingOnlyBrightness.B, 0.0f);
View->SpecularOverrideParameter = FVector4f(0.f, 0.f, 0.f, 0.f);
}
else if (View->Family->EngineShowFlags.ReflectionOverride)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:779
Scope: file
Source code excerpt:
return VMI_Lit_DetailLighting;
}
else if (EngineShowFlags.LightingOnlyOverride)
{
return VMI_LightingOnly;
}
else if (EngineShowFlags.ReflectionOverride)
{
return VMI_ReflectionOverride;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:59
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, OverrideDiffuseAndSpecular, SFG_Hidden, NSLOCTEXT("UnrealEd", "OverrideDiffuseAndSpecularSF", "Override Diffuse And Specular"))
/** needed for VMI_LightingOnly, Whether to override material diffuse with constants, used by the Lighting Only viewmode. */
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"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:682
Scope (from outer to inner):
file
function static void PreparePathTracingData
Source code excerpt:
// NOTE: Diffuse and Specular show flags also modify the override colors, but we prefer to tie those to the lighting contribution mechanism below which is more principled
PathTracingData.ApplyDiffuseSpecularOverrides =
ShowFlags.LightingOnlyOverride != 0 ||
ShowFlags.OverrideDiffuseAndSpecular != 0 ||
ShowFlags.ReflectionOverride != 0;
PathTracingData.EnabledDirectLightingContributions = 0;
if (ShowFlags.DirectLighting != 0)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:2497
Scope: file
Source code excerpt:
Config.LightShowFlags |= View.Family->EngineShowFlags.Specular ? 1 << 9 : 0;
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;