Vixen
02b45cc4
csharp
public readonly record struct SurfaceCard

One orthographic capture of a piece of surface — doc 19 § L4's card.

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

Remarks

A card is a box and an axis. It captures the surfaces inside its box whose normals lean along its direction, looking straight down that direction orthographically — up to six of these cover a mesh from its six sides, which is the whole trick: a surface's radiance becomes a low-resolution 2D texture problem, and radiosity over 2D textures is cheap where radiosity over geometry is not.

The in-plane frame is the other two world axes, in cyclic order, whatever the sign. Direction ±X maps the card's UV to world (Y, Z), ±Y to (Z, X), ±Z to (X, Y). One rule with no branches on sign, so a card and the shader that will someday sample it cannot disagree about which way U runs — the octahedral fold's lesson, one convention over.

Fields and properties (8)

  • public int Axis

    Which of the six directions the card faces: +X, −X, +Y, −Y, +Z, −Z.

  • public Vector3 Centre

    The centre of its box, in world space.

  • public Vector3 HalfSize

    The box's half-extents, world-axis aligned.

  • public Int2 Resolution

    Texels along U and V.

  • public Vector3 Direction

    The outward direction of the surfaces this card captures.

  • public int UComponent

    The world component index the card's U runs along — cyclic from the axis.

  • public int VComponent

    The world component index the card's V runs along.

  • public (Vector2 Plane, float Depth) Extents

    The half-extent along U and V, and the half-depth along the axis.

Methods (3)

  • public SurfaceCard(int axis, Vector3 centre, Vector3 halfSize, Int2 resolution)

    Places a card.

  • public Vector3 TexelOrigin(Int2 texel)

    Where a texel's centre sits on the card's near plane — the face the capture enters.

  • public bool TryProject(Vector3 world, out Int2 texel, out float depth)

    A world position in the card's own terms, if it lies inside the box.

Used by (15)

  • ArenaIlluminationThirdPersonShooter
  • CardGeneratorVixen.Rendering.SurfaceCache
  • CardRadiosityVixen.Rendering.SurfaceCache
  • CornellBoxTestsVixen.Rendering.SurfaceCache.Tests
  • SurfaceCacheCardDataVixen.Rendering
  • SurfaceCacheGatherFillVixen.Rendering
  • SurfaceCacheLightFillVixen.Rendering
  • SurfaceCacheRadiosityDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCacheStoreVixen.Rendering.SurfaceCache
  • SurfaceCacheTestsVixen.Rendering.SurfaceCache.Tests
  • SurfaceCacheTextureVixen.Rendering
  • SurfaceCardCaptureVixen.Rendering
  • SurfaceCardCaptureDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCardIndexVixen.Rendering.SurfaceCache
  • TracedCardCaptureVixen.Rendering.SurfaceCache