Vixen
02b45cc4
csharp
public sealed class IrradianceCubeCapture

Renders the six faces of a probe's cube — the device half of doc 19 § L2's filler B.

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

Remarks

The piece that was owed. CapturedIrradianceFiller turns a cube into four coefficients and is checked against arithmetic with nothing rendered; this is what produces the cube, and until it existed doc 19 § 7's promise to WebGL2 — the same lighting model at a different update rate — was stated rather than true, because a target with no compute has no other way to fill a probe.

Six 90° frusta from Cube, which is not a coincidence. Direction is derived from that same matrix by unprojecting it, so the direction a projected texel came from and the direction the projection asks about are the same function evaluated twice rather than two conventions that have to be kept in step. A capture that renders with one convention and integrates with another comes back mirrored, which still looks like an environment.

It draws nothing itself. What a probe sees is the scene shaded — and how a project shades is a pipeline decision, not this type's. So the caller supplies a DrawFace, and doc 19's bounce iteration is the same callback shading with the field's previous answer: a source that reads the field produces a second bounce by being called twice.

⚠ Two-sided rasterisation is the caller's to arrange, and it matters. A probe inside a closed room sees the room's inside faces, which are back faces to a camera standing in it. Culled away, the room is invisible and the probe reports an unobstructed sky — the brightest possible wrong answer, and the one Validity is then unable to catch, because a probe that sees nothing looks exactly like a probe in the open.

Fields and properties (10)

  • public static RenderOutput Output

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

  • public int Size

    How many texels across one face is.

  • public float Range

    How far a face looks before it stops seeing, which is its far plane.

  • public float Near

    Its near plane.

  • public Color4 Sky

    What a direction that hit nothing sees.

  • public float MinimumDistance

    How near a hit has to be before it means "this probe is inside something".

  • public Vector3 SunDirection

    Which way the sun is, in world space.

  • public float SunRadius

    How wide a cone the sun tap averages over, in radians.

  • public int Captures

    How many captures have been recorded.

  • public bool IsCreated

    Whether the textures exist yet.

Methods (4)

  • public IrradianceCubeCapture(IGraphicsDevice device)

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

  • public void Record(ICommandList commands, Vector3 position, IrradianceCubeCapture.DrawFace draw)

    Records the six passes that capture one probe's surroundings.

  • public bool TryRead(out IrradianceCapture capture)

    Turns the last recorded capture into the three numbers a probe wants.

  • public void Dispose()

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

Used by (3)

  • IrradianceBounceDeviceTestsVixen.Graphics.Golden.Tests
  • IrradianceCaptureDeviceTestsVixen.Graphics.Golden.Tests
  • RenderedIrradianceCapturesVixen.Rendering