Vixen
02b45cc4
csharp
public readonly record struct DistanceFieldTraceSettings

How hard to march, and when to stop.

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

Remarks

StepScale below one is not timidity, it is correctness. Sphere tracing is exact when the field is exact: a step of d can never cross a surface that is d away. A sampled field is not exact — a trilinear interpolation over-reports near a convex corner, which is precisely a step that crosses the surface and a ray that comes out the other side. Scaling the step back down is what buys that margin, and it is why the number lives here rather than being hard-coded at nine-tenths and forgotten.

SurfaceThreshold should be a fraction of the field's cell: much smaller and the march creeps toward a surface it cannot resolve anyway; much larger and it stops short, which reads as everything being slightly inflated.

Fields and properties (6)

  • public float MaxDistance

    How far along the ray to look.

  • public int MaxSteps

    How many samples the march may take before giving up.

  • public float SurfaceThreshold

    How near counts as arrived.

  • public float StepScale

    What fraction of the reported distance each step actually takes.

  • public float MinStep

    The shortest step worth taking, so a march grazing a surface cannot stall.

  • public float StartDistance

    Where along the ray to begin.

Methods (2)

  • public DistanceFieldTraceSettings()

    The defaults: a hundred units, a hundred and twenty-eight steps, nine-tenths of a step.

  • public void Validate()

    Throws if these settings cannot march.

Used by (10)

  • CardRadiosityVixen.Rendering.SurfaceCache
  • CornellBoxTestsVixen.Rendering.SurfaceCache.Tests
  • DistanceFieldTracerVixen.Rendering.DistanceFields
  • DistanceFieldTracerTestsVixen.Rendering.DistanceFields.Tests
  • ExitCriteriaTestsVixen.Rendering.ScreenProbes.Tests
  • RenderedSceneTestsVixen.Rendering.DistanceFields.Tests
  • TracedCardCaptureVixen.Rendering.SurfaceCache
  • TracedIrradianceFillerVixen.Rendering.IrradianceFields
  • TracedReflectionsVixen.Rendering.Reflections
  • TracedScreenProbeGatherVixen.Rendering.ScreenProbes