web3d-realism-performancelisted
Install: claude install-skill saad-git-007/claude-skills
# Photorealism and performance for web 3D scenes
Lessons from building and tuning a three.js portfolio scene (a glass pavilion on a sea cliff, a forest, about 250
draw calls): 11 measured optimisation iterations cut mean frame time by 22% with no visible change, and a Cycles light
bake added soft bounce light for +3% frame time. The two goals are not in conflict as often as it seems. Most of the
real cost in a typical scene is wasted work (pixels shaded and then painted over, lights evaluated where they add
nothing), and most of the realism comes from light that can be computed once, offline, instead of every frame.
## The working loop
Everything below depends on being able to answer two questions with numbers: *did this make it faster?* and *did the
image change?* Set that up before touching the scene, because intuition about GPU cost is wrong surprisingly often
(in the project, a depth pre-pass, strict front-to-back sorting and plain PCF shadows all looked like wins and were not).
1. **Make the scene deterministic.** Pin every animation (wind, water, clouds, rotating props) to a fixed time before
measuring. Unpinned tree sway alone made identical code differ by 2% SSIM.
2. **Benchmark fixed poses on a real GPU.** Headless Chrome with a GPU: `--use-angle=gl-egl --ignore-gpu-blocklist
--enable-gpu` (Linux) and `env -u DISPLAY` so it uses EGL rather than a virtual X display. Software WebGL
(SwiftShader, llvmpipe, Playwright's default) says nothing about GPU cost,