Vixen
02b45cc4
csharp
public interface IDistanceField

Anything a ray can be marched through.

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

Remarks

Two things implement this and they are very different — one baked field over one mesh, and a clipmap over a whole scene — but a tracer needs nothing from either beyond "how far is the nearest surface from here, and which way does that grow". Naming that pair is what lets DistanceFieldTracer be written once.

It also lets a test trace an exact field. Marching a sampled sphere and comparing against the analytic answer measures the tracer and the sampling together, and when it disagrees there is no way to tell which one was wrong. Marching an analytic sphere measures the tracer alone.

The contract is a lower bound, not an exact distance. An implementation may report less than the true distance to the nearest surface and a tracer will still be correct — it takes more steps. It may not report more, because a step of that length passes through the surface. Every approximation in this assembly is built to fail in the first direction.

Methods (2)

  • float Sample(Vector3 position)

    How far the nearest surface is, and which side of it the point is on.

  • Vector3 SampleGradient(Vector3 position)

    Which way the distance grows fastest — the surface normal, near one.

Used by (41, showing 40)

  • AnalyticVixen.Rendering.IrradianceFields.Tests
  • AnalyticFieldsVixen.Rendering.IrradianceFields.Tests
  • BallVixen.Rendering.ScreenProbes.Tests
  • BallVixen.Rendering.ScreenProbes.Tests
  • BallVixen.Graphics.Golden.Tests
  • BoxVixen.Rendering.SurfaceCache.Tests
  • CardRadiosityVixen.Rendering.SurfaceCache
  • DistanceFieldTracerVixen.Rendering.DistanceFields
  • EmptyVixen.Rendering.Reflections.Tests
  • EmptyVixen.Rendering.DistanceFields.Tests
  • EmptySpaceVixen.Rendering.ScreenProbes.Tests
  • EmptySpaceVixen.Rendering.ScreenProbes.Tests
  • EmptySpaceVixen.Rendering.ScreenProbes.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • EmptyWorldVixen.Rendering.ScreenProbes.Tests
  • EmptyWorldVixen.Rendering.ScreenProbes.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • EmptyWorldVixen.Graphics.Golden.Tests
  • ExitCriteriaTestsVixen.Rendering.ScreenProbes.Tests
  • FloorVixen.Rendering.Reflections.Tests
  • FloorVixen.Rendering.SurfaceCache.Tests
  • FloorVixen.Graphics.Golden.Tests
  • GlobalDistanceFieldVixen.Rendering.DistanceFields
  • HalfFloorVixen.Graphics.Golden.Tests
  • HalfSpaceVixen.Rendering.ScreenProbes.Tests
  • HalfSpaceVixen.Rendering.DistanceFields.Tests
  • MeshDistanceFieldVixen.Rendering.DistanceFields
  • NothingVixen.Rendering.Tests
  • SphereVixen.Rendering.DistanceFields.Tests
  • TracedCardCaptureVixen.Rendering.SurfaceCache
  • TracedIrradianceFillerVixen.Rendering.IrradianceFields
  • TracedReflectionsVixen.Rendering.Reflections
  • TracedScreenProbeGatherVixen.Rendering.ScreenProbes
  • UnionVixen.Rendering.DistanceFields.Tests