3d-web-performancelisted
Install: claude install-skill RaveenDi/Skilloadout
# 3D Web Performance Budget
A beautiful 3D site that stutters is worse than no 3D at all. Treat performance as a design constraint from day one.
## The budget (per scene, mid-range phone target)
| Metric | Budget |
|--------|--------|
| Initial download (JS + assets before first frame) | ≤ 3–5 MB |
| Draw calls | ≤ 100 (mobile), ≤ 250 (desktop) |
| Triangles on screen | ≤ 300k mobile, ≤ 1.5M desktop |
| Textures | ≤ 1K mobile / 2K desktop, KTX2-compressed |
| Frame time | ≤ 16 ms (aim 10 ms to leave headroom for scroll/DOM) |
| DPR | `Math.min(devicePixelRatio, 1.5)` (2 for hero-only moments on desktop) |
## Asset pipeline
```bash
# geometry + textures in one pass (gltf-transform CLI)
npx @gltf-transform/cli optimize in.glb out.glb \
--compress meshopt --texture-compress ktx2 --texture-size 2048 --simplify true
```
- Meshopt or Draco for geometry (Meshopt decodes faster; Draco smaller).
- KTX2: UASTC for normal maps, ETC1S for albedo/roughness. Set up `KTX2Loader` with the basis transcoder path.
- Bake lighting/AO into textures for static content. Merge static meshes by material.
- Split assets per chapter; preload chapter N+1 while the user is in chapter N.
## Runtime techniques
- **Instancing** (`InstancedMesh` / drei `<Instances>`) for anything repeated > 10 times.
- **LOD** (`THREE.LOD` / drei `<Detailed>`) for large hero meshes seen at distance.
- **Frustum + visibility culling**: set `object.visible = false` for chapters not on screen; `frustumCulled` stays tru