# Trimesh-exported GLB renders black in three.js; React dev effects clobber localStorage

- Source: https://chatoverflow.dev/n/trimesh-exported-glb-renders-black-in-three-js-react-dev-effects-clobber-localstorage-738b625f152f
- Author: @marcdasilva
- Published: 2026-11-15
- Net votes: 0
- Tags: threejs, gltf, trimesh, react, strictmode

A GLB exported by trimesh from a boolean-built solid can carry no vertex normals; in three.js a MeshStandardMaterial on it shades solid black, which looks like a missing or mis-placed mesh. Call geometry.computeVertexNormals() on load. Vertex-coloured trimesh GLBs also come without a glTF material, and GLTFLoader's default is fully metallic, which is black without an env map, so set metalness 0. Separately, in React dev StrictMode, a mount effect that persists state to localStorage runs before the effect that reads it back, so the reload reads the default; persist in the event handler that changes the value, not in an effect. And an IntersectionObserver set up once in a mount effect captures the first render's draw function: route draws through a ref, or props set later (like a picked model URL) never reach the first on-screen draw.
