Vixen
02b45cc4
csharp
public sealed class CardRadiosity

Direct light on the cache, and the bounce over the cards — doc 19 § L4's radiosity.

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

Remarks

Two passes with one convention. Light evaluates the sun on every valid texel — cosine, shadow ray through the field, over π — and writes it as direct incident irradiance. Gather shoots cosine-weighted rays from every texel: a ray that hits a cached surface brings back its outgoing radiance, one that hits an uncached one brings back black (the honest reading, and the same answer the tracers give), and one that escapes brings back the sky — which is how skylight reaches the cards at all, with no ambient term to double-count it.

Each gather reads the previous gather — the store double-buffers — so pass n's output carries light that bounced n times. Iterating to a fixed point is what turns one bounce into the infinite-bounce look: the series converges because albedo is below one, geometrically, and the Cornell test measures the limit against a path tracer rather than trusting the argument.

The rays are deterministic — Hammersley over the hemisphere, the exit-criteria tests' own sampler — because a reference that changes between runs referees nothing, and because two gathers of one cache must agree to the bit for any dispatch to be compared against this.

Fields and properties (4)

  • public int Rays

    How many rays each texel's gather casts.

  • public float MaxDistance

    How far a gather ray looks before deciding it escaped.

  • public float Bias

    How far off its surface a ray starts, in world units.

  • public Func<Vector3, Vector3>? Sky

    What an escaping ray sees, by direction. Null is black — a closed scene.

Methods (3)

  • public CardRadiosity(IDistanceField geometry)

    Direct light on the cache, and the bounce over the cards — doc 19 § L4's radiosity.

  • public void Light(SurfaceCacheStore cache, Vector3 towardSun, Vector3 sunIrradiance)

    Evaluates the sun on every valid texel of every card.

  • public float Gather(SurfaceCacheStore cache)

    One bounce: every texel gathers what the others radiated last pass.

Used by (9)

  • ArenaIlluminationThirdPersonShooter
  • CompositorBuilderVixen.Rendering
  • CornellBoxTestsVixen.Rendering.SurfaceCache.Tests
  • ReflectionTraceDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCacheRadiosityDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCacheRendererVixen.Rendering
  • SurfaceCacheRendererDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCacheTestsVixen.Rendering.SurfaceCache.Tests
  • TracedReflectionTestsVixen.Rendering.Reflections.Tests