![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <ShadowRendering.h>
Inheritance diagram for FProjectedShadowInfo:Public Types | |
| enum class | EGatherDynamicMeshElementsPass : uint8 { All , Parallel , Serial } |
| typedef TArray< const FPrimitiveSceneInfo *, SceneRenderingAllocator > | PrimitiveArrayType |
Static Public Member Functions | |
| static bool | SupportsShadowStencilCulling (FStaticShaderPlatform ShaderPlatform) |
| static FRHIBlendState * | GetBlendStateForProjection (int32 ShadowMapChannel, bool bIsWholeSceneDirectionalShadow, bool bUseFadePlane, bool bProjectingForForwardShading, bool bMobileModulatedProjections) |
Friends | |
| class | FVirtualShadowMapArray |
| class | FShadowDepthVS |
| class | FShadowDepthBasePS |
| class | FShadowVolumeBoundProjectionVS |
| class | FShadowProjectionPS |
| uint32 | GetTypeHash (const FProjectedShadowInfo *ProjectedShadowInfo) |
Information about a projected shadow.
| typedef TArray<const FPrimitiveSceneInfo*,SceneRenderingAllocator> FProjectedShadowInfo::PrimitiveArrayType |
|
strong |
| FProjectedShadowInfo::FProjectedShadowInfo | ( | ) |
| FProjectedShadowInfo::~FProjectedShadowInfo | ( | ) |
| void FProjectedShadowInfo::AddReceiverPrimitive | ( | FPrimitiveSceneInfo * | PrimitiveSceneInfo | ) |
Adds a primitive to the shadow's receiver list.
| bool FProjectedShadowInfo::AddSubjectPrimitive | ( | FPrimitiveSceneInfo * | PrimitiveSceneInfo, |
| TArrayView< FViewInfo > | ViewArray, | ||
| bool | bRecordShadowSubjectForMobileShading, | ||
| bool | bInvertViewShadowRelevance = false |
||
| ) |
Adds a primitive to the shadow's subject list.
| uint64 FProjectedShadowInfo::AddSubjectPrimitive_AnyThread | ( | const FPrimitiveSceneInfoCompact & | PrimitiveSceneInfoCompact, |
| TArrayView< FViewInfo > | ViewArray, | ||
| ERHIFeatureLevel::Type | FeatureLevel, | ||
| struct FAddSubjectPrimitiveStats & | OutStats, | ||
| struct FAddSubjectPrimitiveOverflowedIndices & | OverflowBuffer | ||
| ) | const |
|
inline |
| void FProjectedShadowInfo::ClearDepth | ( | FRHICommandList & | RHICmdList | ) | const |
| void FProjectedShadowInfo::ClearTransientArrays | ( | ) |
Clears arrays allocated with the scene rendering allocator.
Clears arrays allocated with the scene rendering allocator. Cached preshadows are reused across frames so scene rendering allocations will be invalid.
| void FProjectedShadowInfo::ComputeScissorRectOptim | ( | ) |
Compute the scissors coords to exclude portion of the CSM slices outside the view frustum
| float FProjectedShadowInfo::ComputeTransitionSize | ( | ) | const |
How large the soft PCF comparison should be, similar to DepthBias, before this was called TransitionScale and 1/Size
| void FProjectedShadowInfo::FinalizeAddSubjectPrimitive | ( | FDynamicShadowsTaskData & | TaskData, |
| struct FAddSubjectPrimitiveOp const & | Op, | ||
| TArrayView< FViewInfo > | ViewArray, | ||
| struct FFinalizeAddSubjectPrimitiveContext & | Context | ||
| ) |
| bool FProjectedShadowInfo::GatherDynamicMeshElements | ( | FMeshElementCollector & | MeshCollector, |
| FSceneRenderer & | Renderer, | ||
| class FVisibleLightInfo & | VisibleLightInfo, | ||
| TArray< const FSceneView * > & | ReusedViewsArray, | ||
| EGatherDynamicMeshElementsPass | Pass | ||
| ) |
Gathers dynamic mesh elements for all the shadow's primitives arrays.
| FRHIBlendState * FProjectedShadowInfo::GetBlendStateForProjection | ( | bool | bProjectingForForwardShading, |
| bool | bMobileModulatedProjections | ||
| ) | const |
|
static |
| FVector4f FProjectedShadowInfo::GetClipToShadowBufferUvScaleBias | ( | ) | const |
|
inline |
|
inline |
Get view rect excluding border area
|
inline |
|
inline |
|
inline |
|
inline |
Get view rect including border area
|
inline |
Parent primitive of the shadow group that created this shadow, if not a bWholeSceneShadow. 0 if Setup...() wasn't called yet
|
inline |
Returns a matrix that transforms a screen space position into shadow space.
| FMatrix FProjectedShadowInfo::GetScreenToShadowMatrix | ( | const FSceneView & | View, |
| uint32 | TileOffsetX, | ||
| uint32 | TileOffsetY, | ||
| uint32 | TileResolutionX, | ||
| uint32 | TileResolutionY | ||
| ) | const |
Returns a matrix that transforms a screen space position into shadow space. Additional parameters allow overriding of shadow's tile location. Used with modulated shadows to reduce precision problems when calculating ScreenToShadow in pixel shader.
|
inline |
|
inline |
| float FProjectedShadowInfo::GetShaderReceiverDepthBias | ( | ) | const |
|
inline |
|
inline |
Returns the resolution of the shadow buffer used for this shadow, based on the shadow's type.
|
inline |
| FViewMatrices FProjectedShadowInfo::GetShadowDepthRenderingViewMatrices | ( | int32 | CubeFaceIndex = -1, |
| bool | bUseForVSMCubeFaceWorkaround = false |
||
| ) | const |
Get FViewMatrices instance set up for drawing geometry to the SM, using the outer projection, @parameter bUseForVSMCubeFaceWorkaround - If true, when get a cube face the OnePassShadowViewMatrices is flipped in Y to undo the flip used when creating OnePassShadowViewMatrices. This is also done when sampling the VSM.
|
inline |
|
inline |
| FMatrix FProjectedShadowInfo::GetWorldToShadowMatrix | ( | FVector4f & | ShadowmapMinMax, |
| const FIntPoint * | ShadowBufferResolutionOverride = nullptr |
||
| ) | const |
Returns a matrix that transforms a world space position into shadow space.
| bool FProjectedShadowInfo::HasSubjectPrims | ( | ) | const |
|
inline |
| bool FProjectedShadowInfo::IsWholeSceneDirectionalShadow | ( | ) | const |
| bool FProjectedShadowInfo::IsWholeScenePointLightShadow | ( | ) | const |
| void FProjectedShadowInfo::PresizeSubjectPrimitiveArrays | ( | struct FAddSubjectPrimitiveStats const & | Stats | ) |
| void FProjectedShadowInfo::RenderDepth | ( | FRDGBuilder & | GraphBuilder, |
| const FSceneRenderer * | SceneRenderer, | ||
| FRDGTextureRef | ShadowDepthTexture, | ||
| bool | bDoParallelDispatch, | ||
| bool | bDoCrossGPUCopy | ||
| ) |
Renders the shadow subject depth, to a particular hacked view
| void FProjectedShadowInfo::RenderFrustumWireframe | ( | FPrimitiveDrawInterface * | PDI | ) | const |
Renders the projected shadow's frustum wireframe with the given FPrimitiveDrawInterface.
| void FProjectedShadowInfo::RenderMobileModulatedShadowProjection | ( | FRHICommandList & | RHICmdList, |
| int32 | ViewIndex, | ||
| const FViewInfo * | View, | ||
| const FLightSceneProxy * | LightSceneProxy, | ||
| const FSceneRenderer * | SceneRender | ||
| ) | const |
Projects the mobile modulated shadow onto the scene for a particular view.
| void FProjectedShadowInfo::RenderOnePassPointLightProjection | ( | FRDGBuilder & | GraphBuilder, |
| const FShadowProjectionPassParameters & | CommonPassParameters, | ||
| int32 | ViewIndex, | ||
| const FViewInfo & | View, | ||
| const FLightSceneProxy * | LightSceneProxy, | ||
| bool | bProjectingForForwardShading, | ||
| bool | bSubPixelShadow | ||
| ) | const |
Render one pass point light shadow projections.
| void FProjectedShadowInfo::RenderProjection | ( | FRDGBuilder & | GraphBuilder, |
| const FShadowProjectionPassParameters & | CommonPassParameters, | ||
| int32 | ViewIndex, | ||
| const FViewInfo * | View, | ||
| const FLightSceneProxy * | LightSceneProxy, | ||
| const FSceneRenderer * | SceneRender, | ||
| bool | bProjectingForForwardShading, | ||
| bool | bSubPixelShadow | ||
| ) | const |
Projects the shadow onto the scene for a particular view.
| void FProjectedShadowInfo::RenderProjectionInternal | ( | FRHICommandList & | RHICmdList, |
| int32 | ViewIndex, | ||
| const FViewInfo * | View, | ||
| const FLightSceneProxy * | LightSceneProxy, | ||
| const FSceneRenderer * | SceneRender, | ||
| bool | bProjectingForForwardShading, | ||
| bool | bMobileModulatedProjections, | ||
| const FInstanceCullingDrawParams & | InstanceCullingDrawParams, | ||
| FRHIUniformBuffer * | HairStrandsUniformBuffer | ||
| ) | const |
| FScreenPassTexture FProjectedShadowInfo::RenderRayTracedDistanceFieldProjection | ( | FRDGBuilder & | GraphBuilder, |
| bool | bAsyncCompute, | ||
| const FMinimalSceneTextures & | SceneTextures, | ||
| const FViewInfo & | View, | ||
| const FIntRect & | ScissorRect | ||
| ) |
Render ray traced distance field shadows into a texture. Output texture is cached per view. This is useful to support async compute. (ie: kick off distance field shadows early in the frame using async compute, and then combine result into shadow mask texture when necessary)
| void FProjectedShadowInfo::RenderRayTracedDistanceFieldProjection | ( | FRDGBuilder & | GraphBuilder, |
| const FMinimalSceneTextures & | SceneTextures, | ||
| FRDGTextureRef | ScreenShadowMaskTexture, | ||
| const FViewInfo & | View, | ||
| FIntRect | ScissorRect, | ||
| bool | bProjectingForForwardShading, | ||
| bool | bForceRGBModulation = false, |
||
| FTiledShadowRendering * | TiledShadowRendering = nullptr |
||
| ) |
Renders ray traced distance field shadows into an existing texture. Will use cached results if already calculated earlier in the frame (ie: async compute)
| void FProjectedShadowInfo::RenderTranslucencyDepths | ( | FRDGBuilder & | GraphBuilder, |
| class FSceneRenderer * | SceneRenderer, | ||
| const FRenderTargetBindingSlots & | RenderTargets, | ||
| FInstanceCullingManager & | InstanceCullingManager | ||
| ) |
Renders shadow maps for translucent primitives.
Reset cached ray traced distance field shadows texture.
| void FProjectedShadowInfo::SetStateForDepth | ( | FMeshPassProcessorRenderState & | DrawRenderState | ) | const |
Set state for depth rendering
| void FProjectedShadowInfo::SetStateForView | ( | FRHICommandList & | RHICmdList, |
| bool | bRequiresBorderClamp = false |
||
| ) | const |
| void FProjectedShadowInfo::SetupClipmapProjection | ( | FLightSceneInfo * | InLightSceneInfo, |
| FViewInfo * | InDependentView, | ||
| const TSharedPtr< FVirtualShadowMapClipmap > & | VirtualShadowMapClipmap, | ||
| float | InMaxNonFarCascadeDistance | ||
| ) |
for a clipmap shadow.
| void FProjectedShadowInfo::SetupMeshDrawCommandsForProjectionStenciling | ( | FSceneRenderer & | Renderer, |
| FInstanceCullingManager & | InstanceCullingManager | ||
| ) |
| void FProjectedShadowInfo::SetupMeshDrawCommandsForShadowDepth | ( | FSceneRenderer & | Renderer, |
| FInstanceCullingManager & | InstanceCullingManager | ||
| ) |
| bool FProjectedShadowInfo::SetupPerObjectProjection | ( | FLightSceneInfo * | InLightSceneInfo, |
| const FPrimitiveSceneInfo * | InParentSceneInfo, | ||
| const FPerObjectProjectedShadowInitializer & | Initializer, | ||
| bool | bInPreShadow, | ||
| uint32 | InResolutionX, | ||
| uint32 | MaxShadowResolutionY, | ||
| uint32 | InBorderSize, | ||
| float | InMaxScreenPercent, | ||
| bool | bInTranslucentShadow | ||
| ) |
for a per-object shadow. e.g. translucent particle system or a dynamic object in a precomputed shadow situation
| InParentSceneInfo | must not be 0 |
| void FProjectedShadowInfo::SetupShadowDepthView | ( | FSceneRenderer * | SceneRenderer | ) |
Creates a new view from the pool and caches it in ShadowDepthView for depth rendering.
| void FProjectedShadowInfo::SetupWholeSceneProjection | ( | FLightSceneInfo * | InLightSceneInfo, |
| FViewInfo * | InDependentView, | ||
| const FWholeSceneProjectedShadowInitializer & | Initializer, | ||
| uint32 | InResolutionX, | ||
| uint32 | InResolutionY, | ||
| uint32 | InSnapResolutionX, | ||
| uint32 | InSnapResolutionY, | ||
| uint32 | InBorderSize | ||
| ) |
for a whole-scene shadow.
|
inline |
| bool FProjectedShadowInfo::ShouldUseCSMScissorOptim | ( | ) | const |
Check if we need to set the scissor rect to exclude portion of the CSM slices outside the view frustum
| View | view to check visibility in |
|
static |
| void FProjectedShadowInfo::UpdateShaderDepthBias | ( | ) |
Computes and updates ShaderDepthBias and ShaderSlopeDepthBias
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
Hash function.
| uint32 FProjectedShadowInfo::bAllocated |
Whether the shadow has been allocated in the shadow depth buffer, and its X and Y properties have been initialized.
| uint32 FProjectedShadowInfo::bAllocatedInPreshadowCache |
Whether the shadow has been allocated in the preshadow cache, so its X and Y properties offset into the preshadow cache depth buffer.
| uint32 FProjectedShadowInfo::bCapsuleShadow |
Whether this is a per-object shadow that should use capsule shapes to shadow instead of the mesh's triangles.
| uint32 FProjectedShadowInfo::bContainsNaniteSubjects |
Whether the the shadow overlaps any nanite primitives
| uint32 FProjectedShadowInfo::bDepthsCached |
Whether the shadow is in the preshadow cache and its depths are up to date.
| uint32 FProjectedShadowInfo::bDirectionalLight |
| uint32 FProjectedShadowInfo::bHairStrandsDeepShadow |
Whether turn on hair strands deep shadow.
| uint32 FProjectedShadowInfo::bNaniteGeometry |
Whether to render Nanite geometry into this shadow map.
| uint32 FProjectedShadowInfo::bOnePassPointLightShadow |
Whether the shadow is a point light shadow that renders all faces of a cubemap in one pass.
| uint32 FProjectedShadowInfo::BorderSize |
Size of the border, if any, used to allow filtering without clamping for shadows stored in an atlas.
| uint32 FProjectedShadowInfo::bPerObjectOpaqueShadow |
Whether the shadow is a per object shadow or not.
| uint32 FProjectedShadowInfo::bPreShadow |
Whether the shadow is a preshadow or not. A preshadow is a per object shadow that handles the static environment casting on a dynamic receiver.
| uint32 FProjectedShadowInfo::bRayTracedDistanceField |
Whether the shadow will be computed by ray tracing the distance field.
| uint32 FProjectedShadowInfo::bRendered |
Whether the shadow's projection has been rendered.
| uint32 FProjectedShadowInfo::bSelfShadowOnly |
To not cast a shadow on the ground outside the object and having higher quality (useful for first person weapon).
| uint32 FProjectedShadowInfo::bShouldRenderVSM |
| uint32 FProjectedShadowInfo::bTranslucentShadow |
Whether this shadow should support casting shadows from translucent surfaces.
| uint32 FProjectedShadowInfo::bTransmission |
Whether turn on back-lighting transmission.
| uint32 FProjectedShadowInfo::bVolumetricShadow |
Whether this shadow should support casting shadows from volumetric surfaces.
| uint32 FProjectedShadowInfo::bVSM |
Whether the shadow is a virtual shadow map.
| uint32 FProjectedShadowInfo::bWholeSceneShadow |
Whether this shadow affects the whole scene or only a group of objects.
| EShadowDepthCacheMode FProjectedShadowInfo::CacheMode |
| FShadowCascadeSettings FProjectedShadowInfo::CascadeSettings |
| FConvexVolume FProjectedShadowInfo::CasterOuterFrustum |
Frustum containing all potential shadow casters. Including border area.
| TArray<FPlane, TInlineAllocator<4> > FProjectedShadowInfo::CSMScrollingExtraCullingPlanes |
The extra culling planes to cull the static meshes which already in the overlapped area when scrolling the cached shadow map.
| float FProjectedShadowInfo::CSMScrollingZOffset |
The Z offset in shadow light coordinate of the cached shadow bound center and current shadow bound center when scrolling the cached shadow map.
| FViewInfo* FProjectedShadowInfo::DependentView |
The main view this shadow must be rendered in, or NULL for a view independent shadow.
| int32 FProjectedShadowInfo::ExplicitNaniteInstanceChunkEndOffset = INDEX_NONE |
| int32 FProjectedShadowInfo::ExplicitNaniteInstanceChunkStartOffset = INDEX_NONE |
| int32 FProjectedShadowInfo::ExplicitNaniteInstanceLastChunkSize = 0 |
| TArray<float, TInlineAllocator<2> > FProjectedShadowInfo::FadeAlphas |
Fade Alpha per view.
| float FProjectedShadowInfo::InvMaxSubjectDepth |
| float FProjectedShadowInfo::InvPerObjectShadowFadeLength |
| FMatrix44f FProjectedShadowInfo::InvReceiverInnerMatrix |
| float FProjectedShadowInfo::MaxScreenPercent |
The largest percent of either the width or height of any view.
| float FProjectedShadowInfo::MaxSubjectZ |
Subject depth extents, in world space units. These can be used to convert shadow depth buffer values back into world space units.
| EShadowMeshSelection FProjectedShadowInfo::MeshSelectionMask = EShadowMeshSelection::All |
| float FProjectedShadowInfo::MinPreSubjectZ |
| float FProjectedShadowInfo::MinSubjectZ |
| FMatrix FProjectedShadowInfo::OnePassShadowFaceProjectionMatrix |
Face projection matrix for cube map shadows.
View matrices for each cubemap face, used by one pass point light shadows.
View projection matrices for each cubemap face, used by one pass point light shadows.
| FVector4f FProjectedShadowInfo::OverlappedUVOnCachedShadowMap |
| FVector4f FProjectedShadowInfo::OverlappedUVOnCurrentShadowMap |
| float FProjectedShadowInfo::PerObjectShadowFadeStart |
Controls fading out of per-object shadows in the distance to avoid casting super-sharp shadows far away.
| FVector FProjectedShadowInfo::PreShadowTranslation |
A translation that is applied to world-space before transforming by one of the shadow matrices.
| int32 FProjectedShadowInfo::ProjectionIndex = 0 |
Projection index for light types that use multiple projections for shadows.
| FConvexVolume FProjectedShadowInfo::ReceiverInnerFrustum |
Frustum containing all shadow receivers. Excluding border area.
| FShadowMapRenderTargets FProjectedShadowInfo::RenderTargets |
The depth or color targets this shadow was rendered to.
| uint32 FProjectedShadowInfo::ResolutionX |
Resolution of the shadow, excluding the border. The full size of the region allocated to this shadow is therefore ResolutionX + 2 * BorderSize, ResolutionY + 2 * BorderSize.
| uint32 FProjectedShadowInfo::ResolutionY |
| FIntRect FProjectedShadowInfo::ScissorRectOptim |
Scissor rect size to exclude portion of the CSM slices outside the view frustum
| FSphere FProjectedShadowInfo::ShadowBounds |
| FViewInfo* FProjectedShadowInfo::ShadowDepthView |
The view to be used when rendering this shadow's depths. WARNING: This view is a bastardization of the 'main view' - i.e., the view used to render the visible geometry (or one of them in the case of multi-view, e.g., split screen) the only substantial differences are that the view matrix is overridden (using the 'HackOverrideViewMatrixForShadows') and the 'HackRemoveTemporalAAProjectionJitter' has been called, to presumably remove the AA Jitter. IT DOES NOT contain the correct shadow projection matrix, PreViewTranslation, or much else that you would expect. Instead use the GetShadowDepthRenderingViewMatrices() function to get these for rendering shadows. Main reason for this state of affairs is to facilitate code that depends on the 'main' view matrices for LOD calculations in various places.
| int32 FProjectedShadowInfo::ShadowId |
Index of the shadow into FVisibleLightInfo::AllProjectedShadows.
| int32 FProjectedShadowInfo::SubjectPrimitiveComponentIndex = -1 |
Index of the subject primitive for per object shadows.
| FMatrix44f FProjectedShadowInfo::TranslatedWorldToClipInnerMatrix |
Matrix used for rendering the shadow depth buffer.
Note that this does not necessarily contain all of the shadow casters with CSM, since the vertex shader flattens them onto the near plane of the projection.
| FMatrix44f FProjectedShadowInfo::TranslatedWorldToClipOuterMatrix |
| FMatrix FProjectedShadowInfo::TranslatedWorldToView |
The view matrix of the shadow, ALSO used as an override to the main view's view matrix when rendering the shadow depth pass.
| TArray<int32, TInlineAllocator<6> > FProjectedShadowInfo::ViewIds |
| FMatrix FProjectedShadowInfo::ViewToClipInner |
View space to clip space. Excluding border area.
| FMatrix FProjectedShadowInfo::ViewToClipOuter |
View space to clip space. Including border area.
| TSharedPtr<FVirtualShadowMapClipmap> FProjectedShadowInfo::VirtualShadowMapClipmap |
| TSharedPtr<FVirtualShadowMapPerLightCacheEntry> FProjectedShadowInfo::VirtualShadowMapPerLightCacheEntry |
| uint32 FProjectedShadowInfo::X |
X and Y position of the shadow in the appropriate depth buffer. These are only initialized after the shadow has been allocated. The actual contents of the shadowmap are at X + BorderSize, Y + BorderSize.
| uint32 FProjectedShadowInfo::Y |