ShowFlag.Translucency

ShowFlag.Translucency

#Overview

name: ShowFlag.Translucency

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

It is referenced in 16 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.Translucency is to control the rendering of translucent objects in the Unreal Engine’s rendering pipeline. This setting variable is primarily used by the rendering system to determine whether translucent objects should be rendered or not.

Key points about ShowFlag.Translucency:

  1. It is part of the Unreal Engine’s rendering subsystem, specifically the FEngineShowFlags structure.

  2. It is used across various rendering modules and functions, including the mobile renderer, deferred shading renderer, and scene capture components.

  3. The value is typically set in the ViewFamily.EngineShowFlags structure and is checked in multiple places to determine if translucency should be rendered.

  4. It is considered an “always accessible” show flag, meaning it can be toggled even in shipping builds.

  5. It interacts with other rendering settings and view modes. For example, it is disabled in certain view modes like light complexity visualization.

  6. The variable is used in conjunction with other checks to determine if translucency should be rendered, such as the ShouldRenderTranslucency() function.

Best practices when using this variable:

  1. Be aware that toggling this flag can have a significant impact on rendering performance and visual quality.

  2. When developing custom rendering features, check this flag to ensure consistency with the engine’s translucency rendering behavior.

  3. In most cases, you should not manually set this flag unless you’re implementing custom rendering or debugging features.

  4. Be cautious when disabling translucency, as it may affect important visual elements in your scene.

Special considerations:

  1. Disabling translucency may improve performance but can significantly alter the visual appearance of a scene.

  2. Some rendering features or effects may depend on translucency being enabled to function correctly.

  3. In mobile rendering, the translucency pass is conditionally executed based on this flag and other factors.

  4. For scene capture components, this flag is exposed and can be controlled separately from the main view.

The associated variable “Translucency” is used in various parts of the code, often in conjunction with ShowFlag.Translucency. It is typically used to represent the translucency pass type or to access translucency-related resources. 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:199

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, BuilderBrush, SFG_Hidden, NSLOCTEXT("UnrealEd", "BuilderBrushSF", "Builder Brush"))
/** Render translucency, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Translucency, SFG_Normal, NSLOCTEXT("UnrealEd", "TranslucencySF", "Translucency"))
/** Draw billboard components */
SHOWFLAG_FIXED_IN_SHIPPING(1, BillboardSprites, SFG_Advanced, NSLOCTEXT("UnrealEd", "BillboardSpritesSF", "Billboard Sprites"))
/** Use LOD parenting, MinDrawDistance, etc. If disabled, will show LOD parenting lines */
SHOWFLAG_ALWAYS_ACCESSIBLE(LOD, SFG_Advanced, NSLOCTEXT("UnrealEd", "LODSF", "LOD Parenting"))
/** needed for VMI_LightComplexity */
SHOWFLAG_FIXED_IN_SHIPPING(0, LightComplexity, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightComplexitySF", "Light Complexity"))

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
function     void FComposureUtils::SetEngineShowFlagsForPostprocessingOnly

Source code excerpt:

	EngineShowFlags.DeferredLighting = false;
	EngineShowFlags.Decals = false;
	EngineShowFlags.Translucency = false;
	EngineShowFlags.AntiAliasing = false;
	EngineShowFlags.MotionBlur = false;
	EngineShowFlags.Bloom = false;
	EngineShowFlags.EyeAdaptation = false;
	EngineShowFlags.VolumetricFog = false;
	EngineShowFlags.Atmosphere = false;

#Loc: <Workspace>/Engine/Plugins/Enterprise/MDLImporter/Source/MDLImporter/Private/material/TranslucentMaterialFactory.cpp:73

Scope (from outer to inner):

file
namespace    Mat
function     void FTranslucentMaterialFactory::Create

Source code excerpt:

			// path length expression
			Expression = Generator::NewMaterialExpressionVectorParameter(&Material, TEXT("Local Bounds Adjustment"), FLinearColor(0.f, 0.f, 1.f));
			Generator::SetMaterialExpressionGroup(TEXT("Translucency"), Expression);
			MapCall = &FunctionLoader.Get(Generator::ECommonFunction::EstimateObjectThickness);
			UMaterialExpression* PathLengthExpression =
			    Generator::NewMaterialExpressionFunctionCall(&Material, MapCall, {{Expression, 0}, {Expression, 4}});

			// volume absorption color
			Expression = Generator::NewMaterialExpressionVectorParameter(&Material, TEXT("Surface Transmission Color"), FLinearColor(1.f, 1.f, 1.f));
			Generator::SetMaterialExpressionGroup(TEXT("Translucency"), Expression);
			Generator::SetMaterialExpressionGroup(TEXT("Translucency"), Parameters[EMaterialParameter::AbsorptionColor]);
			Generator::SetMaterialExpressionGroup(TEXT("Translucency"), Parameters[EMaterialParameter::IOR]);
			MapCall = &FunctionLoader.Get(Generator::ECommonFunction::VolumeAbsorptionColor);
			UMaterialExpression* VolumeAbsorptionExpression =
			    Generator::NewMaterialExpressionFunctionCall(&Material, MapCall,
			                                                 {{Parameters[EMaterialParameter::AbsorptionColor], 0},  //
			                                                  {Expression, 0},                                       //
			                                                  {Parameters[EMaterialParameter::IOR], 0},              //

#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterInfoRendering.cpp:647

Scope (from outer to inner):

file
namespace    UE::WaterInfo
function     static FSceneRenderer* CreateWaterInfoSceneRenderer

Source code excerpt:

	ShowFlags.Bloom = 0;
	ShowFlags.ScreenPercentage = 0;
	ShowFlags.Translucency = 0;
	ShowFlags.SeparateTranslucency = 0;
	ShowFlags.AntiAliasing = 0;
	ShowFlags.Fog = 0;
	ShowFlags.VolumetricFog = 0;
	ShowFlags.DynamicShadows = 0;

#Loc: <Workspace>/Engine/Source/Editor/MaterialEditor/Private/MaterialEditorDetailCustomization.cpp:904

Scope (from outer to inner):

file
function     void FMaterialDetailCustomization::CustomizeDetails

Source code excerpt:

	{
		DetailLayout.HideCategory( TEXT("TranslucencySelfShadowing") );
		DetailLayout.HideCategory( TEXT("Translucency") );
		DetailLayout.HideCategory( TEXT("Tessellation") );
		DetailLayout.HideCategory( TEXT("PostProcessMaterial") );
		DetailLayout.HideCategory( TEXT("Lightmass") );
		DetailLayout.HideCategory( TEXT("Thumbnail") );
		DetailLayout.HideCategory( TEXT("MaterialInterface") );
		DetailLayout.HideCategory( TEXT("PhysicalMaterial") );

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:7895

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:

			Input.DebugGroupName.ReplaceInline(TEXT("LightingPolicy"), TEXT("LP"));
			Input.DebugGroupName.ReplaceInline(TEXT("TranslucentLighting"), TEXT("TranslLight"));
			Input.DebugGroupName.ReplaceInline(TEXT("Translucency"), TEXT("Transl"));
			Input.DebugGroupName.ReplaceInline(TEXT("DistanceField"), TEXT("DistFiel"));
			Input.DebugGroupName.ReplaceInline(TEXT("Indirect"), TEXT("Ind"));
			Input.DebugGroupName.ReplaceInline(TEXT("Cached"), TEXT("Cach"));
			Input.DebugGroupName.ReplaceInline(TEXT("Inject"), TEXT("Inj"));
			Input.DebugGroupName.ReplaceInline(TEXT("Visualization"), TEXT("Viz"));
			Input.DebugGroupName.ReplaceInline(TEXT("Instanced"), TEXT("Inst"));

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

Scope (from outer to inner):

file
function     void EngineShowFlagOverride

Source code excerpt:

		if( ViewModeIndex == VMI_LightComplexity )
		{
			EngineShowFlags.Translucency = 0;
			EngineShowFlags.SetFog(false);
			EngineShowFlags.SetAtmosphere(false);
		}

		if (ViewModeIndex == VMI_PrimitiveDistanceAccuracy ||
			ViewModeIndex == VMI_MeshUVDensityAccuracy ||

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

Scope (from outer to inner):

file
function     void EngineShowFlagOverride

Source code excerpt:

			 DISABLE_ENGINE_SHOWFLAG(DirectLighting)
			 DISABLE_ENGINE_SHOWFLAG(Lighting)
			 DISABLE_ENGINE_SHOWFLAG(Translucency)
			 DISABLE_ENGINE_SHOWFLAG(TextRender)
			 DISABLE_ENGINE_SHOWFLAG(Particles)
			 DISABLE_ENGINE_SHOWFLAG(SkeletalMeshes)
			 DISABLE_ENGINE_SHOWFLAG(StaticMeshes)
			 DISABLE_ENGINE_SHOWFLAG(NaniteMeshes)
			 DISABLE_ENGINE_SHOWFLAG(BSP)

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

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, BuilderBrush, SFG_Hidden, NSLOCTEXT("UnrealEd", "BuilderBrushSF", "Builder Brush"))
/** Render translucency, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Translucency, SFG_Normal, NSLOCTEXT("UnrealEd", "TranslucencySF", "Translucency"))
/** Draw billboard components */
SHOWFLAG_FIXED_IN_SHIPPING(1, BillboardSprites, SFG_Advanced, NSLOCTEXT("UnrealEd", "BillboardSpritesSF", "Billboard Sprites"))
/** Use LOD parenting, MinDrawDistance, etc. If disabled, will show LOD parenting lines */
SHOWFLAG_ALWAYS_ACCESSIBLE(LOD, SFG_Advanced, NSLOCTEXT("UnrealEd", "LODSF", "LOD Parenting"))
/** needed for VMI_LightComplexity */
SHOWFLAG_FIXED_IN_SHIPPING(0, LightComplexity, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightComplexitySF", "Light Complexity"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Internal/TranslucentPassResource.h:76

Scope (from outer to inner):

file
function     inline FTranslucencyPassResources& Get

Source code excerpt:

	FTranslucencyPassResourcesMap(int32 NumViews);

	inline FTranslucencyPassResources& Get(int32 ViewIndex, ETranslucencyPass::Type Translucency)
	{
		return Array[ViewIndex][int32(Translucency)];
	};

	inline const FTranslucencyPassResources& Get(int32 ViewIndex, ETranslucencyPass::Type Translucency) const
	{
		check(ViewIndex < Array.Num());
		return Array[ViewIndex][int32(Translucency)];
	};

private:
	TArray<TStaticArray<FTranslucencyPassResources, ETranslucencyPass::TPT_MAX>, TInlineAllocator<4>> Array;
};

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Internal/TranslucentPassResource.h:106

Scope (from outer to inner):

file
function     inline const FTranslucencyPassResources& Get

Source code excerpt:

	}

	inline const FTranslucencyPassResources& Get(ETranslucencyPass::Type Translucency) const
	{
		check(IsValid());
		return TranslucencyPassResourcesMap->Get(ViewIndex, Translucency);
	};

private:
	const FTranslucencyPassResourcesMap* TranslucencyPassResourcesMap = nullptr;
	int32 ViewIndex = 0;
};

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileDistortionPass.cpp:32

Scope (from outer to inner):

file
function     bool IsMobileDistortionActive

Source code excerpt:

	return
		HDRMode == EMobileHDRMode::EnabledFloat16 &&
		View.Family->EngineShowFlags.Translucency &&
		bVisiblePrims &&
		FSceneRenderer::GetRefractionQuality(*View.Family) > 0 &&
		DisableDistortion == 0;
}

BEGIN_SHADER_PARAMETER_STRUCT(FMobileDistortionPassParameters, )

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileTranslucentRendering.cpp:6

Scope (from outer to inner):

file
function     void FMobileSceneRenderer::RenderTranslucency

Source code excerpt:

void FMobileSceneRenderer::RenderTranslucency(FRHICommandList& RHICmdList, const FViewInfo& View)
{	
	const bool bShouldRenderTranslucency = ShouldRenderTranslucency(StandardTranslucencyPass) && ViewFamily.EngineShowFlags.Translucency;
	if (bShouldRenderTranslucency)
	{
		CSV_SCOPED_TIMING_STAT_EXCLUSIVE(RenderTranslucency);
		SCOPE_CYCLE_COUNTER(STAT_TranslucencyDrawTime);
		SCOPED_DRAW_EVENT(RHICmdList, Translucency);
		SCOPED_GPU_STAT(RHICmdList, Translucency);

		RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);
		View.ParallelMeshDrawCommandPasses[StandardTranslucencyMeshPass].DispatchDraw(nullptr, RHICmdList, &TranslucencyInstanceCullingDrawParams);
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:503

Scope (from outer to inner):

file
function     FScreenPassTexture FTranslucencyComposition::AddPass

Source code excerpt:

	}

	RDG_GPU_STAT_SCOPE(GraphBuilder, Translucency);
	DynamicRenderScaling::FRDGScope DynamicTranslucencyResolutionScope(GraphBuilder, GDynamicTranslucencyResolution);

	const TCHAR* OpName = nullptr;
	FRHIBlendState* BlendState = nullptr;
	FRDGTextureRef NewSceneColor = nullptr;
	if (Operation == EOperation::UpscaleOnly)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:684

Scope (from outer to inner):

file
function     bool FSceneRenderer::ShouldRenderTranslucency

Source code excerpt:

bool FSceneRenderer::ShouldRenderTranslucency() const
{
	return  ViewFamily.EngineShowFlags.Translucency
		&& !ViewFamily.EngineShowFlags.VisualizeLightCulling
		&& !ViewFamily.UseDebugViewPS();
}

bool FSceneRenderer::ShouldRenderTranslucency(ETranslucencyPass::Type TranslucencyPass) const
{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:1515

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderTranslucency

Source code excerpt:

	}

	RDG_GPU_STAT_SCOPE(GraphBuilder, Translucency);
	DynamicRenderScaling::FRDGScope DynamicTranslucencyResolutionScope(GraphBuilder, GDynamicTranslucencyResolution);

	FRDGTextureRef SceneColorCopyTexture = nullptr;

	if (EnumHasAnyFlags(ViewsToRender, ETranslucencyView::AboveWater))
	{