ShowFlag.Decals

ShowFlag.Decals

#Overview

name: ShowFlag.Decals

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

It is referenced in 47 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.Decals is to control the visibility of decals in the rendering pipeline of Unreal Engine 5. Decals are a rendering technique used to apply detail to surfaces without modifying the underlying geometry. Here’s a breakdown of its usage and implications:

  1. The ShowFlag.Decals setting is primarily used in the rendering system to determine whether decals should be rendered or not.

  2. Multiple Unreal Engine subsystems and modules rely on this setting, including:

    • The main rendering pipeline
    • Mobile rendering
    • Ray tracing
    • Path tracing
    • Deferred shading
    • Variable Rate Shading (VRS)
  3. The value of this variable is typically set through the engine’s show flags system, which allows toggling various rendering features on and off.

  4. Several other variables interact with ShowFlag.Decals:

    • Decals: This is an associated variable that often shares the same value as ShowFlag.Decals.
    • EngineShowFlags.Decals: This is likely the underlying engine show flag that controls the decal visibility.
  5. Developers should be aware of the following when using this variable:

    • Disabling decals can improve performance but at the cost of visual fidelity.
    • The decal system interacts with various rendering passes, including base pass, deferred shading, and ray tracing.
    • Decals are rendered in different stages depending on their blend mode and the rendering path being used.
  6. Best practices when using this variable include:

    • Use it for debugging or performance optimization when necessary.
    • Be aware that disabling decals may significantly change the visual appearance of a scene.
    • Consider the impact on different rendering paths (forward, deferred, mobile, ray tracing) when toggling this flag.

Regarding the associated variable ‘Decals’:

The purpose of the ‘Decals’ variable is to store and manage the list of decal proxies in the scene. It is closely related to ShowFlag.Decals but serves a different purpose:

  1. It is used by the scene management system to keep track of all decals that need to be rendered.

  2. This variable is primarily used in the scene rendering and management subsystems.

  3. The value of this variable is set and modified through scene management functions like AddOrRemoveDecal_RenderThread.

  4. It interacts with various rendering systems that need to process decals, such as the deferred decal rendering pass and ray tracing systems.

  5. Developers should be aware that:

    • Adding or removing decals can trigger a path-traced output invalidation.
    • The decal list is used in various rendering passes and can affect performance.
  6. Best practices include:

    • Efficiently managing the decal list to avoid unnecessary performance overhead.
    • Being mindful of the number of decals in a scene, as they can impact rendering performance.
    • Properly handling decal addition and removal to ensure scene consistency.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(AmbientOcclusion, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "AmbientOcclusionSF", "Ambient Occlusion"))
/** Decal rendering, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Decals, SFG_Normal, NSLOCTEXT("UnrealEd", "DecalsSF", "Decals"))
/** like bloom dirt mask */
SHOWFLAG_FIXED_IN_SHIPPING(1, CameraImperfections, SFG_PostProcess, NSLOCTEXT("UnrealEd", "CameraImperfectionsSF", "Camera Imperfections"))
/** to allow to disable visualizetexture for some editor rendering (e.g. thumbnail rendering) */
SHOWFLAG_ALWAYS_ACCESSIBLE(OnScreenDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "OnScreenDebugSF", "On Screen Debug"))
/** needed for VMI_Lit_DetailLighting, Whether to override material diffuse and specular with constants, used by the Detail Lighting viewmode. */
SHOWFLAG_FIXED_IN_SHIPPING(0, OverrideDiffuseAndSpecular, SFG_Hidden, NSLOCTEXT("UnrealEd", "OverrideDiffuseAndSpecularSF", "Override Diffuse And Specular"))

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
function     void FComposureUtils::SetEngineShowFlagsForPostprocessingOnly

Source code excerpt:

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

#Loc: <Workspace>/Engine/Source/Editor/SequenceRecorder/Private/SequenceRecorderModule.cpp:195

Scope (from outer to inner):

file
class        class FSequenceRecorderModule : public ISequenceRecorder, private FSelfRegisteringExec
function     virtual void StartupModule

Source code excerpt:


			// register for debug drawing
			DrawDebugDelegateHandle = UDebugDrawService::Register(TEXT("Decals"), FDebugDrawDelegate::CreateStatic(&FSequenceRecorderModule::DrawDebug));

			// register details customization
			FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
			PropertyModule.RegisterCustomClassLayout(UActorRecording::StaticClass()->GetFName(), FOnGetDetailCustomizationInstance::CreateStatic(&FActorRecordingDetailsCustomization::MakeInstance));
			PropertyModule.RegisterCustomClassLayout(USequenceRecorderSettings::StaticClass()->GetFName(), FOnGetDetailCustomizationInstance::CreateStatic(&FSequenceRecorderDetailsCustomization::MakeInstance));
			PropertyModule.RegisterCustomPropertyTypeLayout(FPropertiesToRecordForClass::StaticStruct()->GetFName(), FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FPropertiesToRecordForClassDetailsCustomization::MakeInstance));

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

Scope (from outer to inner):

file
function     void EngineShowFlagOverride

Source code excerpt:

			 DISABLE_ENGINE_SHOWFLAG(AmbientOcclusion)
			 DISABLE_ENGINE_SHOWFLAG(CameraImperfections)
			 DISABLE_ENGINE_SHOWFLAG(Decals)
			 DISABLE_ENGINE_SHOWFLAG(LensFlares)
			 DISABLE_ENGINE_SHOWFLAG(Bloom)
			 DISABLE_ENGINE_SHOWFLAG(ColorGrading)
			 DISABLE_ENGINE_SHOWFLAG(Tonemapper)
			 DISABLE_ENGINE_SHOWFLAG(Refraction)
			 DISABLE_ENGINE_SHOWFLAG(ReflectionEnvironment)

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

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(AmbientOcclusion, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "AmbientOcclusionSF", "Ambient Occlusion"))
/** Decal rendering, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Decals, SFG_Normal, NSLOCTEXT("UnrealEd", "DecalsSF", "Decals"))
/** like bloom dirt mask */
SHOWFLAG_FIXED_IN_SHIPPING(1, CameraImperfections, SFG_PostProcess, NSLOCTEXT("UnrealEd", "CameraImperfectionsSF", "Camera Imperfections"))
/** to allow to disable visualizetexture for some editor rendering (e.g. thumbnail rendering) */
SHOWFLAG_ALWAYS_ACCESSIBLE(OnScreenDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "OnScreenDebugSF", "On Screen Debug"))
/** needed for VMI_Lit_DetailLighting, Whether to override material diffuse and specular with constants, used by the Detail Lighting viewmode. */
SHOWFLAG_FIXED_IN_SHIPPING(0, OverrideDiffuseAndSpecular, SFG_Hidden, NSLOCTEXT("UnrealEd", "OverrideDiffuseAndSpecularSF", "Override Diffuse And Specular"))

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

Scope (from outer to inner):

file
function     FCompositionLighting::FCompositionLighting

Source code excerpt:

		if (bEnableDecals)
		{
			VisibleDecals[Index] = DecalRendering::BuildVisibleDecalList(Scene.Decals, Views[Index]);
		}
	}
}

void FCompositionLighting::TryInit()
{

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

Scope (from outer to inner):

file
function     bool AreDecalsEnabled

Source code excerpt:

bool AreDecalsEnabled(const FSceneViewFamily& ViewFamily)
{
	return ViewFamily.EngineShowFlags.Decals && !ViewFamily.EngineShowFlags.VisualizeLightCulling;
}

bool IsDBufferEnabled(const FSceneViewFamily& ViewFamily, EShaderPlatform ShaderPlatform)
{
	return IsUsingDBuffers(ShaderPlatform)
		&& AreDecalsEnabled(ViewFamily)

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

Scope (from outer to inner):

file
function     void GetDeferredDecalPassParameters

Source code excerpt:


	FRenderTargetBindingSlots& RenderTargets = PassParameters.RenderTargets;
	PassParameters.RenderTargets.ShadingRateTexture = GVRSImageManager.GetVariableRateShadingImage(GraphBuilder, View, FVariableRateShadingImageManager::EVRSPassType::Decals);

	uint32 ColorTargetIndex = 0;

	const auto AddColorTarget = [&](FRDGTextureRef Texture, ERenderTargetLoadAction LoadAction = ERenderTargetLoadAction::ELoad)
	{
		checkf(Texture, TEXT("Attempting to bind decal render targets, but the texture is null."));

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

Scope (from outer to inner):

file
function     void AddDeferredDecalPass

Source code excerpt:

	// Debug view framework does not yet support decals.
	// todo: Handle shader complexity mode here for deferred decal.
	if (!ViewFamily.EngineShowFlags.Decals || ViewFamily.UseDebugViewPS())
	{
		return;
	}

	const FScene& Scene = *(FScene*)ViewFamily.Scene;
	const EShaderPlatform ShaderPlatform = View.GetShaderPlatform();
	const ERHIFeatureLevel::Type FeatureLevel = View.GetFeatureLevel();
	const uint32 MeshDecalCount = View.MeshDecalBatches.Num();
	const uint32 DecalCount = Scene.Decals.Num();
	uint32 SortedDecalCount = 0;
	FTransientDecalRenderDataList* SortedDecals = nullptr;

	checkf(DecalRenderStage != EDecalRenderStage::AmbientOcclusion || PassTextures.ScreenSpaceAO, TEXT("Attepting to render AO decals without SSAO having emitted a valid render target."));
	checkf(DecalRenderStage != EDecalRenderStage::BeforeBasePass || IsUsingDBuffers(ShaderPlatform), TEXT("Only DBuffer decals are supported before the base pass."));

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:249

Scope (from outer to inner):

file
class        class FDeferredDecalVS : public FGlobalShader
function     IMPLEMENT_MATERIAL_SHADER_TYPE

Source code excerpt:

	}

	void SortDecalList(FTransientDecalRenderDataList& Decals)
	{
		// Sort by sort order to allow control over composited result
		// Then sort decals by state to reduce render target switches
		// Also sort by component since Sort() is not stable
		struct FCompareFTransientDecalRenderData
		{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:283

Scope (from outer to inner):

file
class        class FDeferredDecalVS : public FGlobalShader
function     IMPLEMENT_MATERIAL_SHADER_TYPE

Source code excerpt:


		// Sort decals by blend mode to reduce render target switches
		Decals.Sort(FCompareFTransientDecalRenderData());
	}

	static bool ProcessDecal(const FDeferredDecalProxy* DecalProxy, const FViewInfo& View, float FadeMultiplier, EShaderPlatform ShaderPlatform, bool bIsPerspectiveProjection, FTransientDecalRenderData& OutData)
	{
		if (!DecalProxy->DecalMaterial || !DecalProxy->DecalMaterial->IsValidLowLevelFast())
		{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:331

Scope (from outer to inner):

file
function     FTransientDecalRenderDataList BuildVisibleDecalList

Source code excerpt:

	};

	FTransientDecalRenderDataList BuildVisibleDecalList(TConstArrayView<FDeferredDecalProxy*> Decals, const FViewInfo& View)
	{
		QUICK_SCOPE_CYCLE_COUNTER(BuildVisibleDecalList);

		// Don't draw for shader complexity mode.
		// todo: Handle shader complexity mode for deferred decal.
		if (View.Family->EngineShowFlags.ShaderComplexity)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:363

Scope (from outer to inner):

file
function     FTransientDecalRenderDataList BuildVisibleDecalList

Source code excerpt:

				TEXT("BuildVisibleDecalList_Parallel"),
				Contexts,
				Decals.Num(),
				MinBatchSize,
				[Decals, &View, ShaderPlatform, bIsPerspectiveProjection, FadeMultiplier](FVisibleDecalListContext& Context, int32 ItemIndex)
				{
					FTaskTagScope TaskTagScope(ETaskTag::EParallelRenderingThread);

					const FDeferredDecalProxy* DecalProxy = Decals[ItemIndex];

					FTransientDecalRenderData Data;

					if (ProcessDecal(DecalProxy, View, FadeMultiplier, ShaderPlatform, bIsPerspectiveProjection, Data))
					{
						Context.VisibleDecals.AddElement(MoveTemp(Data));

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:400

Scope (from outer to inner):

file
function     FTransientDecalRenderDataList BuildVisibleDecalList

Source code excerpt:

		else
		{
			for (const FDeferredDecalProxy* DecalProxy : Decals)
			{
				FTransientDecalRenderData Data;

				if (ProcessDecal(DecalProxy, View, FadeMultiplier, ShaderPlatform, bIsPerspectiveProjection, Data))
				{
					OutVisibleDecals.Add(MoveTemp(Data));

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.cpp:414

Scope (from outer to inner):

file
function     bool BuildRelevantDecalList

Source code excerpt:

	}

	bool BuildRelevantDecalList(TConstArrayView<FTransientDecalRenderData> Decals, EDecalRenderStage DecalRenderStage, FTransientDecalRenderDataList* OutVisibleDecals)
	{
		QUICK_SCOPE_CYCLE_COUNTER(BuildRelevantDecalList);

		if (OutVisibleDecals)
		{
			OutVisibleDecals->Empty(Decals.Num());
		}

		// Build a list of decals that need to be rendered for this stage in SortedDecals
		for (const FTransientDecalRenderData& DecalRenderData : Decals)
		{
			checkf(DecalRenderData.Proxy->DecalMaterial && DecalRenderData.Proxy->DecalMaterial->IsValidLowLevelFast(),
				TEXT("Decals should've been filtered earlier in BuildVisibleDecalList(...)"));

			if (IsCompatibleWithRenderStage(DecalRenderData.BlendDesc, DecalRenderStage))
			{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DecalRenderingShared.h:39

Scope (from outer to inner):

file
namespace    DecalRendering

Source code excerpt:

	FMatrix ComputeComponentToClipMatrix(const FViewInfo& View, const FMatrix& DecalComponentToWorld);
	void SetVertexShaderOnly(FRHICommandList& RHICmdList, FGraphicsPipelineStateInitializer& GraphicsPSOInit, const FViewInfo& View, const FMatrix& FrustumComponentToClip);
	void SortDecalList(FTransientDecalRenderDataList& Decals);
	FTransientDecalRenderDataList BuildVisibleDecalList(TConstArrayView<FDeferredDecalProxy*> Decals, const FViewInfo& View);
	bool BuildRelevantDecalList(TConstArrayView<FTransientDecalRenderData> Decals, EDecalRenderStage DecalRenderStage, FTransientDecalRenderDataList* OutVisibleDecals);
	bool SetupShaderState(ERHIFeatureLevel::Type FeatureLevel, const FMaterial& Material, EDecalRenderStage DecalRenderStage, FBoundShaderStateInput& OutBoundShaderState);
	void SetShader(FRHICommandList& RHICmdList, FGraphicsPipelineStateInitializer& GraphicsPSOInit, uint32 StencilRef, const FViewInfo& View, const FTransientDecalRenderData& DecalData, EDecalRenderStage DecalRenderStage, const FMatrix& FrustumComponentToClip);
};

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:570

Scope: file

Source code excerpt:

	}

	if (Scene.Decals.Num() == 0 || RayTracing::ShouldExcludeDecals())
	{
		return false;
	}

	return ViewFamily.EngineShowFlags.PathTracing && PathTracing::UsesDecals(ViewFamily);
}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:1752

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::Render

Source code excerpt:

				View.RayTracingDecalUniformBuffer = CreateRayTracingDecalData(GraphBuilder, *Scene, View, RayTracingScene.NumCallableShaderSlots);
				View.bHasRayTracingDecals = true;
				RayTracingScene.NumCallableShaderSlots += Scene->Decals.Num();
			}
		}
		else
		{
			TRDGUniformBufferRef<FRayTracingDecals> NullRayTracingDecalUniformBuffer = CreateNullRayTracingDecalsUniformBuffer(GraphBuilder);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileDecalRendering.cpp:46

Scope (from outer to inner):

file
function     void FMobileSceneRenderer::RenderDecals

Source code excerpt:

void FMobileSceneRenderer::RenderDecals(FRHICommandList& RHICmdList, const FViewInfo& View, const FInstanceCullingDrawParams* InstanceCullingDrawParams)
{
	if (!DoesPlatformSupportDecals(View.GetShaderPlatform()) || !ViewFamily.EngineShowFlags.Decals || View.bIsPlanarReflection)
	{
		return;
	}

	CSV_SCOPED_TIMING_STAT_EXCLUSIVE(RenderDecals);
	SCOPE_CYCLE_COUNTER(STAT_DecalsDrawTime);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileDecalRendering.cpp:59

Scope (from outer to inner):

file
function     void FMobileSceneRenderer::RenderDecals

Source code excerpt:


	// Deferred decals
	if (Scene->Decals.Num() > 0)
	{
		SCOPED_DRAW_EVENT(RHICmdList, Decals);
		RenderDeferredDecalsMobile(RHICmdList, *Scene, View, DecalRenderStage, RenderTargetMode);
	}

	// Mesh decals
	if (View.MeshDecalBatches.Num() > 0)
	{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileDecalRendering.cpp:87

Scope (from outer to inner):

file
function     void RenderDeferredDecalsMobile

Source code excerpt:

	FTransientDecalRenderDataList SortedDecals;

	if (!Scene.Decals.IsEmpty())
	{
		FTransientDecalRenderDataList VisibleDecals = DecalRendering::BuildVisibleDecalList(Scene.Decals, View);

		// Build a list of decals that need to be rendered for this view
		DecalRendering::BuildRelevantDecalList(VisibleDecals, DecalRenderStage, &SortedDecals);
		SortedDecalCount = SortedDecals.Num();
		INC_DWORD_STAT_BY(STAT_Decals, SortedDecalCount);
	}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileDecalRendering.cpp:166

Scope (from outer to inner):

file
function     void FMobileSceneRenderer::RenderDBuffer

Source code excerpt:

		}

		FTransientDecalRenderDataList VisibleDecals = DecalRendering::BuildVisibleDecalList(Scene->Decals, View);

		FDeferredDecalPassTextures DecalPassTextures = GetDeferredDecalPassTextures(GraphBuilder, View, SceneTextures, &DBufferTextures);
		AddDeferredDecalPass(GraphBuilder, View, VisibleDecals, DecalPassTextures, InstanceCullingManager, EDecalRenderStage::BeforeBasePass);
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:595

Scope (from outer to inner):

file
namespace    PathTracing
function     bool UsesDecals

Source code excerpt:

	bool UsesDecals(const FSceneViewFamily& ViewFamily)
	{
		return ViewFamily.EngineShowFlags.Decals;
	}
}

static bool EvalUseAnalyticTransmittance(const FViewInfo& View)
{
	int32 UseAnalyticTransmittance = CVarPathTracingUseAnalyticTransmittance.GetValueOnRenderThread();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:675

Scope (from outer to inner):

file
function     static void PreparePathTracingData

Source code excerpt:

	PathTracingData.DecalRoughnessCutoff = PathTracing::UsesDecals(*View.Family) && View.bHasRayTracingDecals ? CVarPathTracingDecalRoughnessCutoff.GetValueOnRenderThread() : -1.0f;

	PathTracingData.MeshDecalRoughnessCutoff = PathTracing::UsesDecals(*View.Family) && Scene->RayTracingScene.GetRHIRayTracingScene()->GetInitializer().NumNativeInstancesPerLayer[(uint32)ERayTracingSceneLayer::Decals] > 0 ? CVarPathTracingMeshDecalRoughnessCutoff.GetValueOnRenderThread() : -1.0f;
	PathTracingData.MeshDecalBias = CVarPathTracingMeshDecalBias.GetValueOnRenderThread();

	PathTracingData.MaxRaymarchSteps = CVarPathTracingMaxRaymarchSteps.GetValueOnRenderThread();

	// 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 =

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:943

Scope (from outer to inner):

file
function     static ERayTracingPayloadType GetRayTracingPayloadType

Source code excerpt:

	static ERayTracingPayloadType GetRayTracingPayloadType(const int32 PermutationId)
	{
		return ERayTracingPayloadType::PathTracingMaterial | ERayTracingPayloadType::Decals;
	}

	BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
		SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<float4>, RadianceTexture)
		SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<float2>, VarianceTexture)
		SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<float4>, AlbedoTexture)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:2881

Scope: file

Source code excerpt:

							FPathTracingRG::FParameters* PassParameters = GraphBuilder.AllocParameters<FPathTracingRG::FParameters>();
							PassParameters->TLAS = Scene->RayTracingScene.GetLayerView(ERayTracingSceneLayer::Base);
							PassParameters->DecalTLAS = Scene->RayTracingScene.GetLayerView(ERayTracingSceneLayer::Decals);
							PassParameters->ViewUniformBuffer = View.ViewUniformBuffer;
							PassParameters->PathTracingData = Config.PathTracingData;
							PassParameters->StartingExtinctionCoefficient = GraphBuilder.CreateSRV(StartingExtinctionCoefficient, PF_R32_FLOAT);
							if (PreviousPassParameters == nullptr)
							{
								// upload sky/lights data

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracing.cpp:961

Scope (from outer to inner):

file
namespace    RayTracing
function     bool GatherWorldInstancesForView

Source code excerpt:

						{
							FRayTracingGeometryInstance DecalRayTracingInstance = RayTracingInstance;
							DecalRayTracingInstance.LayerIndex = (uint8)ERayTracingSceneLayer::Decals;

							DecalInstanceIndex = RayTracingScene.AddInstance(MoveTemp(DecalRayTracingInstance), SceneProxy, true);
						}

						if (bParallelMeshBatchSetup)
						{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracing.cpp:1262

Scope (from outer to inner):

file
namespace    RayTracing
function     bool GatherWorldInstancesForView
function     void DoTask

Source code excerpt:

							{
								FRayTracingGeometryInstance DecalRayTracingInstance = RayTracingInstance;
								DecalRayTracingInstance.LayerIndex = (uint8)ERayTracingSceneLayer::Decals;

								InstanceBatch.DecalIndex = RayTracingScene.AddInstance(MoveTemp(DecalRayTracingInstance), SceneProxy, false);
							}

							for (int32 CommandIndex : RelevantPrimitive.CachedRayTracingMeshCommandIndices)
							{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracing.cpp:1355

Scope (from outer to inner):

file
namespace    RayTracing
function     bool GatherWorldInstancesForView
function     void DoTask
lambda-function

Source code excerpt:

						{
							FRayTracingGeometryInstance DecalRayTracingInstance = *RelevantPrimitive.CachedRayTracingInstance;
							DecalRayTracingInstance.LayerIndex = (uint8)ERayTracingSceneLayer::Decals;
							AddDebugRayTracingInstanceFlags(DecalRayTracingInstance.Flags);

							DecalInstanceIndex = TmpInstanceIndex++;
							RayTracingScene.SetInstance(DecalInstanceIndex, MoveTemp(DecalRayTracingInstance), SceneProxy, false);
						}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDecals.cpp:203

Scope (from outer to inner):

file
class        class FRayTracingDecalMaterialShader : public FMaterialShader
function     static ERayTracingPayloadType GetRayTracingPayloadType

Source code excerpt:

	static ERayTracingPayloadType GetRayTracingPayloadType(const int32 PermutationId)
	{
		return ERayTracingPayloadType::Decals;
	}

	void GetShaderBindings(
		const FScene* Scene,
		ERHIFeatureLevel::Type FeatureLevel,
		const FMaterialRenderProxy& MaterialRenderProxy,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDecals.cpp:228

Scope: file

Source code excerpt:

};

IMPLEMENT_RT_PAYLOAD_TYPE(ERayTracingPayloadType::Decals, 48);

IMPLEMENT_SHADER_TYPE(, FRayTracingDecalMaterialShader, TEXT("/Engine/Private/RayTracing/RayTracingDecalMaterialShader.usf"), TEXT("RayTracingDecalMaterialShader"), SF_RayCallable);

static bool DecalNeedsAnyHitShader(EBlendMode BlendMode)
{
	return BlendMode != BLEND_Opaque;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDecals.cpp:314

Scope (from outer to inner):

file
class        class TRayTracingDecalMaterial : public FMeshMaterialShader
function     static ERayTracingPayloadType GetRayTracingPayloadType

Source code excerpt:

	static ERayTracingPayloadType GetRayTracingPayloadType(const int32 PermutationId)
	{
		return ERayTracingPayloadType::Decals;
	}
};

using FRayTracingDecalMaterialCHS = TRayTracingDecalMaterial<false>;
using FRayTracingDecalMaterialCHS_AHS = TRayTracingDecalMaterial<true>;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDecals.cpp:348

Scope (from outer to inner):

file
class        class FDefaultOpaqueMeshDecalHitGroup : public FGlobalShader
function     static ERayTracingPayloadType GetRayTracingPayloadType

Source code excerpt:

	static ERayTracingPayloadType GetRayTracingPayloadType(const int32 PermutationId)
	{
		return ERayTracingPayloadType::Decals;
	}

	using FParameters = FEmptyShaderParameters;
};

IMPLEMENT_SHADER_TYPE(, FDefaultOpaqueMeshDecalHitGroup, TEXT("/Engine/Private/RayTracing/RayTracingDefaultDecalHitShader.usf"), TEXT("closesthit=RayTracingDefaultOpaqueDecalMaterialCHS"), SF_RayHitGroup);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDecals.cpp:368

Scope (from outer to inner):

file
class        class FDefaultHiddenMeshDecalHitGroup : public FGlobalShader
function     static ERayTracingPayloadType GetRayTracingPayloadType

Source code excerpt:

	static ERayTracingPayloadType GetRayTracingPayloadType(const int32 PermutationId)
	{
		return ERayTracingPayloadType::Decals;
	}

	using FParameters = FEmptyShaderParameters;
};

IMPLEMENT_SHADER_TYPE(, FDefaultHiddenMeshDecalHitGroup, TEXT("/Engine/Private/RayTracing/RayTracingDefaultDecalHitShader.usf"), TEXT("closesthit=RayTracingDefaultHiddenDecalMaterialCHS anyhit=RayTracingDefaultHiddenDecalMaterialAHS"), SF_RayHitGroup);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDecals.cpp:473

Scope (from outer to inner):

file
function     FTransientDecalRenderDataList GetSortedDecals

Source code excerpt:

}

FTransientDecalRenderDataList GetSortedDecals(TConstArrayView<FDeferredDecalProxy*> Decals, FScene& Scene, const FViewInfo& View)
{
	const float FadeMultiplier = DecalRendering::GetDecalFadeScreenSizeMultiplier();
	const bool bIsPerspectiveProjection = View.IsPerspectiveProjection();

	FTransientDecalRenderDataList SortedDecals;
	SortedDecals.Reserve(Decals.Num());

	for (auto DecalProxy : Decals)
	{
		if (!DecalProxy->DecalMaterial || !DecalProxy->DecalMaterial->IsValidLowLevelFast())
		{
			continue;
		}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingDecals.cpp:536

Scope (from outer to inner):

file
function     TRDGUniformBufferRef<FRayTracingDecals> CreateRayTracingDecalData

Source code excerpt:

	const EShaderPlatform ShaderPlatform = View.Family->GetShaderPlatform();

	FTransientDecalRenderDataList SortedDecals = GetSortedDecals(Scene.Decals, Scene, View);

	// Allocate from the graph builder so that we don't need to copy the data again when queuing the upload
	auto& RayTracingDecals = GraphBuilder.AllocArray<FRayTracingDecal>();
	RayTracingDecals.Reserve(SortedDecals.Num());

	const float Inf = std::numeric_limits<float>::infinity();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingMaterialHitShaders.cpp:635

Scope (from outer to inner):

file
function     FRayTracingPipelineState* FDeferredShadingSceneRenderer::CreateRayTracingMaterialPipeline

Source code excerpt:


	ERayTracingPayloadType PayloadType = bIsPathTracing
		? (ERayTracingPayloadType::PathTracingMaterial | ERayTracingPayloadType::Decals)
		: ERayTracingPayloadType::RayTracingMaterial;

	FRayTracingPipelineStateInitializer Initializer;

	Initializer.MaxPayloadSizeInBytes = GetRayTracingPayloadTypeMaxSize(PayloadType);
	Initializer.bAllowHitGroupIndexing = true;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingMaterialHitShaders.cpp:787

Scope (from outer to inner):

file
function     FRayTracingPipelineState* FDeferredShadingSceneRenderer::CreateRayTracingMaterialPipeline
lambda-function

Source code excerpt:

						const FRayTracingMeshCommand& MeshCommand = *VisibleMeshCommand.RayTracingMeshCommand;

						const bool bIsMeshDecalShader = MeshCommand.MaterialShader->RayTracingPayloadType == (uint32)ERayTracingPayloadType::Decals;

						// TODO: Following check is disabled since FRayTracingMeshProcessor non-path-tracing code paths still don't assign the appropriate shader to decal mesh commands.
						// We could also potentially use regular materials to approximate decals in ray tracing in some situations.
						// check(bIsMeshDecalShader == MeshCommand.bDecal);

						// Force the same shader to be used on all geometry unless materials are enabled

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingMaterialHitShaders.h:165

Scope (from outer to inner):

file
class        class FDefaultCallableShader : public FGlobalShader
function     static ERayTracingPayloadType GetRayTracingPayloadType

Source code excerpt:

	static ERayTracingPayloadType GetRayTracingPayloadType(const int32 PermutationId)
	{
		return ERayTracingPayloadType::Decals;
	}

	using FParameters = FEmptyShaderParameters;
};

class FRayTracingLocalShaderBindingWriter

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingScene.h:33

Scope: file

Source code excerpt:

{
	Base,
	Decals,

	NUM
};

/**
* Persistent representation of the scene for ray tracing.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RendererScene.cpp:2886

Scope (from outer to inner):

file
function     void FScene::AddOrRemoveDecal_RenderThread

Source code excerpt:

	if (bAdd)
	{
		Decals.Add(Proxy);
		InvalidatePathTracedOutput();
	}
	else
	{
		// can be optimized
		for (int32 Index = 0; Index < Decals.Num(); ++Index)
		{
			if (Decals[Index] == Proxy)
			{
				InvalidatePathTracedOutput();
				Decals.RemoveAtSwap(Index, 1, EAllowShrinking::No);
				delete Proxy;
				break;
			}
		}
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RendererScene.cpp:4866

Scope (from outer to inner):

file
function     void FScene::ApplyWorldOffset_RenderThread

Source code excerpt:


	// Decals
	for (auto It = Decals.CreateIterator(); It; ++It)
	{
		(*It)->ComponentTrans.AddToTranslation(InOffset);
	}

	// Wind sources
	for (auto It = WindSources.CreateIterator(); It; ++It)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScenePrivate.h:3059

Scope (from outer to inner):

file
class        class FScene : public FSceneInterface

Source code excerpt:


	/** The decals in the scene. */
	TArray<FDeferredDecalProxy*> Decals;

	/** Potential capsule shadow casters registered to the scene. */
	TArray<FPrimitiveSceneInfo*> DynamicIndirectCasterPrimitives; 

	TArray<class FPlanarReflectionSceneProxy*> PlanarReflections;
	TArray<class UPlanarReflectionComponent*> PlanarReflections_GameThread;

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

Scope (from outer to inner):

file
function     void FViewInfo::SetupUniformBufferParameters

Source code excerpt:

	ViewUniformShaderParameters.ReflectionCubemapMaxMip = FMath::FloorLog2(UReflectionCaptureComponent::GetReflectionCaptureSize());

	ViewUniformShaderParameters.ShowDecalsMask = Family->EngineShowFlags.Decals ? 1.0f : 0.0f;

	extern int32 GDistanceFieldAOSpecularOcclusionMode;
	ViewUniformShaderParameters.DistanceFieldAOSpecularOcclusionMode = GDistanceFieldAOSpecularOcclusionMode;

	ViewUniformShaderParameters.IndirectCapsuleSelfShadowingIntensity = Scene ? Scene->DynamicIndirectShadowsSelfShadowingIntensity : 1.0f;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/Substrate.cpp:1413

Scope (from outer to inner):

file
namespace    Substrate
function     void AddSubstrateDBufferPass

Source code excerpt:


		const FViewInfo& View = Views[i];
		if (!IsUsingDBuffers(View.GetShaderPlatform()) || View.Family->EngineShowFlags.Decals == 0 || !IsDBufferPassEnabled(View.GetShaderPlatform()))
		{
			continue;
		}

		const FSubstrateViewData* SubstrateViewData = &View.SubstrateViewData;
		const FSubstrateSceneData* SubstrateSceneData = View.SubstrateViewData.SceneData;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:775

Scope (from outer to inner):

file
class        class FDebugVariableRateShadingCS : public FGlobalShader

Source code excerpt:

			CVarByPassType[EVRSPassType::ReflectionEnvironmentAndSky] = &CVarVRSReflectionEnvironmentSky;
			CVarByPassType[EVRSPassType::LightFunctions] = &CVarVRSLightFunctions;
			CVarByPassType[EVRSPassType::Decals] = &CVarVRSDecals;
		}
	} StaticData;

	uint32 ImageTypeAsInt = StaticData.CVarByPassType[PassType]->GetValueOnRenderThread();
	if (ImageTypeAsInt >= 0 && ImageTypeAsInt <= EVRSImageType::Conservative)
	{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/VariableRateShadingImageManager.h:33

Scope (from outer to inner):

file
class        class FVariableRateShadingImageManager : public FRenderResource

Source code excerpt:

		ReflectionEnvironmentAndSky,
		LightFunctions,
		Decals,
		Num
	};

	/**
	 * Image type to request from generator. Only the CAS generator currently distinguishes between Full and Conservative
	 */