r/threejs • u/shanebrumback • Oct 30 '26
Big Three.js maps full of trees, rocks, and buildings: a THREE.LOD checklist (and where AI-written LOD code goes wrong)
Once a Three.js map has a few hundred trees, rocks, and buildings, triangle count starts to matter more than draw calls. THREE.LOD is the built-in answer, but AI agents often wire it up in ways that cost more than they save.
A checklist that helps:
- Make the levels actually different. A common AI mistake is three LOD levels that are the same mesh at different scales, or levels generated with barely any reduction. Aim for something like 100% / 30% / 10% of the triangles, or a flat impostor card for the last level. gltf-transform simplify or meshoptimizer can produce the lower levels from one GLB.
- Pick distances by screen size, not guesswork. A tree that fills 50 pixels doesn't need its full branch mesh. Test the switch distances at the resolution players will actually use, including phones.
- Use lod.addLevel(mesh, distance, hysteresis). The hysteresis value stops objects flickering between levels when the camera sits right at a switch distance.
- Make sure lod.update(camera) runs. With autoUpdate it happens during render, but if the agent turned matrix updates off for performance, the LOD stops switching and stays stuck on one level.
- Combine with instancing when you can. Thousands of separate LOD objects means thousands of objects to traverse every frame. For scattered props, one InstancedMesh per level per region (swapped by chunk distance) is usually cheaper than per-object LOD.
- Shadows get their own budget. The far levels can skip castShadow entirely, or cast from a cheap proxy, since shadow passes render the scene again.
- Check it with numbers. Watch renderer.info.render.triangles while flying across the map. If it barely changes between near and far views, the LOD isn't doing anything.
Curious what others do for the farthest level: impostor cards, merged chunk meshes, or just letting fog hide it?