public sealed class ShadowMapRendererRenders a directional light's cascaded shadow map.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The clearest thing a compositor buys, and the reason the collect phase exists at all: a cascade is a view. Four cascades are four RenderViews over one stage, culled independently, sorted independently, and drawn into four tiles of one texture. Nothing about the mesh feature, the material feature or the sort key changes to support them.
One pass, four viewports. The atlas is cleared once and each cascade draws into its tile, rather than four passes into four textures. On a tile-based GPU four passes mean four loads and four stores of a depth buffer that is never read outside the frame; on a desktop one they are four pipeline barriers for no reason.
The camera's parameters are here, not on the view. A RenderView deliberately holds only what culling needs — a frustum and a position — because a view is not a camera. Fitting a cascade needs the field of view and the aspect ratio, which are the camera's, so the node that fits them is where they belong.
And a cache, when the level's casters are put in a stage of their own. StaticCasterStage plus Slack is the whole of it, and the two are one switch: a cascade that re-fits every frame is a cache that is invalidated every frame, which costs a whole-atlas copy and saves nothing. See Slack for what stability is paid for in, and StaticAtlas for why the cache's texture is this node's rather than the document's.
Fields and properties (36)
public required RenderStage CasterStageThe stage that draws depth-only casters.
public ViewConstants? ConstantsThe per-view block to bind before each cascade's casters.
public string AtlasThe name of the atlas to render into.
public ParameterCollection? SceneWhere to publish what a shading pass needs to read the atlas, or null to publish nothing.
public string ShaderNameWhich pass's names to publish under.
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 metres.
public float SlopeBiasHow much more of that a surface gets as it turns away from the light, in metres.
public float FadeRangeOver what distance shadows fade out at the last cascade's end, in metres.
public RenderStage? StaticCasterStageThe stage that draws casters which do not move, or null to redraw everything every frame.
public string StaticAtlasThe name of a texture a host lends the cache, or empty for the node to own one.
public IGraphicsDevice? DeviceWhere the node's own cache texture comes from, when it owns one.
public float SlackHow much larger than each slice to cut its cascade, as a fraction.
public int StaticVersionBumped by the host whenever a static caster is added, removed or moved.
public int StaticRebuildsHow many times the static atlas has been redrawn.
public int StaticRefitsHow many of those rebuilds were a cascade re-fitting.
public int StaticInvalidationsHow many were the host saying the static content changed.
public int TilesDrawnHow many cascade tiles were rasterised this frame.
public int CascadeCountHow many cascades to fit, up to MaxCascades.
public int ResolutionOne cascade's side in texels.
public RenderView? CameraThe view whose frustum the cascades are fitted to.
public ISunSource? SunWhere the sun comes from, when it comes from the scene.
public Vector3 EyeWhere the camera is, when no Camera says.
public Vector3 ForwardWhere it looks.
public Vector3 UpIts approximate up direction.
public float FieldOfViewIts vertical field of view, in radians.
public float AspectRatioIts width divided by its height.
public float NearPlaneWhere the first cascade starts.
public float ShadowDistanceHow far shadows are drawn — the shadow distance, not the camera's far plane.
public float SplitLambdaHow far to blend the splits from uniform toward logarithmic.
public float ExtrusionHow far behind a cascade the light's near plane sits, so outside casters still cast.
public Vector3 LightDirectionThe direction light travels — away from the sun, toward the scene.
public ReadOnlySpan<float> SplitsHow far each cascade is culled to, which is its own end distance.
public ReadOnlySpan<ShadowCascade> CascadesThe cascades this frame fitted.
public IReadOnlyList<RenderView> ViewsThe views the cascades are drawn from, for a host that wants to inspect them.
public Int2 AtlasSizeThe atlas's size in texels, for whoever creates the texture.
Methods (5)
public static PermutationKey<int> CascadeCountKey(string shaderName)The shader permutation that has to carry CascadeCount, for the pass named.
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 (14)
- ArenaThirdPersonShooter
- ThirdPersonShooterGameThirdPersonShooter
- CascadeCountDeviceTestsVixen.Graphics.Golden.Tests
- CompositorAssetTestsVixen.Rendering.Tests
- CompositorBuilderVixen.Rendering
- CompositorImageTestsVixen.Graphics.Golden.Tests
- DegradationTestsVixen.Rendering.Tests
- ForwardFrameTestsVixen.Rendering.Tests
- FrameVixen.Rendering.Tests
- HarnessVixen.Rendering.Tests
- HarnessVixen.Rendering.Tests
- ShadowCacheTestsVixen.Rendering.Tests
- ShadowMapRendererTestsVixen.Rendering.Tests
- TerrainCasterRendererVixen.Rendering.Terrain