Ticket 014 V1 bakes per-mesh 32³ UDFs via a brute-force point-triangle GPU compute. Sponza's 68 meshes finish in ~9 frames at 8 bakes/frame — fast enough in-session that on-disk persistence wasn't needed. But every cold launch re-bakes the same meshes from scratch.
When to do this
- Cold-launch UX starts to matter (benchmarks, player expectations, etc.).
- Mesh count scales beyond hundreds — brute-force bake is O(voxels × triangles) per mesh, so a 500-mesh scene with 10k tris/mesh starts to take seconds.
Scope
- New module
native/shared/src/sdf_cache.rs.
- Key per mesh by a content hash of
{ vertex positions, index buffer }.
- Value: the 32³ R32Float voxel data (~128 KB per mesh).
- Store under a platform-appropriate cache dir (macOS:
~/Library/Caches/bloom; iOS/tvOS: NSTemporaryDirectory; Web: IndexedDB).
- Load path: hash → lookup → texture upload (skip bake) OR bake + cache on miss.
- Invalidate on asset change (hash mismatch).
Budget
Sponza: 68 × 128 KB = 8.7 MB on disk. Load time per mesh: texture upload only, < 0.1 ms on SSD.
See docs/perf/014-lumen-mesh-sdfs.md §V15 closure.
Ticket 014 V1 bakes per-mesh 32³ UDFs via a brute-force point-triangle GPU compute. Sponza's 68 meshes finish in ~9 frames at 8 bakes/frame — fast enough in-session that on-disk persistence wasn't needed. But every cold launch re-bakes the same meshes from scratch.
When to do this
Scope
native/shared/src/sdf_cache.rs.{ vertex positions, index buffer }.~/Library/Caches/bloom; iOS/tvOS: NSTemporaryDirectory; Web: IndexedDB).Budget
Sponza: 68 × 128 KB = 8.7 MB on disk. Load time per mesh: texture upload only, < 0.1 ms on SSD.
See docs/perf/014-lumen-mesh-sdfs.md §V15 closure.