ShowFlag.VisualizeSSS

ShowFlag.VisualizeSSS

#Overview

name: ShowFlag.VisualizeSSS

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 ShowFlag.VisualizeSSS is to enable visualization of Subsurface Scattering (SSS) in Unreal Engine 5’s rendering pipeline. This setting is part of the post-processing system and is used for debugging and visual analysis of subsurface scattering effects in the scene.

Key points about ShowFlag.VisualizeSSS:

  1. It’s part of the Unreal Engine’s rendering subsystem, specifically the post-processing pipeline.

  2. The setting is controlled by the EngineShowFlags.VisualizeSSS flag.

  3. When enabled, it triggers a specific visualization pass in the post-processing chain.

  4. It’s used in conjunction with other visualization and debug tools in the engine.

  5. The value of this variable is set based on the EngineShowFlags, which can be toggled in the editor or through code.

  6. It affects how the primary screen percentage method is chosen, potentially forcing spatial upscaling instead of temporal methods when enabled.

  7. The visualization pass is added in the AddVisualizeSubsurfacePass function.

  8. It’s part of the EPass enum in the post-processing pipeline, indicating it’s a distinct rendering pass.

  9. The pass is only enabled when EngineShowFlags.VisualizeSSS is true.

Best practices when using this variable:

  1. Use it primarily for debugging and development purposes, not in shipping builds.

  2. Be aware that enabling this visualization may affect performance and change the appearance of the final rendered image.

  3. Consider disabling other post-processing effects when using this visualization to isolate the subsurface scattering effect.

  4. Remember to disable it when not needed, as it can interfere with normal rendering and other visualization modes.

  5. Use in conjunction with other visualization tools to get a comprehensive understanding of the rendering pipeline.

The associated variable VisualizeSSS shares the same purpose and is used interchangeably in the code. It’s likely an alias or a different representation of the same concept within the engine’s code base. The same considerations and best practices apply to its usage.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(1, SubsurfaceScattering, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "SubsurfaceScatteringSF", "Subsurface Scattering (Screen Space)"))
/** If Screen Space Subsurface Scattering visualization is enabled */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSSS, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSSSSF", "Subsurface Scattering (Screen Space)"))
/** Whether to apply volumetric lightmap lighting, when present. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VolumetricLightmap, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "VolumetricLightmapSF", "Volumetric Lightmap"))
/** If the indirect lighting cache is enabled, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(IndirectLightingCache, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "IndirectLightingCacheSF", "Indirect Lighting Cache"))
/** calls debug drawing for AIs */
SHOWFLAG_FIXED_IN_SHIPPING(0, DebugAI, SFG_Developer, NSLOCTEXT("UnrealEd", "DebugAISF", "AI Debug"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/SubsurfaceProfile.h:222

Scope (from outer to inner):

file
class        class FSubsurfaceProfileTexture : public FRenderResource

Source code excerpt:

	void Dump();

	// for debugging / VisualizeSSS
	ENGINE_API bool GetEntryString(uint32 Index, FString& Out) const;

	// @param InProfile must not be 0, game thread pointer, do not dereference, only for comparison
	// @return -1 if not found
	int32 FindAllocationId(const USubsurfaceProfile* InProfile) const;

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

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(1, SubsurfaceScattering, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "SubsurfaceScatteringSF", "Subsurface Scattering (Screen Space)"))
/** If Screen Space Subsurface Scattering visualization is enabled */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSSS, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSSSSF", "Subsurface Scattering (Screen Space)"))
/** Whether to apply volumetric lightmap lighting, when present. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VolumetricLightmap, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "VolumetricLightmapSF", "Volumetric Lightmap"))
/** If the indirect lighting cache is enabled, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(IndirectLightingCache, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "IndirectLightingCacheSF", "Indirect Lighting Cache"))
/** calls debug drawing for AIs */
SHOWFLAG_FIXED_IN_SHIPPING(0, DebugAI, SFG_Developer, NSLOCTEXT("UnrealEd", "DebugAISF", "AI Debug"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:485

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

	PassSequence.SetEnabled(EPass::VisualizeShadingModels, EngineShowFlags.VisualizeShadingModels);
	PassSequence.SetEnabled(EPass::VisualizeGBufferHints, EngineShowFlags.GBufferHints);
	PassSequence.SetEnabled(EPass::VisualizeSubsurface, EngineShowFlags.VisualizeSSS);
	PassSequence.SetEnabled(EPass::VisualizeGBufferOverview, bVisualizeGBufferOverview || bVisualizeGBufferDumpToFile || bVisualizeGBufferDumpToPIpe);
	PassSequence.SetEnabled(EPass::VisualizeLumenSceneOverview, (LumenVisualizeMode == VISUALIZE_MODE_OVERVIEW || LumenVisualizeMode == VISUALIZE_MODE_PERFORMANCE_OVERVIEW) && bPostProcessingEnabled);
	PassSequence.SetEnabled(EPass::VisualizeHDR, EngineShowFlags.VisualizeHDR);
	PassSequence.SetEnabled(EPass::VisualizeMotionVectors, EngineShowFlags.VisualizeMotionVectors || EngineShowFlags.VisualizeReprojection);
	PassSequence.SetEnabled(EPass::VisualizeTemporalUpscaler, EngineShowFlags.VisualizeTemporalUpscaler);
#if WITH_EDITOR

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:3154

Scope (from outer to inner):

file
function     void FSceneRenderer::PrepareViewRectsForRendering

Source code excerpt:

				(!IsTemporalAccumulationBasedMethod(View.AntiAliasingMethod) ||
				 ViewFamily.EngineShowFlags.VisualizeBuffer || 
				 ViewFamily.EngineShowFlags.VisualizeSSS))
			{
				View.PrimaryScreenPercentageMethod = EPrimaryScreenPercentageMethod::SpatialUpscale;
			}
		}

		check(View.ViewRect.Area() != 0);