ShowFlag.ReflectionEnvironment

ShowFlag.ReflectionEnvironment

#Overview

name: ShowFlag.ReflectionEnvironment

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

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.ReflectionEnvironment is to control the visibility of the Reflection Environment feature in Unreal Engine’s rendering system. This feature is responsible for local reflections from Reflection Capture actors, which contribute to the overall lighting and visual quality of the scene.

ShowFlag.ReflectionEnvironment is primarily used by the rendering system, specifically in the following subsystems and modules:

  1. Engine module
  2. Renderer module
  3. Composure plugin

The value of this variable is set in various places throughout the engine code, including:

  1. In the engine’s show flags initialization (ShowFlagsValues.inl)
  2. In rendering-specific functions that control visibility of different rendering features
  3. In the Composure plugin when setting up post-processing flags

This variable interacts with other rendering-related variables and systems, such as:

  1. ScreenSpaceReflections
  2. ReflectionCaptures
  3. LightingComponents (Diffuse and Specular)

Developers should be aware of the following when using this variable:

  1. It affects the visibility of local reflections in the scene.
  2. It can impact performance, as enabling reflection environment calculations can be computationally expensive.
  3. It interacts with other lighting and reflection systems, so changes to this flag may require adjustments to other related settings.

Best practices when using this variable include:

  1. Use it in conjunction with other reflection and lighting settings for optimal visual results.
  2. Consider performance implications when enabling or disabling this feature, especially on lower-end hardware.
  3. Test the visual impact of enabling/disabling this flag in different lighting scenarios to ensure desired results.

Regarding the associated variable ReflectionEnvironment:

The purpose of ReflectionEnvironment is the same as ShowFlag.ReflectionEnvironment. It is used interchangeably in different parts of the engine code to control the visibility and calculation of reflection environment features.

ReflectionEnvironment is used in similar subsystems and modules as ShowFlag.ReflectionEnvironment, including the Engine and Renderer modules.

The value of ReflectionEnvironment is typically set in the same places as ShowFlag.ReflectionEnvironment, often used as a direct reference to the show flag.

This variable interacts with the same systems as ShowFlag.ReflectionEnvironment, affecting reflection captures, screen space reflections, and overall lighting calculations.

Developers should be aware that ReflectionEnvironment and ShowFlag.ReflectionEnvironment are essentially the same thing, used in different contexts within the engine code.

Best practices for using ReflectionEnvironment are the same as those for ShowFlag.ReflectionEnvironment, focusing on balancing visual quality with performance considerations.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:129

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeTSR, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeTSRSF", "Temporal Super Resolution"))
/** Whether to display the Reflection Environment feature, which has local reflections from Reflection Capture actors, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(ReflectionEnvironment, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "ReflectionEnvironmentSF", "Reflection Environment"))
/** Visualize pixels that are outside of their object's bounding box (content error). */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeOutOfBoundsPixels, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeOutOfBoundsPixelsSF", "Out of Bounds Pixels"))
/** Whether to display the scene's diffuse. */
SHOWFLAG_FIXED_IN_SHIPPING(1, Diffuse, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "DiffuseSF", "Diffuse"))
/** Whether to display the scene's specular, including reflections. */
SHOWFLAG_ALWAYS_ACCESSIBLE(Specular, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "SpecularSF", "Specular"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Compositing/Composure/Source/Composure/Private/ComposureUtils.cpp:9

Scope (from outer to inner):

file
function     void FComposureUtils::SetEngineShowFlagsForPostprocessingOnly

Source code excerpt:

{
	EngineShowFlags.DynamicShadows = false;
	EngineShowFlags.ReflectionEnvironment = false;
	EngineShowFlags.ScreenSpaceReflections = false;
	EngineShowFlags.ScreenSpaceAO = false;
	EngineShowFlags.LightShafts = false;
	EngineShowFlags.Lighting = false;
	EngineShowFlags.DeferredLighting = false;
	EngineShowFlags.Decals = false;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:646

Scope (from outer to inner):

file
function     void EngineShowFlagOverride

Source code excerpt:

			 DISABLE_ENGINE_SHOWFLAG(Tonemapper)
			 DISABLE_ENGINE_SHOWFLAG(Refraction)
			 DISABLE_ENGINE_SHOWFLAG(ReflectionEnvironment)
			 DISABLE_ENGINE_SHOWFLAG(AmbientCubemap)
			 DISABLE_ENGINE_SHOWFLAG(MotionBlur)
			 DISABLE_ENGINE_SHOWFLAG(DirectLighting)
			 DISABLE_ENGINE_SHOWFLAG(Lighting)
			 DISABLE_ENGINE_SHOWFLAG(Translucency)
			 DISABLE_ENGINE_SHOWFLAG(TextRender)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:129

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeTSR, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeTSRSF", "Temporal Super Resolution"))
/** Whether to display the Reflection Environment feature, which has local reflections from Reflection Capture actors, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(ReflectionEnvironment, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "ReflectionEnvironmentSF", "Reflection Environment"))
/** Visualize pixels that are outside of their object's bounding box (content error). */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeOutOfBoundsPixels, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeOutOfBoundsPixelsSF", "Out of Bounds Pixels"))
/** Whether to display the scene's diffuse. */
SHOWFLAG_FIXED_IN_SHIPPING(1, Diffuse, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "DiffuseSF", "Diffuse"))
/** Whether to display the scene's specular, including reflections. */
SHOWFLAG_ALWAYS_ACCESSIBLE(Specular, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "SpecularSF", "Specular"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/CompositionLighting.cpp:69

Scope (from outer to inner):

file
function     static bool IsReflectionEnvironmentActive

Source code excerpt:

	// LPV & Screenspace Reflections : Reflection Environment active if either LPV (assumed true if this was called), Reflection Captures or SSR active

	bool IsReflectingEnvironment = View.Family->EngineShowFlags.ReflectionEnvironment;
	bool HasReflectionCaptures = (Scene->ReflectionSceneData.RegisteredReflectionCaptures.Num() > 0);
	bool HasSSR = View.Family->EngineShowFlags.ScreenSpaceReflections;

	return (Scene->GetFeatureLevel() >= ERHIFeatureLevel::SM5 && IsReflectingEnvironment && (HasReflectionCaptures || HasSSR) && !IsForwardShadingEnabled(View.GetShaderPlatform()));
}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:703

Scope (from outer to inner):

file
function     bool ShouldDoReflectionEnvironment

Source code excerpt:

	return IsReflectionEnvironmentAvailable(SceneFeatureLevel)
		&& Scene->ReflectionSceneData.RegisteredReflectionCaptures.Num()
		&& ViewFamily.EngineShowFlags.ReflectionEnvironment;
}

bool FSceneRenderer::ShouldPrepareForDistanceFieldAO() const
{
	bool bAnyViewHasGIMethodSupportingDFAO = AnyViewHasGIMethodSupportingDFAO();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:611

Scope (from outer to inner):

file
function     class FAmbientCubemapCompositePS : public FGlobalShader { /*ARE_GLOBAL_SHADER

Source code excerpt:

	FRHITexture* CubeArrayTexture = (SupportsTextureCubeArray(View.FeatureLevel))? GBlackCubeArrayTexture->TextureRHI : GBlackTextureCube->TextureRHI;

	if (View.Family->EngineShowFlags.ReflectionEnvironment
		&& SupportsTextureCubeArray(View.FeatureLevel)
		&& Scene
		&& Scene->ReflectionSceneData.CubemapArray.IsValid()
		&& Scene->ReflectionSceneData.RegisteredReflectionCaptures.Num())
	{
		CubeArrayTexture = Scene->ReflectionSceneData.CubemapArray.GetRenderTarget()->GetRHI();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:2086

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderDeferredReflectionsAndSkyLighting

Source code excerpt:

		if (bRequiresApply)
		{
			RDG_GPU_STAT_SCOPE(GraphBuilder, ReflectionEnvironment);

			FRDGTextureRef DynamicBentNormalAOTexture = DynamicBentNormalAOTextures.IsEmpty() ? nullptr : DynamicBentNormalAOTextures[CurrentViewIndex];

			if (Substrate::IsSubstrateEnabled())
			{
				AddSkyReflectionPass(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:5605

Scope (from outer to inner):

file
function     void FSceneRenderer::SetupSceneReflectionCaptureBuffer

Source code excerpt:

		View.FurthestReflectionCaptureDistance = 0.0f;

		if (View.Family->EngineShowFlags.ReflectionEnvironment 
			// Avoid feedback
			&& !View.bIsReflectionCapture)
		{
			View.NumBoxReflectionCaptures = Scene->ReflectionSceneData.NumBoxCaptures;
			View.NumSphereReflectionCaptures = Scene->ReflectionSceneData.NumSphereCaptures;