public sealed class PunctualShadowRendererRenders spot and point light shadows into one atlas.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The same idea as ShadowMapRenderer — a shadow map is a view, and an atlas is one pass with a viewport per tile — applied to lights that have a position. What differs is that nothing has to be fitted or stabilised: a spot light's shadow frustum is its cone and a point light's is six of them, so the whole projection question that cascades spend two hundred lines on does not arise.
A point light is six tiles and a spot light is one. That ratio is the real cost of the two and it is worth seeing: six times the culling, six times the draws, six times the atlas. It is also why the atlas is allocated in tile units rather than per light — the alternative reserves a cube's worth of space for every light in case it turns out to be one.
When the atlas runs out, lights are dropped and counted. Not silently: DroppedLights is what turns "some shadows disappeared in the big fight" into a number a profiler can show. Dropping the ones furthest down the list is arbitrary and deliberate — importance ordering belongs to whoever fills the list, which is the only place that knows what the scene is about.
Fields and properties (20)
public required RenderStage CasterStageThe stage that draws depth-only casters.
public string AtlasThe name of the atlas to render into.
public IList<RenderLight> LightsThe lights to shadow. Directional lights are skipped — they are the cascades'.
public ViewConstants? ConstantsThe per-view block to bind before each tile's casters.
public ParameterCollection? SceneWhere to publish what a shading pass needs to read the atlas, or null to publish nothing.
public string ShaderNameThe compose-slot prefix the tile bindings are written under.
public IList<string> PassesAny further prefixes the same atlas is published under.
public IGraphicsDevice? DeviceWhere the tile buffer lives. Without one, nothing is uploaded and nothing published.
public SamplerCache? SamplersWhere the atlas's sampler comes from. Without one, no sampler is published.
public float ConstantBiasHow far the depth comparison is nudged, in depth units.
public float SlopeBiasHow much more of that a surface gets as it turns away from the light.
public int ResolutionOne tile's side in texels.
public int TilesPerSideHow many tiles the atlas is across, so it holds this squared.
public float NearPlaneThe near plane every punctual shadow projection uses.
public IReadOnlyList<ShadowTile> TilesThe tiles this frame allocated.
public int TileBaseWhich record of the tile buffer this frame's tiles start at.
public IReadOnlyList<RenderView> ViewsThe views the tiles are drawn from.
public int DroppedLightsHow many lights did not fit in the atlas this frame.
public int CapacityHow many tiles the atlas holds.
public Int2 AtlasSizeThe atlas's size in texels, for whoever creates the texture.
Methods (4)
protected internal override void Collect(GraphicsCompositor compositor)Declares the views and stages this node needs, before anything is culled.
protected internal override void Build(GraphicsCompositor compositor, CompositorFrame frame)Declares this node's render-graph passes.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override string ToString()Returns a string that represents the current object.
Used by (3)
- CompositorBuilderVixen.Rendering
- HarnessVixen.Rendering.Tests
- PunctualShadowTestsVixen.Rendering.Tests