Vixen
02b45cc4
csharp
public readonly record struct DistanceFieldInstance

One baked field, placed in a world.

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

Remarks

Position, rotation and one scale — not a matrix, and that is the point. A distance field survives being moved and turned, and it survives being scaled by one number: rotate a distance and it is the same distance, scale everything by s and every distance scales by s too. It does not survive a non-uniform scale. Squash a sphere's field along one axis and what comes out is not the ellipsoid's distance function — it over-reports along the squashed axis and under-reports across it, and a tracer reading it steps straight through the surface. Taking a Matrix4x4 here would accept that silently, so the type refuses to be able to express it.

A mesh that genuinely needs a non-uniform scale needs its own bake at that scale. That is what every engine that ships this does, and it is why a field is a property of a mesh asset rather than of a renderer.

Fields and properties (5)

  • public MeshDistanceField Field

    The baked field, in its own space.

  • public Vector3 Position

    Where its origin sits in the world.

  • public Quaternion Rotation

    How it is turned. Must be normalised.

  • public float Scale

    How much bigger it is than it was baked. Must be positive.

  • public BoundingBox WorldBounds

    The world-space box the field covers, which is what a query rejects against.

Methods (4)

Used by (12)

  • ArenaThirdPersonShooter
  • ArenaIlluminationThirdPersonShooter
  • DistanceFieldInstanceTestsVixen.Rendering.DistanceFields.Tests
  • DistanceFieldTracerTestsVixen.Rendering.DistanceFields.Tests
  • GlobalDistanceFieldVixen.Rendering.DistanceFields
  • GlobalDistanceFieldRendererVixen.Rendering
  • GlobalDistanceFieldRendererTestsVixen.Rendering.Tests
  • GlobalDistanceFieldTestsVixen.Rendering.DistanceFields.Tests
  • ReflectionTraceDeviceTestsVixen.Graphics.Golden.Tests
  • RenderedSceneTestsVixen.Rendering.DistanceFields.Tests
  • ScrollTestsVixen.Rendering.DistanceFields.Tests
  • SurfaceCacheRadiosityDeviceTestsVixen.Graphics.Golden.Tests