Vixen
02b45cc4
csharp
public readonly record struct DistanceFieldBuildSettings

What a bake is being asked for: how finely to sample, and how hard to work at the sign.

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

Remarks

Resolution is the quality dial and the cost dial at once. Resolution is the count along the volume's longest axis and the others follow from the bounds, so voxels stay near-cubic whatever shape the mesh is — a door frame sampled 32×32×32 would be coarse along its length and absurdly fine across its thickness, and the thin axis is the one that decides whether the field leaks. Doubling it is eight times the voxels and eight times the bake.

Thin geometry is the failure everybody hits. A wall thinner than a voxel cannot be represented: no sample lands inside it, so the field reads as though it were not there and light passes through. That is a property of the representation and not of this bake — it is why docs/plan/19 lists leaks as risk G3 and why the remedy lives at the sampling end rather than here.

Fields and properties (5)

  • public int Resolution

    How many samples along the volume's longest axis.

  • public float BoundsExpansion

    How far the volume is grown past the mesh, as a fraction of the mesh's size.

  • public int SignRayCount

    How many rays each sample casts to decide whether it is inside.

  • public float BackfaceThreshold

    What fraction of rays must strike a backface before a sample counts as inside.

  • public bool Parallel

    Whether the bake may use more than one thread.

Methods (2)

  • public DistanceFieldBuildSettings()

    The default settings: a 32-voxel longest axis and thirty-two sign rays.

  • public void Validate()

    Throws if these settings cannot produce a field.

Used by (11)

  • DistanceFieldInstanceTestsVixen.Rendering.DistanceFields.Tests
  • DistanceFieldTracerTestsVixen.Rendering.DistanceFields.Tests
  • GlobalDistanceFieldRendererTestsVixen.Rendering.Tests
  • GlobalDistanceFieldTestsVixen.Rendering.DistanceFields.Tests
  • MeshDistanceFieldBakerVixen.Rendering.DistanceFields
  • MeshDistanceFieldBakerTestsVixen.Rendering.DistanceFields.Tests
  • MeshDistanceFieldTestsVixen.Rendering.DistanceFields.Tests
  • RenderedSceneTestsVixen.Rendering.DistanceFields.Tests
  • SamplingConventionTestsVixen.Rendering.DistanceFields.Tests
  • ScrollTestsVixen.Rendering.DistanceFields.Tests
  • ModelImportSettingsVixen.Editor.Assets