Planning a compound in the browser with React Three Fiber
01Three.js for Site Planning
THE BRIEF
Planners think in space, not spreadsheets
The client had a 400-row spreadsheet of plots. They needed to see the compound, move buildings and argue about heights in the meeting, not after it.
02The brief
A scene is JSX
Building.tsx
<Canvasshadowscamera={{ position: [9,8,9] }}><meshposition={[x, h /2, z]}castShadowonClick={raise}><boxGeometryargs={[1, h,1]}/><meshStandardMaterialcolor="#E24A12"/></mesh><OrbitControlsmakeDefault/></Canvas>
03A scene is JSX
Site planner (3D)
LIVE · click a building
1 · buildings rise
2 · plan view
3 · street level
04Live: the site planner
One camera shot per step
CameraRig.tsx
const step =useStep();// from slides-kit/threeuseFrame((_, dt)=>{const[pos, look]= SHOTS[step];const k = Math.min(1, dt *3);// ease towards the shot, then hand control back camera.position.lerp(pos, k); controls.target.lerp(look, k); controls.update();});
<iframe src="https://slides.ezzdinatef.com/embed/three-js-for-site-planning" width="960" height="600" style="border:0;border-radius:12px" allow="fullscreen" title="Three.js for Site Planning"></iframe>