Vertex Data Preparation
scene/src/geometry_optimize.rs provides per-section vertex fetch optimization and mesh-local position/normal encoding helpers.
Split Streams & Optimization
- Static, non-skinned triangle draws split into a 12-byte
float3position stream and a 124-byte attribute stream containing the remainingSceneVertexfields, making the position stream independently bindable for depth and portal passes. - Each section builds compact streams with remapped indices while retaining source vertex IDs on the CPU.
- Optimization uses
engine_scene::meshopt(a Rust port of meshoptimizer's vertex-fetch remapping) while preserving triangle order for every section — no triangle cache reordering is applied. - GPU-culled instances, dynamic geometry, skinning outputs, and temporal motion vertices retain their specialized layouts.
Quantization Status
The runtime renderer does not quantize vertex streams: mesh-local position and normal encodings have measured nonzero errors and are limited to mesh-local coordinates (never BSP, terrain, or world coordinates).
| Measurement | Notes |
|---|---|
| Split stream overhead | Compacting sections independently can duplicate vertices shared across sections, slightly increasing total bytes (+~0.05% in dense town fixtures) while enabling independent position-only binds |
| Cache simulation (16-entry, 136-byte stride) | Order-preserving fetch remapping reduces simulated fetch bytes by ~2–4% on multi-section meshes while keeping ACMR identical |
| Quantization error (offline probe) | Measured max local position error 0.0005–0.0092 units and max normal angular error 1.4e-7–4.9e-5 rad across reference static meshes |
Reproduce measurements with a host's geometry_optimize test over a supplied asset set.