Files
2d3d-ro/package.json
T
Claude (Beletage) 5e47123446 Perf: pause off-screen 3D scenes; cheaper materials and lighting
The previous build kicked off 7 simultaneous WebGL render loops (1 hero + 6
typology canvases), each running at 60fps with shadow recompute, multiple
directional lights and (on the contemporary house) an expensive
MeshPhysicalMaterial with transmission. By the bottom of the page the GPU
budget was completely saturated and scrolling juddered.

Changes:
- Scene render loop now respects an `active` flag; rAF stops when paused
- IntersectionObserver in bootstrap activates only canvases in/near viewport
  (rootMargin 150px), pauses the rest
- Hero scene also gets its own IO so it stops rendering once scrolled past
- visibilitychange listener pauses every scene when the tab is backgrounded
- Hero canvas shadow render is on-demand via a `needsRender` flag — auto-rotate
  still triggers a re-render each frame (otherwise nothing moves), but pointer
  drag, resize and idle frames coalesce
- Replaced MeshPhysicalMaterial (multi-pass transmission) with a cheap
  MeshStandardMaterial for contemporary house glass — visually almost identical
- Reduced per-scene lighting from hemi+key+fill+rim (4 lights) to hemi+key (2)
- DPR cap lowered from 2 to 1.5 — invisible at typical viewing distance
- Disabled MSAA when DPR > 1.25; relies on supersampling instead

End-of-page scroll should now be smooth on integrated GPUs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 09:03:30 +03:00

29 lines
562 B
JSON

{
"name": "2d3d-ro",
"type": "module",
"version": "0.0.1",
"engines": {
"node": ">=22.12.0"
},
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/sitemap": "^3.7.2",
"@tailwindcss/vite": "^4.2.2",
"astro": "^6.1.8",
"gsap": "^3.15.0",
"lenis": "^1.3.23",
"tailwindcss": "^4.2.2",
"three": "^0.184.0"
},
"devDependencies": {
"@types/three": "^0.184.0",
"sharp": "^0.34.5",
"wrangler": "^4.83.0"
}
}