public static class DistanceFieldTracerSphere tracing, and the two things everybody wants from it.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The CPU half of what a shader will do per pixel. It exists here first because it can be checked: marching an analytic sphere has a closed-form answer, and a tracer that agrees with arithmetic is a tracer whose port can be compared against something.
All three routines are the published formulations — sphere tracing from Hart, and the cone shadow and the occlusion integral in the shape Quilez popularised. Re-derived and credited, not copied.
Methods (3)
public static DistanceFieldHit Trace(IDistanceField field, Vector3 origin, Vector3 direction, DistanceFieldTraceSettings? options = null)Marches a ray until it reaches a surface or runs out of road.
public static float Shadow(IDistanceField field, Vector3 origin, Vector3 toLight, float lightDistance, float softness = 8, DistanceFieldTraceSettings? options = null)How much of a light reaches a point, marching once for a whole penumbra.
public static float AmbientOcclusion(IDistanceField field, Vector3 position, Vector3 normal, float radius = 1, int samples = 5, float strength = 1)How enclosed a point is, from a few samples up its own normal.
Used by (9)
- CardRadiosityVixen.Rendering.SurfaceCache
- CornellBoxTestsVixen.Rendering.SurfaceCache.Tests
- DistanceFieldTracerTestsVixen.Rendering.DistanceFields.Tests
- ExitCriteriaTestsVixen.Rendering.ScreenProbes.Tests
- RenderedSceneTestsVixen.Rendering.DistanceFields.Tests
- TracedCardCaptureVixen.Rendering.SurfaceCache
- TracedIrradianceFillerVixen.Rendering.IrradianceFields
- TracedReflectionsVixen.Rendering.Reflections
- TracedScreenProbeGatherVixen.Rendering.ScreenProbes