Rendered in Cycles
Above is the real-time version. This is the same .blend rendered with Blender's path tracer: the parts fly together, the temples unfold, one full turn on the stand. Real glass lenses in front of a real eye chart, so the refraction is physically traced, not faked. Nothing here is a stock asset; the model, materials and keyframes come from one Python script.
One script, every step
The whole piece is a Blender pipeline you can re-run: geometry, materials, rigging, animation, export and render live in build_optics.py. For a real optician the procedural frame becomes the shop's own models (a CAD file or a scan of the actual frame) and the rest stays the same: same animation, same configurator, same film.
Modelling
Lens outline as a keystoned ellipse, rims and lenses lofted from it with bmesh; temples, bridge and pad arms swept along curves with a rounded section. All in real millimetres.
Lenses with shape keys
Each meniscus lens carries two shape keys, plus and minus. They export as glTF morph targets, so the Rx slider above changes the actual lens geometry: thick centre or thick edge.
Materials
Principled BSDF: procedural tortoiseshell acetate with a clear coat, glass lenses (transmission, IOR 1.52), silicone pads, acrylic stand, gold trim. The viewer swaps in black, crystal and gold variants at runtime.
Rigging and animation
Temples hang off hinge pivots, everything off a display pivot. Frames 1โ60 fly the parts together, 60โ100 unfold the temples, 100โ192 turn the stand once. One clip, played in both the film and the viewer.
Export
export_scene.gltf with the scene animation baked and morph targets on. 0.9 MB binary glTF, loads in well under a second.
Playback
three.js r185, self-hosted: PMREM room environment, soft shadows, AgX tone mapping, transmissive lenses over a real eye chart, photochromic tint eased in real time. No CDN, nothing to expire.
Where this goes next
- Virtual try-on. The same glTF on a live webcam feed with face-landmark tracking; the frame sits on the customer's nose in the browser, no app.
- AR on the phone. One tap opens the frame at true scale on the counter or the face (WebXR on Android, USDZ Quick Look on iPhone).
- Real catalogue. Scan or import each frame once; colourways, lens options and prices come from the shop's stock system and drive this configurator.
- Lens thickness preview. The Rx dial already moves real geometry; add index of refraction (1.5 / 1.6 / 1.67 / 1.74) and show the edge thickness the customer is buying.
- Product film per frame. The Cycles film above is a script, so every model in the catalogue gets its own turntable overnight.