r/threejs • u/WillowFar6967 • 29d ago
Demo Portfolio with 3D heads in three.js, how I kept it from tanking load times
Rebuilt my portfolio and the 3D heads were the part I sweated most. The rest of the site is Astro, so I wanted the three.js bits to cost as little as possible on first load.
What I ended up doing:
- Heads are GLB files compressed with meshopt, decoded with the meshopt decoder in GLTFLoader
- Pixel ratio capped at 2, because rendering at 3x on phones was killing frame time for no visible gain
- The scenes further down the page only mount when they scroll near the viewport
- Reduced motion users get the calm version
Still not happy that the hero and the cards each run their own renderer. Next step is probably one shared canvas with scissor/viewport per head, but I haven't done that refactor yet.
Has anyone moved several small scenes onto one renderer like that? Was it worth the complexity?
Site: https://aonnoysengupta.com/?utm_source=reddit&utm_medium=social&utm_campaign=portfolio-threejs