Logo Mibo

ShadowResources Type

Owns the shadow atlas + depth effect + pooled scratch the shadow pass needs, reused across frames. Constructed once by the pipeline; EnsureResources allocates the GPU atlas lazily against the real device on the first shadow pass.

Constructors

Constructor Description

ShadowResources(atlasCfg, biasCfg)

Full Usage: ShadowResources(atlasCfg, biasCfg)

Parameters:
Returns: ShadowResources
atlasCfg : ShadowAtlasConfig
biasCfg : ShadowBiasConfig
Returns: ShadowResources

Instance members

Instance member Description

this.Atlas

Full Usage: this.Atlas

Returns: ShadowAtlas

The shadow atlas (owns the R32F RenderTarget2D, allocated lazily).

Returns: ShadowAtlas

this.BiasesScratch

Full Usage: this.BiasesScratch

Returns: float32 array

Pooled scratch for the per-caster shadowBiases upload (receiver-side depth bias). Copied from Atlas.Biases each frame.

Returns: float32 array

this.BonePaletteScratch

Full Usage: this.BonePaletteScratch

Returns: Matrix array

Pooled bone-palette staging array for skinned casters (B12). Shader's MAX_BONES is 128.

Returns: Matrix array

this.CollectCastEnabled

Full Usage: this.CollectCastEnabled

Returns: bool

Running EnableShadows/DisableShadows state while a collection walk is in progress (set by ShadowPass.beginCollect, read by ShadowPass.collectCommand). Outside a collection walk its value is stale.

Returns: bool

this.CollectedDrawCount

Full Usage: this.CollectedDrawCount

Returns: int

Opaque-geometry counts from the last unified collection. Populated whenever the shadow pass or a scene-depth pass collected geometry. The scene-depth render reads the same collected arrays (all entries), while the shadow render reads only CastsShadow entries.

Returns: int

this.CollectedInstancedCount

Full Usage: this.CollectedInstancedCount

Returns: int
Returns: int

this.CollectedModelPartCount

Full Usage: this.CollectedModelPartCount

Returns: int
Returns: int

this.CollectedSkinnedCount

Full Usage: this.CollectedSkinnedCount

Returns: int
Returns: int

this.CollectedSkinnedInstancedCount

Full Usage: this.CollectedSkinnedInstancedCount

Returns: int
Returns: int

this.Draws

Full Usage: this.Draws

Returns: ShadowMeshDraw array

Pooled caster mesh draws collected from the buffer (gated by EnableShadows/DisableShadows).

Returns: ShadowMeshDraw array

this.Effect

Full Usage: this.Effect

Returns: Effect voption

The depth-only effect (DepthShadow.fx), loaded lazily on first shadow pass.

Returns: Effect voption

this.Frustum

Full Usage: this.Frustum

Returns: BoundingFrustum

Reused per-caster frustum (updated in-place via .Matrix) to avoid per-frame allocation.

Returns: BoundingFrustum

this.GroupChunkScratch

Full Usage: this.GroupChunkScratch

Returns: (int * int * Texture2D)[]

Pooled DX12 group descriptors ((start, count, null-texture) triples) for the grouped-uniform skinned + instanced depth path; grown on demand — see PaletteGroup.planGroups.

Returns: (int * int * Texture2D)[]

this.GroupPaletteScratch

Full Usage: this.GroupPaletteScratch

Returns: Matrix[]

Pooled bone-palette scratch for the grouped-uniform skinned + instanced depth path (the DX12 fallback — DepthSkinnedInstancedGrouped). Sized to PaletteGroup.MaxMatricesDepth; grown on demand.

Returns: Matrix[]

this.GroupedEffect

Full Usage: this.GroupedEffect

Returns: Effect voption
The isolated grouped-uniform depth effect (DepthShadowGrouped.fx), loaded lazily
 on DX12 only. On DX12 the main DepthShadow.fx's bonePaletteGroup params are dropped by
 mgfx reflection; this isolated effect carries them.
Returns: Effect voption

this.GroupedParams

Full Usage: this.GroupedParams

Returns: ShadowEffectParams voption

Cached grouped depth-effect parameter handles (built when the grouped effect loads).

Returns: ShadowEffectParams voption

this.InstanceBindings

Full Usage: this.InstanceBindings

Returns: VertexBufferBinding array
Cached 2-slot binding array for SetVertexBuffers on the instanced paths
 (avoids the params-array allocation per call — thousands per frame on DX12).
 Contents are rewritten per call and consumed immediately.
Returns: VertexBufferBinding array

this.InstanceStaging

Full Usage: this.InstanceStaging

Returns: VertexInstanceWorld array

CPU staging array for the per-instance VertexInstanceWorld rows. Grows to the largest instanceCount seen across collected instanced casters. Reused across frames.

Returns: VertexInstanceWorld array

this.InstanceVertexBuffer

Full Usage: this.InstanceVertexBuffer

Returns: VertexBuffer voption
Growable per-instance vertex buffer for instanced shadow casters. Owned by the shadow
 pass (not shared with the forward-pass PBR instance VB) so the two passes never race on it.
 Disposed at shutdown; recreated when an instanced caster exceeds the current capacity.
Returns: VertexBuffer voption

this.InstanceWorlds

Full Usage: this.InstanceWorlds

Returns: InstanceWorldCache

Shared per-frame instance-world staging cache for skinned + instanced casters (aliased with the forward pass by ForwardPipeline — DX11/Vulkan only, see InstanceWorldCache).

Returns: InstanceWorldCache

this.InstancedDraws

Full Usage: this.InstancedDraws

Returns: ShadowInstancedDraw array

Pooled instanced-caster draws (the world's block grid etc.). Grows on demand.

Returns: ShadowInstancedDraw array

this.MergedCovered

Full Usage: this.MergedCovered

Returns: HashSet<ModelMeshPart>
Scratch: original parts covered by a merged group during skinned +
 instanced caster collection; cleared per command.
Returns: HashSet<ModelMeshPart>

this.ModelPartDraws

Full Usage: this.ModelPartDraws

Returns: ShadowModelPartDraw array

Pooled static-ModelMeshPart caster draws (DrawModel/DrawModelWith). Grows on demand.

Returns: ShadowModelPartDraw array

this.Origin

Full Usage: this.Origin

Returns: Vector3 voption

The frame's shadow-origin override (SetShadowOrigin); ValueNone = use the atlas strategy.

Returns: Vector3 voption

this.PaletteChunks

Full Usage: this.PaletteChunks

Returns: PaletteChunkCache

Shared per-frame palette-chunk cache for skinned + instanced casters (aliased with the forward pass by ForwardPipeline so each frame's palettes are staged + uploaded once, not per pass — see PaletteChunkCache).

Returns: PaletteChunkCache

this.Params

Full Usage: this.Params

Returns: ShadowEffectParams voption

Cached depth-effect parameter handles (built when the effect loads).

Returns: ShadowEffectParams voption

this.PointShadowSlots

Full Usage: this.PointShadowSlots

Returns: int[]

Per-light shadow slot mapping, indexed by lights.PointLights/SpotLights position; -1 = no shadow.

Returns: int[]

this.Raster

Full Usage: this.Raster

Returns: RasterizerState

Cached RasterizerState (polygon-offset bias + back-face culling). Created once on first shadow pass; disposed by the pipeline. Avoids per-frame GPU-state allocation.

Returns: RasterizerState

this.RenderTargetScratch

Full Usage: this.RenderTargetScratch

Returns: RenderTargetBinding[]

Grow-only scratch for save/restore of the caller's render-target bindings around a shadow/depth pass — avoids a GetRenderTargets() array allocation per pass. Resized only when the bound count changes; used sequentially (atlas pass, then depth pre-pass), never re-entrantly.

Returns: RenderTargetBinding[]

this.ShadowResult

Full Usage: this.ShadowResult

Returns: ShadowResult voption
The last frame's shadow pass output — read by the forward pass (Shade overrides +
 user-effect scopes) so a custom shader can opt into shadow sampling. ValueNone when no
 shadow-casting light exists or DepthShadow.fx is unavailable.
Returns: ShadowResult voption

this.SkinnedDraws

Full Usage: this.SkinnedDraws

Returns: ShadowSkinnedDraw array

Pooled skinned-caster draws (B12). Grows on demand.

Returns: ShadowSkinnedDraw array

this.SkinnedInstancedDraws

Full Usage: this.SkinnedInstancedDraws

Returns: ShadowSkinnedInstancedDraw array

Pooled skinned + instanced caster draws (DrawAnimatedModelInstanced). Grows on demand.

Returns: ShadowSkinnedInstancedDraw array

this.SkinnedInstancedStaging

Full Usage: this.SkinnedInstancedStaging

Returns: VertexInstanceWorldPalette array

CPU staging array for the per-instance VertexInstanceWorldPalette rows of skinned + instanced casters — DX12 only (the grouped path stages per pass there because the forward/depth group budgets differ). DX11/Vulkan stage through the shared InstanceWorldCache instead. Grows to the largest chunk seen. Reused across frames.

Returns: VertexInstanceWorldPalette array

this.SkinnedInstancedVertexBuffer

Full Usage: this.SkinnedInstancedVertexBuffer

Returns: VertexBuffer voption
Growable per-instance vertex buffer for skinned + instanced shadow casters. Owned
 by the shadow pass (not shared with the forward-pass PBR buffers) so the two passes never
 race on it. Disposed at shutdown; recreated when a chunk exceeds the current capacity.
Returns: VertexBuffer voption

this.SpotShadowSlots

Full Usage: this.SpotShadowSlots

Returns: int[]

Per-light shadow slot mapping for spot lights; -1 = no shadow.

Returns: int[]

this.UVOffsetsScratch

Full Usage: this.UVOffsetsScratch

Returns: Vector4 array

Pooled scratch for the multi-caster shadowUVOffsets upload.

Returns: Vector4 array

this.ViewProjsScratch

Full Usage: this.ViewProjsScratch

Returns: Matrix array

Pooled scratch for the multi-caster shadowViewProjs upload.

Returns: Matrix array

Type something to start searching.