public sealed class SurfaceCacheStoreEvery card's captured surface and its lighting — doc 19 § L4's cache.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The storage does not know what filled it, the property every pool here shares: a texel captured by the CPU reference and one a rasteriser will someday write are the same texel, and the lighting and the bounce read them the same way.
A texel's outgoing radiance is emissive + albedo · (direct + gathered). Direct and gathered are both incident irradiance over π — the package convention — so multiplying by albedo is what turns them into diffuse outgoing radiance. Gathered is double-buffered: a radiosity pass reads every texel's previous answer while writing the next, because a bounce that reads its own pass converges to whatever the texel order made of it.
Sampling picks the best-facing card that contains the point at the stored depth. Containment says the point is in some card's box; the depth agreement says the card actually captured this surface rather than one in front of or behind it; the facing test says the card saw the surface's own side. The candidates come off a SurfaceCardIndex — one grid cell rather than every card — and the tests above run unchanged on what it returns, so the index narrows the scan without ever answering for it.
Fields and properties (3)
public SurfaceCacheAtlas AtlasThe allocator deciding where cards live.
public IReadOnlyList<(SurfaceCard Card, Int2 Origin)> CardsThe cards in residence, in the order they arrived.
public float DepthToleranceHow far a sampled point may sit from a texel's stored depth and still be its surface.
Methods (13)
public SurfaceCacheStore(SurfaceCacheAtlas atlas)Builds an empty cache over one atlas.
public int AddCard(SurfaceCard card)Adds a card, if the atlas has room.
public void SetSurface(int card, Int2 texel, SurfaceTexel surface)Writes one texel's captured surface.
public void Invalidate(int card, Int2 texel)Marks a texel as having captured nothing.
public bool IsValid(int card, Int2 texel)Whether a texel captured a surface.
public SurfaceTexel Surface(int card, Int2 texel)One texel's captured surface.
public Vector3 Direct(int card, Int2 texel)One texel's direct incident irradiance over π.
public void SetDirect(int card, Int2 texel, Vector3 value)Sets one texel's direct incident irradiance over π.
public Vector3 Gathered(int card, Int2 texel)One texel's gathered indirect irradiance over π, as of the last swap.
public void SetGatheredNext(int card, Int2 texel, Vector3 value)Stages one texel's next gathered irradiance — visible after SwapGathered.
public void SwapGathered()Makes the staged gather the one everything reads.
public Vector3 Outgoing(int card, Int2 texel)One texel's outgoing radiance: emissive plus albedo times what arrives.
public bool TryRadiance(Vector3 position, Vector3 normal, out Vector3 radiance)What a surface at a point radiates, if some card captured it.
Used by (18)
- ArenaIlluminationThirdPersonShooter
- CardRadiosityVixen.Rendering.SurfaceCache
- CompositorAssetTestsVixen.Rendering.Tests
- CompositorBuilderVixen.Rendering
- CornellBoxTestsVixen.Rendering.SurfaceCache.Tests
- ReflectionTraceDeviceTestsVixen.Graphics.Golden.Tests
- SurfaceCacheGatherFillVixen.Rendering
- SurfaceCacheLightFillVixen.Rendering
- SurfaceCacheRadianceVixen.Rendering.SurfaceCache
- SurfaceCacheRadiosityDeviceTestsVixen.Graphics.Golden.Tests
- SurfaceCacheRendererVixen.Rendering
- SurfaceCacheRendererDeviceTestsVixen.Graphics.Golden.Tests
- SurfaceCacheTestsVixen.Rendering.SurfaceCache.Tests
- SurfaceCacheTextureVixen.Rendering
- SurfaceCardCaptureVixen.Rendering
- SurfaceCardCaptureDeviceTestsVixen.Graphics.Golden.Tests
- TracedCardCaptureVixen.Rendering.SurfaceCache
- TracedReflectionTestsVixen.Rendering.Reflections.Tests