Phase 5 updates

Phase 5 · Slice 31 ·

Mesh LODs

  • crates/render/src/simplify.rs: our own simplifier, quadric error metrics with half-edge collapses (a vertex merges into a neighbor, so every level indexes the original vertices). Border and seam vertices stay (no cracks); collapses must keep the link condition, must not fold or steeply turn a triangle, and must not turn it past its original facing (small turns add up). It reports the geometric error it accepted.
  • MeshData::generate_lods: levels of about half the triangles each while that pays, with growing errors; their triangles live apart from the mesh's (physics and scripts see the full mesh) and upload after them, as extra draw ranges.
  • Selection: per renderer, the coarsest level whose error, projected through the first scene camera, is within QualitySettings.meshLodThreshold pixels of a 1080-pixel-tall view (meshLodSelectionBias halves the allowance per unit; forceMeshLod pins a level). The level becomes the draw item's range, so instancing and GPU culling treat levels as submeshes.
  • Unity 6's API: Mesh.lodCount, Mesh.GetLod (MeshLodRange), UnityEditor.MeshLodUtility.GenerateMeshLods (usable at run time here), MeshRenderer.meshLodSelectionBias and forceMeshLod.
  • Tests: simplifier (a sphere halves and quarters with growing error and no flips; a flat grid keeps its border and has no error), LOD selection by distance, bias and forcing, and a GPU test drawing each level from its range. (Also fixes the UI vertex ABI size check the previous slice missed.)
  • Not yet: mesh LODs from model importer settings, per-view selection, cross-fades, GPU-side selection.
  • Next: bindless materials.