CustomDepth
CustomDepth
#Overview
name: CustomDepth
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 67
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of CustomDepth is to provide a separate depth buffer for rendering custom depth information. It is primarily used for rendering outlines or other special effects that require a separate depth pass.
Key points about CustomDepth:
-
Purpose: CustomDepth is used for rendering custom depth information, often for effects like outlines or specialized depth-based rendering.
-
Subsystems: It is used across multiple Unreal Engine subsystems, including the rendering system, post-processing, and material system.
-
Value Setting: The value is typically set on primitives (like static meshes or actors) through the “Render CustomDepth Pass” property.
-
Interaction: It interacts with the main scene depth buffer and can be accessed in materials and post-process materials.
-
Developer Awareness: Developers should be aware that using CustomDepth can have performance implications, as it requires an additional rendering pass.
-
Best Practices:
- Only enable CustomDepth for objects that truly need it to minimize performance impact.
- Use it sparingly and consider alternative techniques for effects when possible.
- Be aware of the CustomDepth stencil value and write mask for more advanced usage.
-
Render Pipeline: CustomDepth is rendered in a separate pass, which can occur before or after the base pass depending on the engine configuration.
-
Material Usage: CustomDepth can be accessed in materials through the “CustomDepth” scene texture node, allowing for various depth-based effects.
-
Mobile Considerations: On mobile platforms, using CustomDepth may have additional performance considerations and may require specific project settings.
-
Debug Visualization: CustomDepth can be visualized in the editor using the “CustomDepth” view mode for debugging purposes.
When using CustomDepth, developers should carefully consider the performance trade-offs and ensure it’s only used when necessary for the desired visual effect.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2903, section: [Engine.BufferVisualizationMaterials]
- INI Section:
Engine.BufferVisualizationMaterials
- Raw value:
(Material="/Engine/BufferVisualization/CustomDepth.CustomDepth", Name=LOCTEXT("BaseCustomDepthMat", "Custom Depth"))
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/PostProcessMaterialChainGraph/Source/PostProcessMaterialChainGraph/Private/PPMChainGraphSceneViewExtension.cpp:409
Scope (from outer to inner):
file
function void FPPMChainGraphSceneViewExtension::PrePostProcessPass_RenderThread
lambda-function
Source code excerpt:
}
PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::SeparateTranslucency, FScreenPassTexture(PostDOFTranslucencyResources.GetColorForRead(GraphBuilder), ViewRect));
PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::Velocity, Velocity);
PostProcessMaterialInputs.SceneTextures = GetSceneTextureShaderParameters(Inputs.SceneTextures);
const FScreenPassTexture CustomDepth(Inputs.CustomDepthTexture, PrimaryViewRect);
PostProcessMaterialInputs.CustomDepthTexture = CustomDepth.Texture;
PostProcessMaterialInputs.bManualStencilTest = Inputs.bSeparateCustomStencil;
// This is not available to Scene View Extensions yet.
//PostProcessMaterialInputs.SceneWithoutWaterTextures = &SceneWithoutWaterTextures;
return PostProcessMaterialInputs;
};
FPostProcessMaterialInputs PPMInputs = GetPostProcessMaterialInputs(SceneColor);
RenderPPMChainGraphProxies
(
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Classes/NiagaraSystem.h:638
Scope: file
Source code excerpt:
UPROPERTY(EditAnywhere, BlueprintReadOnly, AdvancedDisplay, Category="Rendering", meta=(DisplayName="Default CustomDepthStencil Write Mask", editcondition="bOverrideCustomDepthStencilValue"))
ERendererStencilMask CustomDepthStencilWriteMask;
/**
When enabled this is the default value set on the component.
Optionally write this 0-255 value to the stencil buffer in CustomDepth pass (Requires project setting or r.CustomDepth == 3)
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, AdvancedDisplay, Category="Rendering", meta=(DisplayName="Default CustomDepthStencil Value", editcondition="bOverrideCustomDepthStencilWriteMask", UIMin = "0", UIMax = "255"))
int32 CustomDepthStencilValue = 0;
/**
When enabled this is the default value set on the component.
Adjusts the translucent object sorting priority, see PrimitiveComponent description for more details.
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, AdvancedDisplay, Category="Rendering", meta=(editcondition="bOverrideTranslucencySortPriority"))
int32 TranslucencySortPriority = 0;
/**
When enabled this is the default value set on the component.
Modifies the sort distance for translucent objects, see PrimitiveComponent description for more details.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Components/PrimitiveComponent.h:618
Scope (from outer to inner):
file
class class ERayTracingGroupCullingPriority : uint8
class class UPrimitiveComponent : public USceneComponent, public INavRelevantInterface, public IInterface_AsyncCompilation, public IPhysicsComponent
Source code excerpt:
/** Set to true while the editor is moving the component, which notifies the Renderer to track velocities even if the component is Static. */
UPROPERTY(Transient, DuplicateTransient)
uint8 bIsBeingMovedByEditor:1;
/** If true, this component will be rendered in the CustomDepth pass (usually used for outlines) */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=Rendering, meta=(DisplayName = "Render CustomDepth Pass"))
uint8 bRenderCustomDepth:1;
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category = Rendering, meta = (DisplayName = "Visible In Scene Capture Only", ToolTip = "When true, will only be visible in Scene Capture"))
uint8 bVisibleInSceneCaptureOnly : 1;
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category = Rendering, meta = (DisplayName = "Hidden In Scene Capture", ToolTip = "When true, will not be captured by Scene Capture"))
uint8 bHiddenInSceneCapture : 1;
/** If true, this component will be available to ray trace as a far field primitive even if hidden. */
UPROPERTY()
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Components/PrimitiveComponent.h:746
Scope (from outer to inner):
file
class class ERayTracingGroupCullingPriority : uint8
class class UPrimitiveComponent : public USceneComponent, public INavRelevantInterface, public IInterface_AsyncCompilation, public IPhysicsComponent
Source code excerpt:
/** Used for precomputed visibility */
UPROPERTY()
int32 VisibilityId=0;
/** Optionally write this 0-255 value to the stencil buffer in CustomDepth pass (Requires project setting or r.CustomDepth == 3) */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=Rendering, meta=(UIMin = "0", UIMax = "255", editcondition = "bRenderCustomDepth", DisplayName = "CustomDepth Stencil Value"))
int32 CustomDepthStencilValue;
private:
/** Optional user defined default values for the custom primitive data of this primitive */
UPROPERTY(EditAnywhere, Category=Rendering, meta = (DisplayName = "Custom Primitive Data Defaults"))
FCustomPrimitiveData CustomPrimitiveData;
/** Custom data that can be read by a material through a material parameter expression. Set data using SetCustomPrimitiveData* functions */
UPROPERTY(Transient)
FCustomPrimitiveData CustomPrimitiveDataInternal;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Components/PrimitiveComponent.h:1902
Scope (from outer to inner):
file
class class ERayTracingGroupCullingPriority : uint8
class class UPrimitiveComponent : public USceneComponent, public INavRelevantInterface, public IInterface_AsyncCompilation, public IPhysicsComponent
Source code excerpt:
/** Sets the bRenderCustomDepth property and marks the render state dirty. */
UFUNCTION(BlueprintCallable, Category="Rendering")
ENGINE_API void SetRenderCustomDepth(bool bValue);
/** Sets the CustomDepth stencil value (0 - 255) and marks the render state dirty. */
UFUNCTION(BlueprintCallable, Category = "Rendering", meta=(UIMin = "0", UIMax = "255"))
ENGINE_API void SetCustomDepthStencilValue(int32 Value);
/** Sets the CustomDepth stencil write mask and marks the render state dirty. */
UFUNCTION(BlueprintCallable, Category = "Rendering")
ENGINE_API void SetCustomDepthStencilWriteMask(ERendererStencilMask WriteMaskBit);
/** Sets bRenderInMainPass property and marks the render state dirty. */
UFUNCTION(BlueprintCallable, Category = "Rendering")
ENGINE_API void SetRenderInMainPass(bool bValue);
/** Sets bRenderInDepthPass property and marks the render state dirty. */
UFUNCTION(BlueprintCallable, Category = "Rendering")
ENGINE_API void SetRenderInDepthPass(bool bValue);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/HLSLMaterialTranslator.cpp:7475
Scope (from outer to inner):
file
function void FHLSLMaterialTranslator::UseSceneTextureId
Source code excerpt:
if (Material->GetMaterialDomain() == MD_DeferredDecal)
{
const bool bSceneTextureSupportsDecal = SceneTextureId == PPI_SceneDepth || SceneTextureId == PPI_WorldNormal || SceneTextureId == PPI_CustomDepth || SceneTextureId == PPI_CustomStencil;
if (!bSceneTextureSupportsDecal)
{
// Note: For DBuffer decals CustomDepth and CustomStencil are not available if r.CustomDepth.Order = 1
Errorf(TEXT("Decals can only access SceneDepth, CustomDepth, CustomStencil, and WorldNormal."));
}
const bool bSceneTextureRequiresSM5 = SceneTextureId == PPI_WorldNormal;
if (bSceneTextureRequiresSM5)
{
ErrorUnlessFeatureLevelSupported(ERHIFeatureLevel::SM5);
}
if (SceneTextureId == PPI_WorldNormal && Material->HasNormalConnected() && !IsUsingDBuffers(Platform))
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialExpressionHLSL.cpp:2116
Scope (from outer to inner):
file
function bool UMaterialExpressionSceneTexture::GenerateHLSLExpression
Source code excerpt:
if (MaterialDomain == MD_DeferredDecal)
{
const bool bSceneTextureSupportsDecal = SceneTextureId == PPI_SceneDepth || SceneTextureId == PPI_WorldNormal || SceneTextureId == PPI_CustomDepth || SceneTextureId == PPI_CustomStencil;
if (!bSceneTextureSupportsDecal)
{
// Note: For DBuffer decals CustomDepth and CustomStencil are not available if r.CustomDepth.Order = 1
return Generator.Error(TEXT("Decals can only access SceneDepth, CustomDepth, CustomStencil, and WorldNormal."));
}
}
if (SceneTextureId == PPI_SceneColor && MaterialDomain != MD_Surface)
{
if (MaterialDomain == MD_PostProcess)
{
return Generator.Error(TEXT("SceneColor lookups are only available when MaterialDomain = Surface. PostProcessMaterials should use the SceneTexture PostProcessInput0."));
}
else
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/GPUSkinCache.h:10
Scope: file
Source code excerpt:
// * feature need to be enabled (r.SkinCache.Mode)
// Features
// * Skeletal mesh, 4 / 8 weights per vertex, 16/32 index buffer
// * Supports Morph target animation (morph target blending is not done by this code)
// * Saves vertex shader computations when we render an object multiple times (EarlyZ, velocity, shadow, BasePass, CustomDepth, Shadow masking)
// * Fixes velocity rendering (needed for MotionBlur and TemporalAA) for WorldPosOffset animation and morph target animation
// * RecomputeTangents results in improved tangent space for WorldPosOffset animation and morph target animation
// * fixed amount of memory per Scene (r.SkinCache.SceneMemoryLimitInMB)
// * Velocity Rendering for MotionBlur and TemporalAA (test Velocity in BasePass)
// * r.SkinCache.Mode and r.SkinCache.RecomputeTangents can be toggled at runtime
// TODO:
// * Test: Tessellation
// * Quality/Optimization: increase TANGENT_RANGE for better quality or accumulate two components in one 32bit value
// * Bug: UpdateMorphVertexBuffer needs to handle SkinCacheObjects that have been rejected by the SkinCache (e.g. because it was running out of memory)
// * Refactor: Unify the 3 compute shaders to use the same C++ setup code for the variables
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/MaterialSceneTextureId.h:38
Scope: file
Source code excerpt:
PPI_Opacity UMETA(DisplayName="Opacity"),
/** Material roughness, single channel (GBuffer) */
PPI_Roughness UMETA(DisplayName="Roughness"),
/** Material ambient occlusion, single channel (GBuffer) */
PPI_MaterialAO UMETA(DisplayName="MaterialAO"),
/** Scene depth, single channel, contains the linear depth of the opaque objects rendered with CustomDepth (mesh property) */
PPI_CustomDepth UMETA(DisplayName="CustomDepth"),
/** Input #0 of this postprocess pass, usually the only one hooked up */
PPI_PostProcessInput0 UMETA(DisplayName="PostProcessInput0"),
/** Input #1 of this postprocess pass, usually not used */
PPI_PostProcessInput1 UMETA(DisplayName="PostProcessInput1"),
/** Input #2 of this postprocess pass, usually not used */
PPI_PostProcessInput2 UMETA(DisplayName="PostProcessInput2"),
/** Input #3 of this postprocess pass, usually not used */
PPI_PostProcessInput3 UMETA(DisplayName="PostProcessInput3"),
/** Input #4 of this postprocess pass, usually not used */
PPI_PostProcessInput4 UMETA(DisplayName="PostProcessInput4"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/MaterialSceneTextureId.h:62
Scope: file
Source code excerpt:
PPI_ShadingModelColor UMETA(DisplayName="Shading Model Color"),
/** Shading model ID */
PPI_ShadingModelID UMETA(DisplayName="Shading Model ID"),
/** Ambient Occlusion, single channel */
PPI_AmbientOcclusion UMETA(DisplayName="Ambient Occlusion"),
/** Scene stencil, contains CustomStencil mesh property of the opaque objects rendered with CustomDepth */
PPI_CustomStencil UMETA(DisplayName="CustomStencil"),
/** Material base, RGB color (GBuffer) */
PPI_StoredBaseColor UMETA(DisplayName="BaseColor (as stored in GBuffer)"),
/** Material specular, single channel (GBuffer) */
PPI_StoredSpecular UMETA(DisplayName="Specular (as stored in GBuffer)"),
/** Scene Velocity */
PPI_Velocity UMETA(DisplayName="Velocity"),
/** Tangent, RGB in -1..1 range, not normalized (GBuffer) */
PPI_WorldTangent UMETA(DisplayName = "WorldTangent"),
/** Material anisotropy, single channel (GBuffer) */
PPI_Anisotropy UMETA(DisplayName = "Anisotropy"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/MaterialShared.h:2178
Scope: file
Source code excerpt:
/** Does the material use a SceneDepth lookup. */
ENGINE_API bool MaterialUsesSceneDepthLookup_RenderThread() const;
ENGINE_API bool MaterialUsesSceneDepthLookup_GameThread() const;
/** The material usage mask of CustomDepth and CustomStencil*/
ENGINE_API uint8 GetCustomDepthStencilUsageMask_GameThread() const;
/** Note: This function is only intended for use in deciding whether or not shader permutations are required before material translation occurs. */
ENGINE_API bool MaterialMayModifyMeshPosition() const;
/** Get the runtime virtual texture output attribute mask for the material. */
ENGINE_API uint8 GetRuntimeVirtualTextureOutputAttibuteMask_GameThread() const;
ENGINE_API uint8 GetRuntimeVirtualTextureOutputAttibuteMask_RenderThread() const;
ENGINE_API bool MaterialUsesAnisotropy_GameThread() const;
ENGINE_API bool MaterialUsesAnisotropy_RenderThread() const;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/PrimitiveSceneProxy.h:1423
Scope: file
Source code excerpt:
uint8 bHiddenInSceneCapture : 1;
/** This primitive will be available to ray trace as a far field primitive even if hidden. */
bool bRayTracingFarField : 1;
/** Optionally write this stencil value during the CustomDepth pass */
uint8 CustomDepthStencilValue;
/** When writing custom depth stencil, use this write mask */
TEnumAsByte<EStencilMask> CustomDepthStencilWriteMask;
uint8 LightingChannelMask;
// Run-time groups of proxies
int32 RayTracingGroupId;
uint8 RayTracingGroupCullingPriority;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/SceneTexturesConfig.h:83
Scope: file
Source code excerpt:
/** Extracts scene depth after execution */
Depth = 1 << 0,
/** Extracts custom depth after execution. */
CustomDepth = 1 << 1,
/** Extracts all available textures after execution. */
All = Depth | CustomDepth
};
struct FSceneTexturesConfigInitSettings
{
ERHIFeatureLevel::Type FeatureLevel = ERHIFeatureLevel::Num;
FIntPoint Extent = FIntPoint::ZeroValue;
bool bRequireMultiView = false;
bool bRequiresAlphaChannel = false;
bool bSupportsXRTargetManagerDepthAlloc = false;
ETextureCreateFlags ExtraSceneColorCreateFlags = ETextureCreateFlags::None;
ETextureCreateFlags ExtraSceneDepthCreateFlags = ETextureCreateFlags::None;
#Loc: <Workspace>/Engine/Source/Runtime/Foliage/Public/FoliageType.h:375
Scope (from outer to inner):
file
class class UFoliageType : public UObject
Source code excerpt:
* These channels only apply to opaque materials, direct lighting, and dynamic lighting and shadowing.
*/
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=InstanceSettings)
FLightingChannels LightingChannels;
/** If true, the foliage will be rendered in the CustomDepth pass (usually used for outlines) */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=InstanceSettings, meta=(DisplayName = "Render CustomDepth Pass"))
uint32 bRenderCustomDepth:1;
/** Mask used for stencil buffer writes. */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=InstanceSettings, meta = (editcondition = "bRenderCustomDepth"))
ERendererStencilMask CustomDepthStencilWriteMask;
/** Optionally write this 0-255 value to the stencil buffer in CustomDepth pass (Requires project setting or r.CustomDepth == 3) */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=InstanceSettings, meta=(UIMin = "0", UIMax = "255", editcondition = "bRenderCustomDepth", DisplayName = "CustomDepth Stencil Value"))
int32 CustomDepthStencilValue;
/**
* Translucent objects with a lower sort priority draw behind objects with a higher priority.
* Translucent objects with the same priority are rendered from back-to-front based on their bounds origin.
* This setting is also used to sort objects being drawn into a runtime virtual texture.
*
* Ignored if the object is not translucent. The default priority is zero.
* Warning: This should never be set to a non-default value unless you know what you are doing, as it will prevent the renderer from sorting correctly.
* It is especially problematic on dynamic gameplay effects.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Classes/LandscapeProxy.h:737
Scope: file
Source code excerpt:
* If 0.0, the attenuation of the VSM invalidation rate will be disabled entirely.
* Only applies when using non-Nanite landscape and VSM. */
UPROPERTY(EditAnywhere, AdvancedDisplay, Category = Lighting, meta = (LandscapeOverridable, ClampMin = "0.0", ClampMax = "10.0", UIMin = "0.0", UIMax = "10.0"))
float NonNaniteVirtualShadowMapInvalidationScreenSizeLimit = 0.2f;
/** If true, the Landscape will be rendered in the CustomDepth pass (usually used for outlines) */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category = Rendering, meta=(DisplayName = "Render CustomDepth Pass", LandscapeOverridable))
uint32 bRenderCustomDepth:1;
/** Mask used for stencil buffer writes. */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category = Rendering, meta = (editcondition = "bRenderCustomDepth", LandscapeOverridable))
ERendererStencilMask CustomDepthStencilWriteMask;
/** Optionally write this 0-255 value to the stencil buffer in CustomDepth pass (Requires project setting or r.CustomDepth == 3) */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=Rendering, meta=(UIMin = "0", UIMax = "255", editcondition = "bRenderCustomDepth", DisplayName = "CustomDepth Stencil Value", LandscapeOverridable))
int32 CustomDepthStencilValue;
/** Max draw distance exposed to LDs. The real max draw distance is the min (disregarding 0) of this and volumes affecting this object. */
UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category=Rendering, meta = (DisplayName = "Desired Max Draw Distance", LandscapeOverridable))
float LDMaxDrawDistance;
/** The Lightmass settings for this object. */
UPROPERTY(EditAnywhere, Category=Lightmass, meta = (LandscapeInherited))
FLightmassPrimitiveSettings LightmassSettings;
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Classes/LandscapeSplineControlPoint.h:150
Scope (from outer to inner):
file
class class ULandscapeSplineControlPoint : public UObject
Source code excerpt:
* Warning: This should never be set to a non-default value unless you know what you are doing, as it will prevent the renderer from sorting correctly.
*/
UPROPERTY(EditAnywhere, Category=Mesh, AdvancedDisplay)
int32 TranslucencySortPriority;
/** If true, this component will be rendered in the CustomDepth pass (usually used for outlines) */
UPROPERTY(EditAnywhere, AdvancedDisplay, Category = Mesh, meta = (DisplayName = "Render CustomDepth Pass"))
uint8 bRenderCustomDepth : 1;
/** Mask used for stencil buffer writes. */
UPROPERTY(EditAnywhere, AdvancedDisplay, Category = Mesh, meta = (editcondition = "bRenderCustomDepth"))
ERendererStencilMask CustomDepthStencilWriteMask;
/** Optionally write this 0-255 value to the stencil buffer in CustomDepth pass (Requires project setting or r.CustomDepth == 3) */
UPROPERTY(EditAnywhere, AdvancedDisplay, Category = Mesh, meta = (UIMin = "0", UIMax = "255", editcondition = "bRenderCustomDepth", DisplayName = "CustomDepth Stencil Value"))
int32 CustomDepthStencilValue;
/**
* Array of runtime virtual textures into which we draw the spline segment.
* The material also needs to be set up to output to a virtual texture.
*/
UPROPERTY(EditAnywhere, Category = VirtualTexture, meta = (DisplayName = "Draw in Virtual Textures"))
TArray<TObjectPtr<URuntimeVirtualTexture>> RuntimeVirtualTextures;
/** Lod bias for rendering to runtime virtual texture. */
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Classes/LandscapeSplineSegment.h:247
Scope (from outer to inner):
file
class class ULandscapeSplineSegment : public UObject
Source code excerpt:
* Warning: This should never be set to a non-default value unless you know what you are doing, as it will prevent the renderer from sorting correctly.
*/
UPROPERTY(EditAnywhere, Category=LandscapeSplineMeshes, AdvancedDisplay)
int32 TranslucencySortPriority;
/** If true, this component will be rendered in the CustomDepth pass (usually used for outlines) */
UPROPERTY(EditAnywhere, AdvancedDisplay, Category = LandscapeSplineMeshes, meta = (DisplayName = "Render CustomDepth Pass"))
uint8 bRenderCustomDepth : 1;
/** Mask used for stencil buffer writes. */
UPROPERTY(EditAnywhere, AdvancedDisplay, Category = LandscapeSplineMeshes, meta = (editcondition = "bRenderCustomDepth"))
ERendererStencilMask CustomDepthStencilWriteMask;
/** Optionally write this 0-255 value to the stencil buffer in CustomDepth pass (Requires project setting or r.CustomDepth == 3) */
UPROPERTY(EditAnywhere, AdvancedDisplay, Category = LandscapeSplineMeshes, meta = (UIMin = "0", UIMax = "255", editcondition = "bRenderCustomDepth", DisplayName = "CustomDepth Stencil Value"))
int32 CustomDepthStencilValue;
/**
* Array of runtime virtual textures into which we draw the spline segment.
* The material also needs to be set up to output to a virtual texture.
*/
UPROPERTY(EditAnywhere, Category = VirtualTexture, meta = (DisplayName = "Draw in Virtual Textures"))
TArray<TObjectPtr<URuntimeVirtualTexture>> RuntimeVirtualTextures;
/** Lod bias for rendering to runtime virtual texture. */
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Internal/SceneTextures.h:42
Scope: file
Source code excerpt:
// Textures containing primary depth buffer copied before other meshes are rendered in the secondary depth pass.
FRDGTextureMSAA PartialDepth{};
// Textures containing depth / stencil information from the custom depth pass.
FCustomDepthTextures CustomDepth{};
RENDERER_API FSceneTextureShaderParameters GetSceneTextureShaderParameters(ERHIFeatureLevel::Type FeatureLevel) const;
};
/** RDG struct containing the complete set of scene textures for the deferred or mobile renderers. */
struct FSceneTextures : public FMinimalSceneTextures
{
// Initializes the scene textures structure in the FViewFamilyInfo
static RENDERER_API void InitializeViewFamily(FRDGBuilder& GraphBuilder, FViewFamilyInfo& ViewFamily);
static RENDERER_API EPixelFormat GetGBufferFFormatAndCreateFlags(ETextureCreateFlags& OutCreateFlags);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/PostProcessDeferredDecals.cpp:80
Scope (from outer to inner):
file
function FDeferredDecalPassTextures GetDeferredDecalPassTextures
Source code excerpt:
const bool bIsMobile = (View.GetFeatureLevel() == ERHIFeatureLevel::ES3_1);
ESceneTextureSetupMode TextureReadAccess = ESceneTextureSetupMode::None;
EMobileSceneTextureSetupMode MobileTextureReadAccess = EMobileSceneTextureSetupMode::None;
if (bIsMobile)
{
MobileTextureReadAccess = EMobileSceneTextureSetupMode::SceneDepth | EMobileSceneTextureSetupMode::CustomDepth;
}
else
{
TextureReadAccess = ESceneTextureSetupMode::GBufferA | ESceneTextureSetupMode::SceneDepth | ESceneTextureSetupMode::CustomDepth;
}
SetupSceneTextureUniformParameters(GraphBuilder, &SceneTextures, View.FeatureLevel, TextureReadAccess, Parameters->SceneTextures);
SetupMobileSceneTextureUniformParameters(GraphBuilder, &SceneTextures, MobileTextureReadAccess, Parameters->MobileSceneTextures);
Parameters->EyeAdaptationBuffer = GraphBuilder.CreateSRV(GetEyeAdaptationBuffer(GraphBuilder, View));
PassTextures.DecalPassUniformBuffer = GraphBuilder.CreateUniformBuffer(Parameters);
PassTextures.Depth = SceneTextures.Depth;
PassTextures.Color = SceneTextures.Color.Target;
// Mobile deferred renderer does not use dbuffer
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:68
Scope (from outer to inner):
file
function FCustomDepthTextures FCustomDepthTextures::Create
Source code excerpt:
const bool bWritesCustomStencil = IsCustomDepthPassWritingStencil();
FCustomDepthTextures CustomDepthTextures;
ETextureCreateFlags CreateFlags = GFastVRamConfig.CustomDepth | TexCreate_DepthStencilTargetable | TexCreate_ShaderResource;
// For Nanite, check to create the depth texture as a UAV and force HTILE.
if (UseNanite(ShaderPlatform) && UseComputeDepthExport() && Nanite::GetSupportsCustomDepthRendering())
{
CreateFlags |= TexCreate_UAV;
}
else if (!CVarCustomDepthEnableFastClear.GetValueOnRenderThread())
{
CreateFlags |= TexCreate_NoFastClear;
}
const FRDGTextureDesc CustomDepthDesc = FRDGTextureDesc::Create2D(CustomDepthExtent, PF_DepthStencil, FClearValueBinding::DepthFar, CreateFlags);
CustomDepthTextures.Depth = GraphBuilder.CreateTexture(CustomDepthDesc, TEXT("CustomDepth"));
CustomDepthTextures.DepthAction = ERenderTargetLoadAction::EClear;
CustomDepthTextures.StencilAction = bWritesCustomStencil ? ERenderTargetLoadAction::EClear : ERenderTargetLoadAction::ENoAction;
return CustomDepthTextures;
}
BEGIN_SHADER_PARAMETER_STRUCT(FCustomDepthPassParameters, )
SHADER_PARAMETER_STRUCT_INCLUDE(FViewShaderParameters, View)
SHADER_PARAMETER_STRUCT_INCLUDE(FInstanceCullingDrawParams, InstanceCullingDrawParams)
SHADER_PARAMETER_STRUCT_INCLUDE(FSceneTextureShaderParameters, SceneTextures)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:247
Scope (from outer to inner):
file
function bool FSceneRenderer::RenderCustomDepthPass
Source code excerpt:
{
return false;
}
RDG_CSV_STAT_EXCLUSIVE_SCOPE(GraphBuilder, RenderCustomDepthPass);
RDG_GPU_STAT_SCOPE(GraphBuilder, CustomDepth);
// Render non-Nanite Custom Depth primitives
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ++ViewIndex)
{
FViewInfo& View = Views[ViewIndex];
if (View.ShouldRenderView() && View.bHasCustomDepthPrimitives)
{
RDG_EVENT_SCOPE_CONDITIONAL(GraphBuilder, Views.Num() > 1, "View%d", ViewIndex);
View.BeginRenderView();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:273
Scope (from outer to inner):
file
function bool FSceneRenderer::RenderCustomDepthPass
Source code excerpt:
CustomDepthTextures.Depth,
DepthLoadAction,
StencilLoadAction,
FExclusiveDepthStencil::DepthWrite_StencilWrite);
View.ParallelMeshDrawCommandPasses[EMeshPass::CustomDepth].BuildRenderingCommands(GraphBuilder, Scene->GPUScene, PassParameters->InstanceCullingDrawParams);
GraphBuilder.AddPass(
RDG_EVENT_NAME("CustomDepth"),
PassParameters,
ERDGPassFlags::Raster,
[this, &View, PassParameters](FRHICommandList& RHICmdList)
{
SetStereoViewport(RHICmdList, View, 1.0f);
View.ParallelMeshDrawCommandPasses[EMeshPass::CustomDepth].DispatchDraw(nullptr, RHICmdList, &PassParameters->InstanceCullingDrawParams);
});
}
}
if (TotalNaniteInstances > 0)
{
RDG_EVENT_SCOPE(GraphBuilder, "Nanite CustomDepth");
const FIntPoint RasterTextureSize = CustomDepthTextures.Depth->Desc.Extent;
FIntRect RasterTextureRect(0, 0, RasterTextureSize.X, RasterTextureSize.Y);
if (Views.Num() == 1)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:391
Scope (from outer to inner):
file
function bool FSceneRenderer::RenderCustomDepthPass
Source code excerpt:
Nanite::FinalizeCustomDepthStencil(GraphBuilder, CustomDepthContext, CustomDepthTextures);
}
else
{
const FSceneTexturesConfig& Config = FSceneTexturesConfig::Get();
// TextureView is not supported in GLES, so we can't lookup CustomDepth and CustomStencil from a single texture
// Do a copy of the CustomDepthStencil texture if CustomStencil is sampled in a shader.
if (IsOpenGLPlatform(ShaderPlatform))
{
if (Config.bSamplesCustomStencil)
{
FRDGTextureRef CustomStencil = GraphBuilder.CreateTexture(CustomDepthTextures.Depth->Desc, TEXT("CustomStencil"));
AddCopyTexturePass(GraphBuilder, CustomDepthTextures.Depth, CustomStencil);
CustomDepthTextures.Stencil = GraphBuilder.CreateSRV(FRDGTextureSRVDesc::CreateWithPixelFormat(CustomStencil, PF_X24_G8));
}
}
else
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:460
Scope (from outer to inner):
file
function FCustomDepthPassMeshProcessor::FCustomDepthPassMeshProcessor
Source code excerpt:
FMeshPassProcessorRenderState PassDrawRenderState;
};
FCustomDepthPassMeshProcessor::FCustomDepthPassMeshProcessor(const FScene* Scene, ERHIFeatureLevel::Type FeatureLevel, const FSceneView* InViewIfDynamicMeshCommand, FMeshPassDrawListContext* InDrawListContext)
: FMeshPassProcessor(EMeshPass::CustomDepth, Scene, FeatureLevel, InViewIfDynamicMeshCommand, InDrawListContext)
{
PassDrawRenderState.SetBlendState(TStaticBlendState<>::GetRHI());
PassDrawRenderState.SetDepthStencilState(TStaticDepthStencilState<true, CF_DepthNearOrEqual>::GetRHI());
}
void FCustomDepthPassMeshProcessor::AddMeshBatch(const FMeshBatch& RESTRICT MeshBatch, uint64 BatchElementMask, const FPrimitiveSceneProxy* RESTRICT PrimitiveSceneProxy, int32 StaticMeshId)
{
if (PrimitiveSceneProxy->ShouldRenderCustomDepth())
{
const FMaterialRenderProxy* MaterialRenderProxy = MeshBatch.MaterialRenderProxy;
while (MaterialRenderProxy)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:768
Scope (from outer to inner):
file
function void FCustomDepthPassMeshProcessor::CollectPSOInitializers
Source code excerpt:
}
FGraphicsPipelineRenderTargetsInfo RenderTargetsInfo;
RenderTargetsInfo.NumSamples = 1;
ETextureCreateFlags CustomDepthStencilCreateFlags = GFastVRamConfig.CustomDepth | TexCreate_NoFastClear | TexCreate_DepthStencilTargetable | TexCreate_ShaderResource;
SetupDepthStencilInfo(PF_DepthStencil, CustomDepthStencilCreateFlags, ERenderTargetLoadAction::ELoad,
ERenderTargetLoadAction::ELoad, FExclusiveDepthStencil::DepthWrite_StencilWrite, RenderTargetsInfo);
AddGraphicsPipelineStateInitializer(
VertexFactoryData,
MaterialResource,
PassDrawRenderState,
RenderTargetsInfo,
DepthPassShaders,
MeshFillMode,
MeshCullMode,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:791
Scope: file
Source code excerpt:
FMeshPassProcessor* CreateCustomDepthPassProcessor(ERHIFeatureLevel::Type FeatureLevel, const FScene* Scene, const FSceneView* InViewIfDynamicMeshCommand, FMeshPassDrawListContext* InDrawListContext)
{
return new FCustomDepthPassMeshProcessor(Scene, FeatureLevel, InViewIfDynamicMeshCommand, InDrawListContext);
}
REGISTER_MESHPASSPROCESSOR_AND_PSOCOLLECTOR(RegisterCustomDepthPass, CreateCustomDepthPassProcessor, EShadingPath::Deferred, EMeshPass::CustomDepth, EMeshPassFlags::MainView);
REGISTER_MESHPASSPROCESSOR_AND_PSOCOLLECTOR(RegisterMobileCustomDepthPass, CreateCustomDepthPassProcessor, EShadingPath::Mobile, EMeshPass::CustomDepth, EMeshPassFlags::MainView);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:2302
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::Render
Source code excerpt:
const ECustomDepthPassLocation CustomDepthPassLocation = GetCustomDepthPassLocation(ShaderPlatform);
if (CustomDepthPassLocation == ECustomDepthPassLocation::BeforeBasePass)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_FDeferredShadingSceneRenderer_CustomDepthPass_BeforeBasePass);
if (RenderCustomDepthPass(GraphBuilder, SceneTextures.CustomDepth, SceneTextures.GetSceneTextureShaderParameters(FeatureLevel), NaniteRasterResults, PrimaryNaniteViews))
{
SceneTextures.SetupMode |= ESceneTextureSetupMode::CustomDepth;
SceneTextures.UniformBuffer = CreateSceneTextureUniformBuffer(GraphBuilder, &SceneTextures, FeatureLevel, SceneTextures.SetupMode);
}
}
// Lumen updates need access to sky atmosphere LUT.
ExternalAccessQueue.Submit(GraphBuilder);
UpdateLumenScene(GraphBuilder, LumenFrameTemporaries);
FRDGTextureRef HalfResolutionDepthCheckerboardMinMaxTexture = nullptr;
FRDGTextureRef QuarterResolutionDepthMinMaxTexture = nullptr;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:2675
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::Render
Source code excerpt:
}
if (CustomDepthPassLocation == ECustomDepthPassLocation::AfterBasePass)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_FDeferredShadingSceneRenderer_CustomDepthPass_AfterBasePass);
if (RenderCustomDepthPass(GraphBuilder, SceneTextures.CustomDepth, SceneTextures.GetSceneTextureShaderParameters(FeatureLevel), NaniteRasterResults, PrimaryNaniteViews))
{
SceneTextures.SetupMode |= ESceneTextureSetupMode::CustomDepth;
SceneTextures.UniformBuffer = CreateSceneTextureUniformBuffer(GraphBuilder, &SceneTextures, FeatureLevel, SceneTextures.SetupMode);
}
}
// If we are not rendering velocities in depth or base pass then do that here.
if (bShouldRenderVelocities && !bBasePassCanOutputVelocity && (Scene->EarlyZPassMode != DDM_AllOpaqueNoVelocity))
{
GraphBuilder.SetCommandListStat(GET_STATID(STAT_CLM_Velocity));
RenderVelocities(GraphBuilder, Views, SceneTextures, EVelocityPass::Opaque, bHairStrandsEnable);
GraphBuilder.SetCommandListStat(GET_STATID(STAT_CLM_AfterVelocity));
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:3308
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::Render
Source code excerpt:
GraphBuilder.SetCommandListStat(GET_STATID(STAT_CLM_PostProcessing));
FPostProcessingInputs PostProcessingInputs;
PostProcessingInputs.ViewFamilyTexture = ViewFamilyTexture;
PostProcessingInputs.CustomDepthTexture = SceneTextures.CustomDepth.Depth;
PostProcessingInputs.ExposureIlluminance = ExposureIlluminance;
PostProcessingInputs.SceneTextures = SceneTextures.UniformBuffer;
PostProcessingInputs.bSeparateCustomStencil = SceneTextures.CustomDepth.bSeparateStencilBuffer;
PostProcessingInputs.PathTracingResources = PathTracingResources;
FRDGTextureRef InstancedEditorDepthTexture = nullptr; // Used to pass instanced stereo depth data from primary to secondary views
GraphBuilder.FlushSetupQueue();
if (ViewFamily.UseDebugViewPS())
{
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
const FViewInfo& View = Views[ViewIndex];
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileDistortionPass.cpp:49
Scope: file
Source code excerpt:
auto* Parameters = GraphBuilder.AllocParameters<FMobileDistortionPassUniformParameters>();
EMobileSceneTextureSetupMode SetupMode = EMobileSceneTextureSetupMode::None;
if (View.bCustomDepthStencilValid)
{
SetupMode |= EMobileSceneTextureSetupMode::CustomDepth;
}
if (MobileRequiresSceneDepthAux(View.GetShaderPlatform()))
{
SetupMode |= EMobileSceneTextureSetupMode::SceneDepthAux;
}
else
{
SetupMode |= EMobileSceneTextureSetupMode::SceneDepth;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileSeparateTranslucencyPass.cpp:48
Scope (from outer to inner):
file
function void AddMobileSeparateTranslucencyPass
Source code excerpt:
}
PassParameters->RenderTargets.SubpassHint = ESubpassHint::DepthReadSubpass;
}
PassParameters->RenderTargets.DepthStencil = FDepthStencilBinding(Inputs.SceneDepth.Texture, ERenderTargetLoadAction::ELoad, ERenderTargetLoadAction::ELoad, FExclusiveDepthStencil::DepthRead_StencilRead);
PassParameters->View = View.ViewUniformBuffer;
EMobileSceneTextureSetupMode SetupMode = EMobileSceneTextureSetupMode::SceneDepth | EMobileSceneTextureSetupMode::SceneDepthAux | EMobileSceneTextureSetupMode::CustomDepth;
PassParameters->MobileBasePass = CreateMobileBasePassUniformBuffer(GraphBuilder, View, EMobileBasePass::Translucent, SetupMode);
const_cast<FViewInfo&>(View).ParallelMeshDrawCommandPasses[EMeshPass::TranslucencyAfterDOF].BuildRenderingCommands(GraphBuilder, Scene->GPUScene, PassParameters->InstanceCullingDrawParams);
GraphBuilder.AddPass(
RDG_EVENT_NAME("SeparateTranslucency %dx%d", View.ViewRect.Width(), View.ViewRect.Height()),
PassParameters,
ERDGPassFlags::Raster,
[&View, PassParameters, bSinglePassRendering](FRHICommandList& RHICmdList)
{
if (bSinglePassRendering)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:142
Scope (from outer to inner):
file
function static FMobileCustomDepthStencilUsage GetCustomDepthStencilUsage
Source code excerpt:
FMobileCustomDepthStencilUsage CustomDepthStencilUsage;
// Find out whether there are primitives will render in custom depth pass or just always render custom depth
if ((View.bHasCustomDepthPrimitives || GetCustomDepthMode() == ECustomDepthMode::EnabledWithStencil))
{
// Find out whether CustomDepth/Stencil used in translucent materials
if (CVarMobileCustomDepthForTranslucency.GetValueOnAnyThread() != 0)
{
CustomDepthStencilUsage.bUsesCustomDepthStencil = View.bUsesCustomDepth || View.bUsesCustomStencil;
CustomDepthStencilUsage.bSamplesCustomStencil = View.bUsesCustomStencil;
}
if (!CustomDepthStencilUsage.bSamplesCustomStencil)
{
// Find out whether post-process materials use CustomDepth/Stencil lookups
const FBlendableManager& BlendableManager = View.FinalPostProcessSettings.BlendableManager;
FBlendableEntry* BlendableIt = nullptr;
while (FPostProcessMaterialNode* DataPtr = BlendableManager.IterateBlendables<FPostProcessMaterialNode>(BlendableIt))
{
if (DataPtr->IsValid())
{
FMaterialRenderProxy* Proxy = DataPtr->GetMaterialInterface()->GetRenderProxy();
check(Proxy);
const FMaterial& Material = Proxy->GetIncompleteMaterialWithFallback(View.GetFeatureLevel());
const FMaterialShaderMap* MaterialShaderMap = Material.GetRenderingThreadShaderMap();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:219
Scope (from outer to inner):
file
function static bool PostProcessUsesSceneDepth
Source code excerpt:
RENDER_TARGET_BINDING_SLOTS()
END_SHADER_PARAMETER_STRUCT()
static bool PostProcessUsesSceneDepth(const FViewInfo& View)
{
// Find out whether post-process materials use CustomDepth/Stencil lookups
const FBlendableManager& BlendableManager = View.FinalPostProcessSettings.BlendableManager;
FBlendableEntry* BlendableIt = nullptr;
while (FPostProcessMaterialNode* DataPtr = BlendableManager.IterateBlendables<FPostProcessMaterialNode>(BlendableIt))
{
if (DataPtr->IsValid())
{
FMaterialRenderProxy* Proxy = DataPtr->GetMaterialInterface()->GetRenderProxy();
check(Proxy);
const FMaterial& Material = Proxy->GetIncompleteMaterialWithFallback(View.GetFeatureLevel());
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:1166
Scope (from outer to inner):
file
function void FMobileSceneRenderer::Render
Source code excerpt:
// Custom depth
// bShouldRenderCustomDepth has been initialized in InitViews on mobile platform
if (bShouldRenderCustomDepth)
{
RenderCustomDepthPass(GraphBuilder, SceneTextures.CustomDepth, SceneTextures.GetSceneTextureShaderParameters(FeatureLevel), {}, {});
}
}
else
{
SetDummyLocalFogVolumeForViews(GraphBuilder, Views);
}
// Sort objects' triangles
for (FViewInfo& View : Views)
{
if (View.ShouldRenderView() && OIT::IsSortedTrianglesEnabled(View.GetShaderPlatform()))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:1545
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderForward
Source code excerpt:
FMobileBasePassTextures MobileBasePassTextures{};
MobileBasePassTextures.ScreenSpaceAO = bRequiresAmbientOcclusionPass ? SceneTextures.ScreenSpaceAO : SystemTextures.White;
MobileBasePassTextures.DBufferTextures = DBufferTextures;
EMobileSceneTextureSetupMode SetupMode = (bIsFullDepthPrepassEnabled ? EMobileSceneTextureSetupMode::SceneDepth : EMobileSceneTextureSetupMode::None) | EMobileSceneTextureSetupMode::CustomDepth;
FMobileRenderPassParameters* PassParameters = GraphBuilder.AllocParameters<FMobileRenderPassParameters>();
PassParameters->View = View.GetShaderParameters();
PassParameters->MobileBasePass = CreateMobileBasePassUniformBuffer(GraphBuilder, View, EMobileBasePass::Opaque, SetupMode, MobileBasePassTextures);
PassParameters->ReflectionCapture = View.MobileReflectionCaptureUniformBuffer;
PassParameters->RenderTargets = BasePassRenderTargets;
PassParameters->LocalFogVolumeInstances = View.LocalFogVolumeViewData.GPUInstanceDataBufferSRV;
PassParameters->LocalFogVolumeTileDrawIndirectBuffer = View.LocalFogVolumeViewData.GPUTileDrawIndirectBuffer;
PassParameters->LocalFogVolumeTileDataTexture = View.LocalFogVolumeViewData.TileDataTextureArraySRV;
PassParameters->LocalFogVolumeTileDataBuffer = View.LocalFogVolumeViewData.GPUTileDataBufferSRV;
PassParameters->HalfResLocalFogVolumeViewSRV = View.LocalFogVolumeViewData.HalfResLocalFogVolumeViewSRV;
PassParameters->HalfResLocalFogVolumeDepthSRV = View.LocalFogVolumeViewData.HalfResLocalFogVolumeDepthSRV;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:1701
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderForwardMultiPass
Source code excerpt:
{
// FIXME: modulated shadows write to stencil
ExclusiveDepthStencil = FExclusiveDepthStencil::DepthRead_StencilWrite;
}
EMobileSceneTextureSetupMode SetupMode = EMobileSceneTextureSetupMode::SceneDepth | EMobileSceneTextureSetupMode::SceneDepthAux | EMobileSceneTextureSetupMode::CustomDepth;
FMobileRenderPassParameters* SecondPassParameters = GraphBuilder.AllocParameters<FMobileRenderPassParameters>();
*SecondPassParameters = *PassParameters;
SecondPassParameters->MobileBasePass = CreateMobileBasePassUniformBuffer(GraphBuilder, View, EMobileBasePass::Translucent, SetupMode);
SecondPassParameters->ReflectionCapture = View.MobileReflectionCaptureUniformBuffer;
SecondPassParameters->RenderTargets[0].SetLoadAction(ERenderTargetLoadAction::ELoad);
SecondPassParameters->RenderTargets[1] = FRenderTargetBinding();
SecondPassParameters->RenderTargets.DepthStencil.SetDepthLoadAction(ERenderTargetLoadAction::ELoad);
SecondPassParameters->RenderTargets.DepthStencil.SetStencilLoadAction(ERenderTargetLoadAction::ELoad);
SecondPassParameters->RenderTargets.DepthStencil.SetDepthStencilAccess(ExclusiveDepthStencil);
const bool bDoOcclusionQueries = (!bIsFullDepthPrepassEnabled && ViewContext.bIsLastView && DoOcclusionQueries());
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:1915
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderDeferred
Source code excerpt:
UpdateDirectionalLightUniformBuffers(GraphBuilder, View);
FMobileBasePassTextures MobileBasePassTextures{};
MobileBasePassTextures.ScreenSpaceAO = bRequiresAmbientOcclusionPass ? SceneTextures.ScreenSpaceAO : SystemTextures.White;
EMobileSceneTextureSetupMode SetupMode = (bIsFullDepthPrepassEnabled ? EMobileSceneTextureSetupMode::SceneDepth : EMobileSceneTextureSetupMode::None) | EMobileSceneTextureSetupMode::CustomDepth;
auto* PassParameters = GraphBuilder.AllocParameters<FMobileRenderPassParameters>();
PassParameters->View = View.GetShaderParameters();
PassParameters->MobileBasePass = CreateMobileBasePassUniformBuffer(GraphBuilder, View, EMobileBasePass::Opaque, SetupMode, MobileBasePassTextures);
PassParameters->ReflectionCapture = View.MobileReflectionCaptureUniformBuffer;
PassParameters->RenderTargets = BasePassRenderTargets;
PassParameters->LocalFogVolumeInstances = View.LocalFogVolumeViewData.GPUInstanceDataBufferSRV;
PassParameters->LocalFogVolumeTileDrawIndirectBuffer = View.LocalFogVolumeViewData.GPUTileDrawIndirectBuffer;
PassParameters->LocalFogVolumeTileDataTexture = View.LocalFogVolumeViewData.TileDataTextureArraySRV;
PassParameters->LocalFogVolumeTileDataBuffer = View.LocalFogVolumeViewData.GPUTileDataBufferSRV;
PassParameters->HalfResLocalFogVolumeViewSRV = View.LocalFogVolumeViewData.HalfResLocalFogVolumeViewSRV;
PassParameters->HalfResLocalFogVolumeDepthSRV = View.LocalFogVolumeViewData.HalfResLocalFogVolumeDepthSRV;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:2013
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderDeferredMultiPass
Source code excerpt:
PostRenderBasePass(RHICmdList, View);
});
FViewInfo& View = *ViewContext.ViewInfo;
EMobileSceneTextureSetupMode SetupMode = EMobileSceneTextureSetupMode::SceneDepth | EMobileSceneTextureSetupMode::SceneDepthAux | EMobileSceneTextureSetupMode::CustomDepth;
auto* SecondPassParameters = GraphBuilder.AllocParameters<FMobileRenderPassParameters>();
*SecondPassParameters = *PassParameters;
SecondPassParameters->MobileBasePass = CreateMobileBasePassUniformBuffer(GraphBuilder, View, EMobileBasePass::Translucent, SetupMode);
SecondPassParameters->ReflectionCapture = View.MobileReflectionCaptureUniformBuffer;
// SceneColor + GBuffer write, SceneDepth is read only
for (int32 i = 0; i < NumColorTargets; ++i)
{
SecondPassParameters->RenderTargets[i].SetLoadAction(ERenderTargetLoadAction::ELoad);
}
SecondPassParameters->RenderTargets.DepthStencil.SetDepthLoadAction(ERenderTargetLoadAction::ELoad);
SecondPassParameters->RenderTargets.DepthStencil.SetStencilLoadAction(ERenderTargetLoadAction::ELoad);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteComposition.cpp:579
Scope (from outer to inner):
file
function void EmitCustomDepthStencilTargets
Source code excerpt:
)
{
LLM_SCOPE_BYTAG(Nanite);
RDG_EVENT_SCOPE(GraphBuilder, "Nanite::EmitCustomDepthStencilTargets");
FRDGTextureRef CustomDepth = CustomDepthContext.InputDepth;
FRDGTextureSRVRef CustomStencilSRV = CustomDepthContext.InputStencilSRV;
const FIntPoint CustomDepthExtent = CustomDepth->Desc.Extent;
const bool bWriteCustomStencil = CustomDepthContext.StencilTarget != nullptr;
if (CustomDepthContext.bComputeExport)
{
// Emit custom depth and stencil from a CS that can handle HTILE
if (GNaniteDecompressDepth != 0)
{
// Force depth decompression so the depth shader only processes decompressed surfaces
FDummyDepthDecompressParameters* DecompressParams = GraphBuilder.AllocParameters<FDummyDepthDecompressParameters>();
DecompressParams->SceneDepth = CustomDepth;
GraphBuilder.AddPass(
RDG_EVENT_NAME("NaniteCustomDepthDecompress"),
DecompressParams,
ERDGPassFlags::Copy | ERDGPassFlags::NeverCull,
[](FRHICommandList&) {}
);
}
const FIntRect ViewRect = bDrawSceneViewsInOneNanitePass ? View.GetFamilyViewRect() : View.ViewRect;
const int32 kHTileSize = 8;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteComposition.cpp:610
Scope (from outer to inner):
file
function void EmitCustomDepthStencilTargets
Source code excerpt:
// Export depth
{
const FIntVector DispatchDim = FComputeShaderUtils::GetGroupCount(ViewRect.Size(), kHTileSize);
const uint32 PlatformConfig = RHIGetHTilePlatformConfig(CustomDepthExtent.X, CustomDepthExtent.Y);
FRDGTextureUAVRef CustomDepthUAV = GraphBuilder.CreateUAV(FRDGTextureUAVDesc::CreateForMetaData(CustomDepth, ERDGTextureMetaDataAccess::CompressedSurface));
FRDGTextureUAVRef CustomStencilUAV = GraphBuilder.CreateUAV(FRDGTextureUAVDesc::CreateForMetaData(CustomDepth, ERDGTextureMetaDataAccess::Stencil));
FRDGTextureUAVRef CustomHTileUAV = GraphBuilder.CreateUAV(FRDGTextureUAVDesc::CreateForMetaData(CustomDepth, ERDGTextureMetaDataAccess::HTile));
FDepthExportCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FDepthExportCS::FParameters>();
PassParameters->View = View.GetShaderParameters();
PassParameters->Scene = View.GetSceneUniforms().GetBuffer(GraphBuilder);
PassParameters->InViews = GraphBuilder.CreateSRV(ViewsBuffer);
PassParameters->VisibleClustersSWHW = GraphBuilder.CreateSRV(VisibleClustersSWHW);
PassParameters->PageConstants = PageConstants;
PassParameters->ClusterPageData = Nanite::GStreamingManager.GetClusterPageDataSRV(GraphBuilder);
PassParameters->DepthExportConfig = FIntVector4(PlatformConfig, CustomDepthExtent.X, 0, Nanite::FGlobalResources::GetMaxVisibleClusters());
PassParameters->ViewRect = FUint32Vector4((uint32)ViewRect.Min.X, (uint32)ViewRect.Min.Y, (uint32)ViewRect.Max.X, (uint32)ViewRect.Max.Y);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteComposition.cpp:673
Scope (from outer to inner):
file
function void EmitCustomDepthStencilTargets
Source code excerpt:
PassParameters->InViews = GraphBuilder.CreateSRV(ViewsBuffer);
PassParameters->VisibleClustersSWHW = GraphBuilder.CreateSRV(VisibleClustersSWHW);
PassParameters->PageConstants = PageConstants;
PassParameters->VisBuffer64 = VisBuffer64;
PassParameters->ClusterPageData = Nanite::GStreamingManager.GetClusterPageDataSRV(GraphBuilder);
PassParameters->CustomDepth = CustomDepth;
PassParameters->CustomStencil = CustomStencilSRV;
PassParameters->RenderTargets[0] = OutCustomStencil ? FRenderTargetBinding(OutCustomStencil, ERenderTargetLoadAction::ENoAction) : FRenderTargetBinding();
PassParameters->RenderTargets.DepthStencil = FDepthStencilBinding(OutCustomDepth, ERenderTargetLoadAction::ENoAction, StencilLoadAction, FExclusiveDepthStencil::DepthWrite_StencilNop);
FPixelShaderUtils::AddFullscreenPass(
GraphBuilder,
View.ShaderMap,
OutCustomStencil ? RDG_EVENT_NAME("Emit Custom Depth/Stencil") : RDG_EVENT_NAME("Emit Custom Depth"),
PixelShader,
PassParameters,
bDrawSceneViewsInOneNanitePass ? View.GetFamilyViewRect() : View.ViewRect,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:308
Scope (from outer to inner):
file
function void AddPostProcessingPasses
Source code excerpt:
const FSceneTextureParameters SceneTextureParameters = GetSceneTextureParameters(GraphBuilder, Inputs.SceneTextures);
const FScreenPassRenderTarget ViewFamilyOutput = FScreenPassRenderTarget::CreateViewFamilyOutput(Inputs.ViewFamilyTexture, View);
const FScreenPassTexture SceneDepth(SceneTextureParameters.SceneDepthTexture, PrimaryViewRect);
const FScreenPassTexture CustomDepth(Inputs.CustomDepthTexture, PrimaryViewRect);
const FScreenPassTexture Velocity(SceneTextureParameters.GBufferVelocityTexture, PrimaryViewRect);
const FScreenPassTexture BlackDummy(GSystemTextures.GetBlackDummy(GraphBuilder));
FTranslucencyPassResources PostDOFTranslucencyResources = Inputs.TranslucencyViewResourcesMap.Get(ETranslucencyPass::TPT_TranslucencyAfterDOF);
const FTranslucencyPassResources& PostMotionBlurTranslucencyResources = Inputs.TranslucencyViewResourcesMap.Get(ETranslucencyPass::TPT_TranslucencyAfterMotionBlur);
// Whether should process the alpha channel of the scene color.
const bool bProcessSceneColorAlpha = IsPostProcessingWithAlphaChannelSupported();
const EPixelFormat SceneColorFormat = bProcessSceneColorAlpha ? PF_FloatRGBA : PF_FloatR11G11B10;
// Scene color is updated incrementally through the post process pipeline.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:529
Scope (from outer to inner):
file
function void AddPostProcessingPasses
lambda-function
Source code excerpt:
}
PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::SeparateTranslucency, FScreenPassTexture(PostDOFTranslucencyResources.GetColorForRead(GraphBuilder), ViewRect));
PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::Velocity, Velocity);
PostProcessMaterialInputs.SceneTextures = GetSceneTextureShaderParameters(Inputs.SceneTextures);
PostProcessMaterialInputs.CustomDepthTexture = CustomDepth.Texture;
PostProcessMaterialInputs.bManualStencilTest = Inputs.bSeparateCustomStencil;
PostProcessMaterialInputs.SceneWithoutWaterTextures = &SceneWithoutWaterTextures;
return PostProcessMaterialInputs;
};
const auto AddAfterPass = [&](EPass InPass, FScreenPassTexture InSceneColor) -> FScreenPassTexture
{
// In some cases (e.g. OCIO color conversion) we want View Extensions to be able to add extra custom post processing after the pass.
FAfterPassCallbackDelegateArray& PassCallbacks = PassSequence.GetAfterPassCallbacks(InPass);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:1228
Scope (from outer to inner):
file
function void AddPostProcessingPasses
Source code excerpt:
PassSequence.AcceptOverrideIfLastPass(EPass::Tonemap, PassInputs.OverrideOutput);
PassInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::SceneColor, FScreenPassTexture::CopyFromSlice(GraphBuilder, SceneColorSlice));
//PassInputs.SetInput(EPostProcessMaterialInput::SeparateTranslucency, SeparateTranslucency);
PassInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::CombinedBloom, Bloom);
PassInputs.SceneTextures = GetSceneTextureShaderParameters(Inputs.SceneTextures);
PassInputs.CustomDepthTexture = CustomDepth.Texture;
PassInputs.bManualStencilTest = Inputs.bSeparateCustomStencil;
SceneColor = AddPostProcessMaterialPass(GraphBuilder, View, PassInputs, HighestPriorityMaterial);
}
else
{
FRDGTextureRef ColorGradingTexture = nullptr;
if (bPrimaryView)
{
ColorGradingTexture = AddCombineLUTPass(GraphBuilder, View);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:2106
Scope (from outer to inner):
file
function void AddMobilePostProcessingPasses
Source code excerpt:
const FIntRect FinalOutputViewRect = View.ViewRect;
const FScreenPassRenderTarget ViewFamilyOutput = FScreenPassRenderTarget::CreateViewFamilyOutput(Inputs.ViewFamilyTexture, View);
const FScreenPassTexture SceneDepth((*Inputs.SceneTextures)->SceneDepthTexture, FinalOutputViewRect);
const FScreenPassTexture CustomDepth((*Inputs.SceneTextures)->CustomDepthTexture, FinalOutputViewRect);
const FScreenPassTexture Velocity((*Inputs.SceneTextures)->SceneVelocityTexture, FinalOutputViewRect);
const FScreenPassTexture BlackAlphaOneDummy(GSystemTextures.GetBlackAlphaOneDummy(GraphBuilder));
// Scene color is updated incrementally through the post process pipeline.
FScreenPassTexture SceneColor((*Inputs.SceneTextures)->SceneColorTexture, FinalOutputViewRect);
FScreenPassTexture SceneDepthAux((*Inputs.SceneTextures)->SceneDepthAuxTexture, FinalOutputViewRect);
// Default the new eye adaptation to the last one in case it's not generated this frame.
const FEyeAdaptationParameters EyeAdaptationParameters = GetEyeAdaptationParameters(View);
FRDGBufferRef LastEyeAdaptationBuffer = GetEyeAdaptationBuffer(GraphBuilder, View);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:2235
Scope (from outer to inner):
file
function void AddMobilePostProcessingPasses
lambda-function
Source code excerpt:
// Always evaluate custom post processes
// The scene color will be decoded at the first post-process material and output linear color space for the following passes
// bMetalMSAAHDRDecode will be set to false if there is any post-process material exist
auto AddPostProcessMaterialPass = [&GraphBuilder, &View, &Inputs, &SceneColor, &CustomDepth, &bMetalMSAAHDRDecode, &PassSequence](EBlendableLocation BlendableLocation, bool bLastPass)
{
FPostProcessMaterialInputs PostProcessMaterialInputs;
if (BlendableLocation == BL_SceneColorAfterTonemapping && PassSequence.IsEnabled(EPass::PostProcessMaterialAfterTonemapping))
{
PassSequence.AcceptOverrideIfLastPass(EPass::PostProcessMaterialAfterTonemapping, PostProcessMaterialInputs.OverrideOutput);
}
PostProcessMaterialInputs.SetInput(GraphBuilder, EPostProcessMaterialInput::SceneColor, SceneColor);
PostProcessMaterialInputs.CustomDepthTexture = CustomDepth.Texture;
PostProcessMaterialInputs.bMetalMSAAHDRDecode = bMetalMSAAHDRDecode;
PostProcessMaterialInputs.SceneTextures = GetSceneTextureShaderParameters(Inputs.SceneTextures);
const FPostProcessMaterialChain MaterialChain = GetPostProcessMaterialChain(View, BlendableLocation);
if (MaterialChain.Num())
{
SceneColor = AddPostProcessMaterialChain(GraphBuilder, View, PostProcessMaterialInputs, MaterialChain);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:501
Scope: file
Source code excerpt:
FASTVRAM_CVAR(DOFSetup, 1);
FASTVRAM_CVAR(DOFReduce, 1);
FASTVRAM_CVAR(DOFPostfilter, 1);
FASTVRAM_CVAR(PostProcessMaterial, 1);
FASTVRAM_CVAR(CustomDepth, 0);
FASTVRAM_CVAR(ShadowPointLight, 0);
FASTVRAM_CVAR(ShadowPerObject, 0);
FASTVRAM_CVAR(ShadowCSM, 0);
FASTVRAM_CVAR(DistanceFieldCulledObjectBuffers, 1);
FASTVRAM_CVAR(DistanceFieldTileIntersectionResources, 1);
FASTVRAM_CVAR(DistanceFieldAOScreenGridResources, 1);
FASTVRAM_CVAR(ForwardLightingCullingResources, 1);
FASTVRAM_CVAR(GlobalDistanceFieldCullGridBuffers, 1);
TSharedPtr<FVirtualShadowMapClipmap> FVisibleLightInfo::FindShadowClipmapForView(const FViewInfo* View) const
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:699
Scope (from outer to inner):
file
function void FFastVramConfig::Update
Source code excerpt:
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DBufferC, DBufferC);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DBufferMask, DBufferMask);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DOFSetup, DOFSetup);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DOFReduce, DOFReduce);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DOFPostfilter, DOFPostfilter);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_CustomDepth, CustomDepth);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ShadowPointLight, ShadowPointLight);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ShadowPerObject, ShadowPerObject);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ShadowCSM, ShadowCSM);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_PostProcessMaterial, PostProcessMaterial);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_DistanceFieldCulledObjectBuffers, DistanceFieldCulledObjectBuffers);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_DistanceFieldTileIntersectionResources, DistanceFieldTileIntersectionResources);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_DistanceFieldAOScreenGridResources, DistanceFieldAOScreenGridResources);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_ForwardLightingCullingResources, ForwardLightingCullingResources);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_GlobalDistanceFieldCullGridBuffers, GlobalDistanceFieldCullGridBuffers);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:4213
Scope (from outer to inner):
file
function void FSceneRenderer::SetupMeshPass
Source code excerpt:
if (ViewFamily.UseDebugViewPS() && ShadingPath == EShadingPath::Deferred)
{
switch (PassType)
{
case EMeshPass::DepthPass:
case EMeshPass::CustomDepth:
case EMeshPass::DebugViewMode:
#if WITH_EDITOR
case EMeshPass::HitProxy:
case EMeshPass::HitProxyOpaqueOnly:
case EMeshPass::EditorSelection:
case EMeshPass::EditorLevelInstance:
#endif
break;
default:
continue;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2851
Scope: file
Source code excerpt:
ETextureCreateFlags DOFSetup;
ETextureCreateFlags DOFReduce;
ETextureCreateFlags DOFPostfilter;
ETextureCreateFlags PostProcessMaterial;
ETextureCreateFlags CustomDepth;
ETextureCreateFlags ShadowPointLight;
ETextureCreateFlags ShadowPerObject;
ETextureCreateFlags ShadowCSM;
// Buffers
EBufferUsageFlags DistanceFieldCulledObjectBuffers;
EBufferUsageFlags DistanceFieldTileIntersectionResources;
EBufferUsageFlags DistanceFieldAOScreenGridResources;
EBufferUsageFlags ForwardLightingCullingResources;
EBufferUsageFlags GlobalDistanceFieldCullGridBuffers;
bool bDirty;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextures.cpp:489
Scope (from outer to inner):
file
function void FMinimalSceneTextures::InitializeViewFamily
Source code excerpt:
Desc.NumSamples = Config.NumSamples;
SceneTextures.Color = CreateTextureMSAA(GraphBuilder, Desc, TEXT("SceneColorMS"), TEXT("SceneColor"), GFastVRamConfig.SceneColor | sRGBFlag);
}
// Custom Depth
SceneTextures.CustomDepth = FCustomDepthTextures::Create(GraphBuilder, Config.Extent, Config.ShaderPlatform);
ViewFamily.bIsSceneTexturesInitialized = true;
}
FSceneTextureShaderParameters FMinimalSceneTextures::GetSceneTextureShaderParameters(ERHIFeatureLevel::Type FeatureLevel) const
{
FSceneTextureShaderParameters OutSceneTextureShaderParameters;
if (FeatureLevel >= ERHIFeatureLevel::SM5)
{
OutSceneTextureShaderParameters.SceneTextures = UniformBuffer;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextures.cpp:727
Scope (from outer to inner):
file
function void FSceneTextureExtracts::QueueExtractions
Source code excerpt:
SetupMode |= ESceneTextureSetupMode::SceneDepth;
ExtractIfProduced(SceneTextures.Depth.Resolve, Depth);
ExtractIfProduced(SceneTextures.PartialDepth.Resolve, PartialDepth);
}
if (EnumHasAnyFlags(SceneTextures.Config.Extracts, ESceneTextureExtracts::CustomDepth))
{
SetupMode |= ESceneTextureSetupMode::CustomDepth;
ExtractIfProduced(SceneTextures.CustomDepth.Depth, CustomDepth);
}
// Create and extract a scene texture uniform buffer for RHI code outside of the main render graph instance. This
// uniform buffer will reference all extracted textures. No transitions will be required since the textures are left
// in a shader resource state.
auto* PassParameters = GraphBuilder.AllocParameters<FSceneTextureShaderParameters>();
*PassParameters = CreateSceneTextureShaderParameters(GraphBuilder, &SceneTextures, SceneTextures.Config.FeatureLevel, SetupMode);
// We want these textures in a SRV Compute | Raster state.
const ERDGPassFlags PassFlags = ERDGPassFlags::Raster | ERDGPassFlags::SkipRenderPass | ERDGPassFlags::Compute | ERDGPassFlags::NeverCull;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextures.cpp:759
Scope (from outer to inner):
file
function void FSceneTextureExtracts::Release
Source code excerpt:
}
void FSceneTextureExtracts::Release()
{
Depth = {};
CustomDepth = {};
UniformBuffer = {};
MobileUniformBuffer = {};
}
static TGlobalResource<FSceneTextureExtracts> GSceneTextureExtracts;
const FSceneTextureExtracts& GetSceneTextureExtracts()
{
return GSceneTextureExtracts;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextures.cpp:791
Scope (from outer to inner):
file
function FRDGTextureRef GetSceneTexture
Source code excerpt:
case ESceneTexture::GBufferC: return SceneTextures.GBufferC;
case ESceneTexture::GBufferD: return SceneTextures.GBufferD;
case ESceneTexture::GBufferE: return SceneTextures.GBufferE;
case ESceneTexture::GBufferF: return SceneTextures.GBufferF;
case ESceneTexture::SSAO: return SceneTextures.ScreenSpaceAO;
case ESceneTexture::CustomDepth: return SceneTextures.CustomDepth.Depth;
default:
checkNoEntry();
return nullptr;
}
}
void SetupSceneTextureUniformParameters(
FRDGBuilder& GraphBuilder,
const FSceneTextures* SceneTextures,
ERHIFeatureLevel::Type FeatureLevel,
ESceneTextureSetupMode SetupMode,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextures.cpp:880
Scope (from outer to inner):
file
function void SetupSceneTextureUniformParameters
Source code excerpt:
if (EnumHasAnyFlags(SetupMode, ESceneTextureSetupMode::SSAO) && HasBeenProduced(SceneTextures->ScreenSpaceAO))
{
SceneTextureParameters.ScreenSpaceAOTexture = SceneTextures->ScreenSpaceAO;
}
if (EnumHasAnyFlags(SetupMode, ESceneTextureSetupMode::CustomDepth))
{
const FCustomDepthTextures& CustomDepthTextures = SceneTextures->CustomDepth;
if (HasBeenProduced(CustomDepthTextures.Depth))
{
SceneTextureParameters.CustomDepthTexture = CustomDepthTextures.Depth;
SceneTextureParameters.CustomStencilTexture = CustomDepthTextures.Stencil;
}
}
}
}
TRDGUniformBufferRef<FSceneTextureUniformParameters> CreateSceneTextureUniformBuffer(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextures.cpp:924
Scope (from outer to inner):
file
function EMobileSceneTextureSetupMode Translate
Source code excerpt:
EMobileSceneTextureSetupMode OutSetupMode = EMobileSceneTextureSetupMode::None;
if (EnumHasAnyFlags(InSetupMode, ESceneTextureSetupMode::GBuffers))
{
OutSetupMode |= EMobileSceneTextureSetupMode::SceneColor;
}
if (EnumHasAnyFlags(InSetupMode, ESceneTextureSetupMode::CustomDepth))
{
OutSetupMode |= EMobileSceneTextureSetupMode::CustomDepth;
}
return OutSetupMode;
}
void SetupMobileSceneTextureUniformParameters(
FRDGBuilder& GraphBuilder,
const FSceneTextures* SceneTextures,
EMobileSceneTextureSetupMode SetupMode,
FMobileSceneTextureUniformParameters& SceneTextureParameters)
{
const FRDGSystemTextures& SystemTextures = FRDGSystemTextures::Get(GraphBuilder);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextures.cpp:1031
Scope (from outer to inner):
file
function void SetupMobileSceneTextureUniformParameters
Source code excerpt:
if (HasBeenProduced(SceneTextures->MobileLocalLightTextureB))
{
SceneTextureParameters.LocalLightTextureB = SceneTextures->MobileLocalLightTextureB;
}
if (EnumHasAnyFlags(SetupMode, EMobileSceneTextureSetupMode::CustomDepth))
{
const FCustomDepthTextures& CustomDepthTextures = SceneTextures->CustomDepth;
bool bCustomDepthProduced = HasBeenProduced(CustomDepthTextures.Depth);
SceneTextureParameters.CustomDepthTexture = bCustomDepthProduced ? CustomDepthTextures.Depth : SystemTextures.DepthDummy;
SceneTextureParameters.CustomStencilTexture = bCustomDepthProduced ? CustomDepthTextures.Stencil : SystemTextures.StencilDummySRV;
}
if (EnumHasAnyFlags(SetupMode, EMobileSceneTextureSetupMode::SceneVelocity))
{
if (HasBeenProduced(SceneTextures->Velocity))
{
SceneTextureParameters.SceneVelocityTexture = SceneTextures->Velocity;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:1595
Scope: file
Source code excerpt:
DrawCommandPacket.AddCommandsForMesh(PrimitiveIndex, PrimitiveSceneInfo, StaticMeshRelevance, StaticMesh, CullingPayloadFlags, Scene, bCanCache, EMeshPass::AnisotropyPass);
}
if (ViewRelevance.bRenderCustomDepth)
{
DrawCommandPacket.AddCommandsForMesh(PrimitiveIndex, PrimitiveSceneInfo, StaticMeshRelevance, StaticMesh, CullingPayloadFlags, Scene, bCanCache, EMeshPass::CustomDepth);
}
if (bAddLightmapDensityCommands)
{
DrawCommandPacket.AddCommandsForMesh(PrimitiveIndex, PrimitiveSceneInfo, StaticMeshRelevance, StaticMesh, CullingPayloadFlags, Scene, bCanCache, EMeshPass::LightmapDensity);
}
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
else if (View.Family->UseDebugViewPS())
{
DrawCommandPacket.AddCommandsForMesh(PrimitiveIndex, PrimitiveSceneInfo, StaticMeshRelevance, StaticMesh, CullingPayloadFlags, Scene, bCanCache, EMeshPass::DebugViewMode);
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:2230
Scope (from outer to inner):
file
function static void ComputeDynamicMeshRelevance
Source code excerpt:
View.NumVisibleDynamicMeshElements[EMeshPass::MobileBasePassCSM] += NumElements;
}
if (ViewRelevance.bRenderCustomDepth)
{
PassMask.Set(EMeshPass::CustomDepth);
View.NumVisibleDynamicMeshElements[EMeshPass::CustomDepth] += NumElements;
}
if (bAddLightmapDensityCommands)
{
PassMask.Set(EMeshPass::LightmapDensity);
View.NumVisibleDynamicMeshElements[EMeshPass::LightmapDensity] += NumElements;
}
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
else if (View.Family->UseDebugViewPS())
{
PassMask.Set(EMeshPass::DebugViewMode);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SingleLayerWaterRendering.cpp:1280
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderSingleLayerWaterInner
Source code excerpt:
View.BeginRenderView();
FSingleLayerWaterPassUniformParameters& SLWUniformParameters = *GraphBuilder.AllocParameters<FSingleLayerWaterPassUniformParameters>();
{
const bool bShouldUseBilinearSamplerForDepth = ShouldUseBilinearSamplerForDepthWithoutSingleLayerWater(SceneWithoutWaterTextures.DepthTexture->Desc.Format);
const bool bCustomDepthTextureProduced = HasBeenProduced(SceneTextures.CustomDepth.Depth);
const FIntVector DepthTextureSize = SceneWithoutWaterTextures.DepthTexture->Desc.GetSize();
SLWUniformParameters.SceneColorWithoutSingleLayerWaterTexture = SceneWithoutWaterTextures.ColorTexture;
SLWUniformParameters.SceneColorWithoutSingleLayerWaterSampler = TStaticSamplerState<SF_Bilinear>::GetRHI();
SLWUniformParameters.SceneDepthWithoutSingleLayerWaterTexture = SceneWithoutWaterTextures.DepthTexture;
SLWUniformParameters.SceneDepthWithoutSingleLayerWaterSampler = bShouldUseBilinearSamplerForDepth ? TStaticSamplerState<SF_Bilinear>::GetRHI() : TStaticSamplerState<SF_Point>::GetRHI();
SLWUniformParameters.CustomDepthTexture = bCustomDepthTextureProduced ? SceneTextures.CustomDepth.Depth : SystemTextures.DepthDummy;
SLWUniformParameters.CustomStencilTexture = bCustomDepthTextureProduced ? SceneTextures.CustomDepth.Stencil : SystemTextures.StencilDummySRV;
SLWUniformParameters.CustomDepthSampler = TStaticSamplerState<SF_Point>::GetRHI();
SLWUniformParameters.SceneWithoutSingleLayerWaterMinMaxUV = SceneWithoutWaterTextures.Views[ViewIndex].MinMaxUV;
SetupDistortionParams(SLWUniformParameters.DistortionParams, View);
SLWUniformParameters.SceneWithoutSingleLayerWaterTextureSize = FVector2f(DepthTextureSize.X, DepthTextureSize.Y);
SLWUniformParameters.SceneWithoutSingleLayerWaterInvTextureSize = FVector2f(1.0f / DepthTextureSize.X, 1.0f / DepthTextureSize.Y);
SLWUniformParameters.bMainDirectionalLightVSMFiltering = IsWaterVirtualShadowMapFilteringEnabled_Runtime(View.GetShaderPlatform());
SLWUniformParameters.bSeparateMainDirLightLuminance = NeedsSeparatedMainDirectionalLightTexture_Runtime(View.GetShaderPlatform());
// Only use blue noise resources if VSM quality is set to high
if (IsVSMTranslucentHighQualityEnabled())
{
SLWUniformParameters.BlueNoise = GetBlueNoiseParameters();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:665
Scope (from outer to inner):
file
function void SetupDefaultRenderVolumetricCloudGlobalParameters
Source code excerpt:
ESceneTextureSetupMode SceneTextureSetupMode = ESceneTextureSetupMode::All;
EnumRemoveFlags(SceneTextureSetupMode, ESceneTextureSetupMode::SceneColor);
EnumRemoveFlags(SceneTextureSetupMode, ESceneTextureSetupMode::SceneVelocity);
EnumRemoveFlags(SceneTextureSetupMode, ESceneTextureSetupMode::GBuffers);
EnumRemoveFlags(SceneTextureSetupMode, ESceneTextureSetupMode::SSAO);
SetupSceneTextureUniformParameters(GraphBuilder, ViewInfo.GetSceneTexturesChecked(), ViewInfo.FeatureLevel, ESceneTextureSetupMode::CustomDepth, VolumetricCloudParams.SceneTextures);
}
//////////////////////////////////////////////////////////////////////////
class FRenderVolumetricCloudVS : public FMeshMaterialShader
{
DECLARE_SHADER_TYPE(FRenderVolumetricCloudVS, MeshMaterial);
public:
FRenderVolumetricCloudVS(const ShaderMetaType::CompiledShaderInitializerType& Initializer)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/MeshPassProcessor.h:50
Scope (from outer to inner):
file
namespace EMeshPass
Source code excerpt:
TranslucencyAfterDOFModulate,
TranslucencyAfterMotionBlur,
TranslucencyAll, /** Drawing all translucency, regardless of separate or standard. Used when drawing translucency outside of the main renderer, eg FRendererModule::DrawTile. */
LightmapDensity,
DebugViewMode, /** Any of EDebugViewShaderMode */
CustomDepth,
MobileBasePassCSM, /** Mobile base pass with CSM shading enabled */
VirtualTexture,
LumenCardCapture,
LumenCardNanite,
LumenTranslucencyRadianceCacheMark,
LumenFrontLayerTranslucencyGBuffer,
DitheredLODFadingOutMaskPass, /** A mini depth pass used to mark pixels with dithered LOD fading out. Currently only used by ray tracing shadows. */
NaniteMeshPass,
MeshDecal,
WaterInfoTextureDepthPass,
WaterInfoTexturePass,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/MeshPassProcessor.h:101
Scope (from outer to inner):
file
function inline const TCHAR* GetMeshPassName
Source code excerpt:
case EMeshPass::TranslucencyAfterDOFModulate: return TEXT("TranslucencyAfterDOFModulate");
case EMeshPass::TranslucencyAfterMotionBlur: return TEXT("TranslucencyAfterMotionBlur");
case EMeshPass::TranslucencyAll: return TEXT("TranslucencyAll");
case EMeshPass::LightmapDensity: return TEXT("LightmapDensity");
case EMeshPass::DebugViewMode: return TEXT("DebugViewMode");
case EMeshPass::CustomDepth: return TEXT("CustomDepth");
case EMeshPass::MobileBasePassCSM: return TEXT("MobileBasePassCSM");
case EMeshPass::VirtualTexture: return TEXT("VirtualTexture");
case EMeshPass::LumenCardCapture: return TEXT("LumenCardCapture");
case EMeshPass::LumenCardNanite: return TEXT("LumenCardNanite");
case EMeshPass::LumenTranslucencyRadianceCacheMark: return TEXT("LumenTranslucencyRadianceCacheMark");
case EMeshPass::LumenFrontLayerTranslucencyGBuffer: return TEXT("LumenFrontLayerTranslucencyGBuffer");
case EMeshPass::DitheredLODFadingOutMaskPass: return TEXT("DitheredLODFadingOutMaskPass");
case EMeshPass::NaniteMeshPass: return TEXT("NaniteMeshPass");
case EMeshPass::MeshDecal: return TEXT("MeshDecal");
case EMeshPass::WaterInfoTextureDepthPass: return TEXT("WaterInfoTextureDepthPass");
case EMeshPass::WaterInfoTexturePass: return TEXT("WaterInfoTexturePass");
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/SceneRenderTargetParameters.h:18
Scope: file
Source code excerpt:
GBufferC,
GBufferD,
GBufferE,
GBufferF,
SSAO,
CustomDepth,
};
RENDERER_API FRDGTextureRef GetSceneTexture(const FSceneTextures& SceneTextures, ESceneTexture InSceneTexture);
enum class ESceneTextureSetupMode : uint32
{
None = 0,
SceneColor = 1 << 0,
SceneDepth = 1 << 1,
SceneVelocity = 1 << 2,
GBufferA = 1 << 3,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/SceneRenderTargetParameters.h:36
Scope: file
Source code excerpt:
GBufferC = 1 << 5,
GBufferD = 1 << 6,
GBufferE = 1 << 7,
GBufferF = 1 << 8,
SSAO = 1 << 9,
CustomDepth = 1 << 10,
GBuffers = GBufferA | GBufferB | GBufferC | GBufferD | GBufferE | GBufferF,
All = SceneColor | SceneDepth | SceneVelocity | GBuffers | SSAO | CustomDepth
};
ENUM_CLASS_FLAGS(ESceneTextureSetupMode);
/** Fills the shader parameter struct. */
extern RENDERER_API void SetupSceneTextureUniformParameters(
FRDGBuilder& GraphBuilder,
const FSceneTextures* SceneTextures,
ERHIFeatureLevel::Type FeatureLevel,
ESceneTextureSetupMode SetupMode,
FSceneTextureUniformParameters& OutParameters);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/SceneRenderTargetParameters.h:68
Scope: file
Source code excerpt:
enum class EMobileSceneTextureSetupMode : uint32
{
None = 0,
SceneColor = 1 << 0,
SceneDepth = 1 << 1,
CustomDepth = 1 << 2,
GBufferA = 1 << 3,
GBufferB = 1 << 4,
GBufferC = 1 << 5,
GBufferD = 1 << 6,
SceneDepthAux = 1 << 7,
SceneVelocity = 1 << 8,
GBuffers = GBufferA | GBufferB | GBufferC | GBufferD | SceneDepthAux,
All = SceneColor | SceneDepth | CustomDepth | GBuffers | SceneVelocity
};
ENUM_CLASS_FLAGS(EMobileSceneTextureSetupMode);
/** Fills the scene texture uniform buffer struct. */
extern RENDERER_API void SetupMobileSceneTextureUniformParameters(
FRDGBuilder& GraphBuilder,
const FSceneTextures* SceneTextures,
EMobileSceneTextureSetupMode SetupMode,
FMobileSceneTextureUniformParameters& SceneTextureParameters);
/** Creates the RDG mobile scene texture uniform buffer. */
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/SceneRenderTargetParameters.h:154
Scope (from outer to inner):
file
class class FSceneTextureExtracts : public FRenderResource
Source code excerpt:
// Contains the resolved scene depth target.
TRefCountPtr<IPooledRenderTarget> PartialDepth;
// Contains the custom depth targets.
TRefCountPtr<IPooledRenderTarget> CustomDepth;
// Contains RHI scene texture uniform buffers referencing the extracted textures.
TUniformBufferRef<FSceneTextureUniformParameters> UniformBuffer;
TUniformBufferRef<FMobileSceneTextureUniformParameters> MobileUniformBuffer;
};
/** Returns the global scene texture extracts struct. */
const RENDERER_API FSceneTextureExtracts& GetSceneTextureExtracts();
/** Pass through to View.GetSceneTexturesConfig().Extent, useful in headers where the FViewInfo structure isn't exposed. */
extern RENDERER_API FIntPoint GetSceneTextureExtentFromView(const FViewInfo& View);