Vixen
02b45cc4
csharp
public sealed class IrradianceFieldRenderer

Keeps the irradiance field filled, on the device, and named in the frame's set.

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

Remarks

The counterpart to GlobalDistanceFieldRenderer, and the same shape for the same reasons: a field that knows how to hold light, a mirror that knows how to copy one up, a shader that knows how to read one, and this to sequence them.

A transfer pass, marked as having a side effect. Uploading is a buffer-to-texture copy and a copy cannot be recorded inside a render pass; the volumes are not graph resources — they are named into a descriptor set — so a pass that writes none reads as a pass nothing needs and would be culled. Both facts were learnt the hard way next door, and this is written the way that ended up.

It fills a bounded number of bricks a frame and uploads whatever that produced. That is doc 19 § L2's round robin, and it is why Filler is a property rather than something this owns: what a probe sees is a question about the scene, and the answer comes from somewhere that knows about geometry and light. This knows about ordering.

Dilation and the border sync run after a fill, in that order, or the field has holes and seams in it. Doing them here rather than leaving them to a caller is the whole reason this type exists — they are cheap, they are easy to forget, and forgetting either produces an artefact that looks like a lighting bug rather than a missing call.

Two fillers, and at most one of them at a time. Filler traces on the CPU and this copies the answer up; DeviceFiller dispatches and this copies nothing but the index volume. Both live would be an upload of the CPU pool over whatever the dispatch wrote, one frame after it wrote it — lighting that flickers between two answers rather than a mode somebody chose — so asking for both is refused rather than resolved.

Fields and properties (13)

  • public IrradianceField? Field

    The field to keep. Null does nothing at all.

  • public TracedIrradianceFiller? Filler

    What fills its probes on the CPU, or null for a field somebody else fills.

  • public IrradianceFieldFill? DeviceFiller

    What fills its probes on the device — doc 19 § L2's filler A.

  • public IrradianceFieldTexture? Texture

    Its mirror on the device, made on the first build.

  • public SceneConstants? SceneConstants

    Where the names go — the frame's set 0.

  • public IList<string> Passes

    Which passes read this field.

  • public string Source

    The shader filling the slot, which is the other half of every binding's name.

  • public IrradianceRefinementPolicy? Refinement

    Where the field should be fine, or null to leave its allocation alone.

  • public int Refined

    How many bricks the refinement policy has produced since this node was made.

  • public int Budget

    How many bricks to refill each frame.

  • public int DilationPasses

    How far dilation may travel into invalid probes, in probes.

  • public IGraphicsDevice? Device

    The device its texture is made on, or null to take the frame's.

  • public int Filled

    How many bricks have been filled since this node was made.

Methods (2)

  • protected internal override void Build(GraphicsCompositor compositor, CompositorFrame frame)

    Declares the pass that refills the field and copies it up.

  • public void Dispose()

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

Used by (7)

  • ArenaThirdPersonShooter
  • ArenaIlluminationThirdPersonShooter
  • CompositorAssetTestsVixen.Rendering.Tests
  • CompositorBuilderVixen.Rendering
  • IndirectDiffuseImageTestsVixen.Graphics.Golden.Tests
  • IrradianceRefinementTestsVixen.Rendering.Tests
  • IrradianceShadingDeviceTestsVixen.Graphics.Golden.Tests