02.1Case file/projects/studio/
sheet 02 of 06
The 3D studio
A room you can walk into, scripted in Blender and rendered live
- role
- Solo
- context
- My own project, since Jul 2026
- scope
- The room at /room/, built by Blender Python scripts
- result
- First entry 28.7 → 14 MB · 10 checks before every merge
Dependencies
- Blender (Python)
- Cycles bake
- three.js
- KTX2
- Vite + TypeScript
- Playwright checks
Changelog
- every wall, lamp and book is placed by a Python build script, then baked in Cycles
- the room opens on about 14 MB and streams the rest in while you look around
- ten automated checks, pixel screenshots included, run before a change merges
What it is
A closed room, 12 × 16 × 5.2 units (about 6.6 × 8.8 m), that you look around and walk through in the browser. It is my studio: the desk, the rack, a window onto a line-drawn city. Each object with a blue number on it opens one part of this site. Day is the default; "after hours" is a switch. Open the room


The pipeline
Geometry. Nothing in the room is modelled by hand: every wall, light and book is placed by a Python build script run in Blender. The scripts are the source of truth. The room is exported as a GLB with named nodes, and behaviour stays in code, bound to those names.
Light. Light is baked in Cycles into lightmap atlases, one per group of objects and light layer. There are seven layers: base, lamp, pendant, down, sky, sun and night. The page turns them up and down, which is how day, after hours and the lamp work. Every atlas carries a fingerprint of the UV layout it was baked for. The atlases are compressed to KTX2 and streamed into three.js; the outlines are drawn live, at about 2 ms a frame.
Loading. The room opens on about 14 MB, down from 28.7 MB: quarter-size lightmaps first (7.9 MB), half-size textures, the character and the day's city. Then one image is swapped in per frame until everything is full size: the lightmaps before the door opens, the rest after. The night's layer waits until someone asks for after hours. Shaders are compiled before the door opens: 147 programs, 2.6 s measured.


How I test it
A room is hard to test by looking, so ten scripted checks run against the built site before a change merges. They drive Chrome on a real GPU.
- capture_views — screenshots from the same camera poses, with the random numbers and the clock fixed. Two runs of one build match to the pixel, so any difference is a real change.
- functional_check — clicks, hovers, keys, Back four ways and deep links; it fails on any WebGL error.
- content_snapshot — the HTML of all 10 paths: every object says the same words.
- style_snapshot — every element's computed style in 8 states (splash, room, card and reader, each on desktop and phone). It once caught the CSS minifier dropping a rule.
- entry_check — the
?enterteleport: a veil while loading, enters by itself, sound waits for the first press. - stream_check — streamed, the room ends exactly where
?eagerstarts: every texture and atlas at full size. - load_phases — the bytes fetched when "Setting up the room" begins, the shader compile time and the programs compiled; a fresh profile each run, so no shader cache.
- mixer_check — the sound panel: opens and closes, music, rain sound and rainfall reach their outputs, and the levels survive a reload.
- day_check — day and after hours, clear and rain: the night's layer is not loaded at the start and loads on the first press; the light levels in each state.
- measure_frame — the cost of a frame through the full post chain, draw calls and triangles. I run it in alternating pairs because this machine's clock wanders: the same old build measured 19 ms in one run and 34 ms in another.
Numbers
- ~14 MB to first entry (was 28.7 MB), of which 7.9 MB is the quarter-size lightmaps
- 2.6 s to compile 147 shader programs, before the door opens
- ~2 ms a frame for the live ink outlines
- 7 light layers, 10 automated checks before a change merges
- 12 × 16 × 5.2 units, about 6.6 × 8.8 m
What's next
- The sky through the window reads pale: only its horizon band shows. Its levels are set by eye, and I want it bluer.
- The outlines cost about 2 ms a frame, and an object lying flat (a sheet on a desk) gets no border where depth and normals agree. The fix is an object-ID channel, which I have not built.