Vixen
02b45cc4
csharp
public sealed class VirtualShadowRenderer

The sun's shadow at the resolution each pixel needs: phase 7's node.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

ShadowMapRenderer's replacement rather than its sibling, and the reason is the geometry. Four cascades are four fixed resolutions over a whole frustum, and the one a pixel gets is whichever slice it landed in — tolerable when the geometry is an authored LOD chain, and absurd when it is a cut chosen to put a cluster's error under a pixel. This node fits a clipmap instead: levels doubling in extent, centred on the camera and snapped to whole pages, of which only the pages some pixel actually asked for are allocated or drawn.

Four things happen here in an order nothing else can express. The marks the previous frame wrote are serviced, which allocates pages; the pages that hold nothing yet are drawn; the page table is uploaded; and this frame's depth is marked for the next one. The first three have to precede any shading pass that reads the table, and the fourth has to follow whatever wrote the depth — so this node is placed after the depth prepass and before the shading, and the ordering inside it is not a document's to get wrong.

The casters are the ordinary shadow-caster stage. docs/plan/22-virtualized-geometry.md phase 7 describes clusters cast through the same traversal with a different view record, which needs a visible list per view — the traversal produces one list for every view it was given, with no view tag on an entry. That is a change to phase 3's output rather than to this node, so it is named as owed and a virtualized mesh casts through the fallback mesh phase 1 generates for exactly this: the path the virtualized raster does not reach.

Fields and properties (18)

  • public required RenderStage CasterStage

    The stage that draws depth-only casters.

  • public VirtualShadowAtlas? Atlas

    The atlas, its pages and its residency. Null does nothing at all.

  • public ViewConstants? Constants

    The per-view block to bind before each page's casters.

  • public ParameterCollection? Scene

    Where to publish what a shading pass needs, or null to publish nothing.

  • public SamplerCache? Samplers

    Where the comparison sampler comes from.

  • public IList<string> Passes

    Which passes' compose slots the map is published under, qualified.

  • public RenderView? Camera

    The camera the clipmap is centred on and whose depth is marked.

  • public string Depth

    Which depth resource to mark from.

  • public Vector3 LightDirection

    The direction the sun's light travels, toward the scene.

  • public ISunSource? Sun

    Where the sun comes from, or null to use LightDirection.

  • public IList<Matrix4x4> SpotProjections

    One projection per shadowed spot light, or empty.

  • public int ClipmapLevels

    How many levels the directional clipmap has.

  • public float FirstExtent

    How wide clipmap level zero is, in world units.

  • public float Depthrange

    How deep each level's box is along the light, which is its caster range.

  • public int PagesPerFrame

    How many pages may be allocated per frame.

  • public int DrawsPerFrame

    How many pages may be drawn per frame.

  • public int MarkedPages

    How many pages the last frame's marking asked for.

  • public int DrawnPages

    How many pages the last frame drew.

Methods (3)

  • protected internal override void Collect(GraphicsCompositor compositor)
  • protected internal override void Build(GraphicsCompositor compositor, CompositorFrame frame)

    Declares this node's render-graph passes.

  • public override string ToString()

    Returns a string that represents the current object.

Used by (3)

  • ArenaThirdPersonShooter
  • FrameDocumentTestsThirdPersonShooter.Frame.Tests
  • CompositorBuilderVixen.Rendering