Vixen
02b45cc4
csharp
public static class MeshletCut

Which clusters of a DAG to draw — the CPU's answer, against which the device's is checked.

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

Remarks

Improvement 4 of docs/plan/22-virtualized-geometry.md: the parts of this system that fail silently get a CPU reference. A cut chosen with an error metric that is non-monotonic at one edge of one mesh produces a crack at one distance, and finding that in a frame capture is a bad afternoon. Finding it here is a unit test.

A cut is chosen per cluster, with no traversal and no agreement between neighbours. SelectByError is a linear scan asking each cluster one question about itself, which is exactly what the traversal shader of phase 3 will ask — it will simply ask it hierarchically, so that a rejected subtree costs one test rather than one per cluster. That the two produce the same set is the property worth testing, and it holds because a cluster's own error and its parent's bracket a half-open interval of thresholds, and the intervals along any path through the DAG tile the number line exactly once.

Methods (6)

  • public static int[] SelectByError(MeshletMesh mesh, float threshold)

    The clusters to draw at a given object-space error threshold.

  • public static int[] SelectByError(MeshletMesh mesh, MeshletPageSet pages, float threshold, Func<int, bool> isResident)

    The clusters to draw at a threshold, given that only some of the pages have arrived.

  • public static int[] SelectByBudget(MeshletMesh mesh, int triangleBudget)

    The finest cut that fits inside a triangle budget.

  • public static int[] Flatten(MeshletMesh mesh, ReadOnlySpan<int> cut)

    A cut's triangles, as an ordinary index buffer over the source mesh's vertices.

  • public static float PixelError(float error, float distance, float verticalFieldOfView, float screenHeight)

    How many pixels of screen an object-space deviation covers.

  • public static float ErrorForPixels(float pixels, float distance, float verticalFieldOfView, float screenHeight)

    The object-space error that projects to a given number of pixels.

Used by (6)

  • MeshletBuilderTestsVixen.Rendering.VirtualGeometry.Tests
  • MeshletCutTestsVixen.Rendering.VirtualGeometry.Tests
  • MeshletStreamingTestsVixen.Rendering.Tests
  • MeshletValidatorVixen.Rendering.VirtualGeometry
  • SessionVixen.Rendering.VirtualGeometry
  • SoftwareRasterTestsVixen.Rendering.Tests