Vixen
02b45cc4
csharp
public sealed class SurfaceCardCapture

Rasterises one card's capture — the device half of doc 19 § L4's runtime capture.

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

Remarks

The piece TracedCardCapture exists to referee. That one marches a distance field and is deterministic to the last texel; this one renders whatever the caller draws, reads it back, and writes the same SurfaceCacheStore texels — so the two can capture one scene and be compared, the arrangement every capture in this engine has with its reference, in IrradianceCubeCapture's exact mould.

Three passes over one target rather than one pass over three. A surface texel is albedo, normal, depth and emissive; multiple render targets would take them in one pass and need every material pipeline built against a three-attachment output. Drawing the card three times into the one attachment the scene's pipelines already target — told apart by SurfaceCapturePlane — captures the same texels at three small passes per card, and a card is tens of texels across at a budgeted handful per frame. The single-pass capture is an optimisation with this as its baseline and its referee.

The projection is derived from the card, not from a camera. Projection maps the card's box to clip space so that framebuffer texel (x, y) is card texel (x, y) — one convention, asserted by a closed form against TexelOrigin — with the engine's reversed depth: one at the card's near plane, zero at its far side, and exactly zero meaning "saw nothing", which is what marks a texel invalid at readback.

⚠ Two-sided rasterisation is the caller's to arrange, and it matters — a card looks at the world from outside its surfaces, but a floor's underside card looks at back faces, and culled away it captures an empty world. The same warning, verbatim, as the cube capture's.

Fields and properties (6)

  • public static RenderOutput Output

    The attachments a plane is rendered into, for whoever builds the pipelines.

  • public static RenderOutput SinglePassOutput

    The attachments of the one-pass form: all three planes at once.

  • public bool SinglePass

    Whether one pass writes all three planes through multiple render targets.

  • public int MaxResolution

    The widest card this capture can take, in texels along either axis.

  • public int Captures

    How many captures have been recorded.

  • public bool IsCreated

    Whether the textures exist yet.

Methods (5)

  • public SurfaceCardCapture(IGraphicsDevice device)

    Creates a capture on a device. Nothing is allocated until the first record.

  • public static Matrix4x4 Projection(in SurfaceCard card)

    The card's world-to-clip transform: card texel (x, y) is framebuffer texel (x, y).

  • public void Record(ICommandList commands, in SurfaceCard card, SurfaceCardCapture.DrawCard draw)

    Records the three passes that capture one card.

  • public bool TryRead(SurfaceCacheStore cache, int card, out int captured)

    Turns the last recorded capture into a card's texels.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (4)

  • CompositorBuilderVixen.Rendering
  • SurfaceCacheRendererVixen.Rendering
  • SurfaceCacheRendererDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCardCaptureDeviceTestsVixen.Graphics.Golden.Tests