More on configurators and ecommerce for bed and wardrobe sellers: Bedrooms.
LightMix is a bedroom you can stand in and relight. You look around it in 360°, drag the time of day from noon to night, dim each lamp on its own, and repaint the walls, headboard, bedding, curtains and wardrobe in any colour. It runs in a normal web page on three.js, and every frame keeps the look of a path-traced render, including the colour a painted wall bounces onto the ceiling and the bed.
The browser path traces nothing. The light was traced once, offline, in Blender. What the browser does, in my own code on top of three.js, is mix that light again on every change. That mixing is the subject of this page.
Open the LightMix demoTalk to me about a visualiser
- 4light groups, mixed per pixel: daylight, pendant, bedside lamps, headboard LED
- Anycolour on five parts, with the bounce light it really casts
- 60 fpswhile you drag a colour across the full-resolution picture
- 1.4 sto the first picture on the live site, measured on a desktop
- 5 MBof light layers for the whole room, streamed by what you look at
- 0path tracing in the browser, and no server rendering
What you can do in it
- Look around in 360°Drag to look, and scroll or pinch to zoom. The full picture is 4096 by 2048 pixels and sharpens tile by tile where you look.
- Move the time of dayA slider runs from 11:00 to 23:00. The sun weakens and warms, the camera’s exposure follows, and the lamps take over.
- Dim each light groupThe pendant, the two bedside lamps and the LED strip behind the headboard each have a switch, a dimmer and their own colour temperature from 2200K to 5000K.
- Repaint five partsWalls, headboard, bedding, curtains and wardrobe take any colour from swatches or a colour field. The floor and wardrobe also have material options.
- Tap what you want to changePoint at the headboard and it outlines itself. Tap it and its colours open.
- Drop live 3D objects inAn ottoman and a brass vase, rendered by three.js in real time, sit inside the path-traced room. They hide behind the bed, pick up the room’s current light, and slide across the floor when you drag them.


How it works
- Render onceBlender Cycles renders each layer of the room with all lights on, split into one pass per light group.
- PackEach pass is stored as log-encoded light in a 4:4:4 AVIF, at quarter, half and full size, the full size cut into tiles.
- Sumthree.js adds the layers into half-float render targets, one per light group, using additive blending.
- Mix and showA three.js shader mixes the light groups per pixel with your dimmer and colour settings, then three.js tone-maps the result.
Light adds up
A room lit by the sun and three sets of lamps is exactly the sum of four pictures, one per light. Cycles can split a single render into those four pictures at once, using light groups. The browser keeps each one in its own floating-point buffer and adds them together per pixel, each multiplied by its dimmer and its colour. Moving the time-of-day slider changes four numbers. Nothing is rebuilt, which is why the lighting stays smooth at full frame rate.
Lamp colour works the same way. The lamps were rendered at 3000K, so a warmer or cooler lamp is a per-channel weight: the ratio of a blackbody at the new temperature to one at 3000K, softened the way eyes adapt to warm or cool light.
Any colour, with its own bounce light
Each paintable part is rendered twice over the whole frame, nothing held out: once with the part almost white, once with it black. The difference between those two renders is everything that part’s colour does to the picture. That includes its own pixels and the light it bounces onto the ceiling, the floor and the bed. The room was rendered with the part in a default colour, so any new colour is the room plus a weighted difference:
picture = room + (new colour − default colour) ÷ 0.9 × (white render − black render)
Bounce light is smooth by nature, so away from the part itself the difference is blurred to remove the noise of subtracting two renders. On the part’s own pixels the room is rebuilt from the same two renders. They share a random seed, so their noise cancels, and a strong recolour stays clean.
My earlier PanoKitchen visualiser recoloured each surface on its own. This method also moves the colour that surface throws onto everything around it, which is much of what makes a repainted room look real.

Live colour at full resolution
The full panorama is too big to rebuild on every pointer move. So while you drag a colour, the engine does not rebuild anything. Light is linear, so the new picture is the old one plus the change in weight times one layer, added straight into the cache. The layers of the part you are editing are kept decoded for the tiles in view, which makes each step a handful of GPU draws. When you stop, the touched tiles are quietly rebuilt from scratch to clear any half-float rounding. In my tests, 120 steps of this left the picture at most 2 levels out of 255 away from a clean rebuild, before the clean-up ran.
A virtual texture for the 360° view
The full-size panorama is cut into 1024-pixel tiles with a gutter, stored per layer. A fixed cache on the GPU holds the summed light for the tiles you are looking at, and a small index texture tells the panorama shader which cache slot holds which tile. Anywhere else, it draws a half-size picture until the sharp tile arrives. Tiles in the middle of the screen decode first, in a pool of web workers, and each tile is only rebuilt when a layer it contains has changed. Repainting the wardrobe leaves the ceiling alone. The “How it works” button in the demo shows this tile grid live.
Real-time objects inside a rendered room
Blender also writes each pixel’s distance from the camera. The panorama shader turns that into real depth, so ordinary three.js meshes are hidden behind the bed and the furniture as if they were part of the render. Those meshes are lit by an environment map rebuilt from the current light mix, so they warm up at dusk and reflect the walls in whatever colour you chose. It is a small step towards placing a real product into a photoreal room.

Building a scene that holds up
This method shows every flaw in the source render, because people look at it closely and for a long time. The bedroom is built entirely by a Python script in Blender, so it can be rebuilt and improved in minutes:
- Bedding is simulated cloth. The pillows are inflated cases with weight that slump onto the mattress and against the headboard. The duvet and throw are dropped onto the bed, so their folds and overhang come from physics.
- An automatic clipping check. Every object is tested against every other for intersections, and the bake script refuses to run while anything cuts into anything else. Its first run found ten problems, including a plant growing into the wall.
- Licence-clean assets. The room, furniture and the framed print are modelled by the script. The textures, a few models and the garden view are CC0 from Poly Haven, and the build records each one with its authors.
What I measured, and what it does not prove
| Measure | Result |
|---|---|
| First picture | 1.4 s after the page loads |
| Sharp in view | about 1.2 s after the first picture |
| Light layers for the whole room | about 5 MB, fetched as you look around |
| Dragging a colour across 120 steps | every tile in view stayed sharp, at 180 frames a second with the frame cap off |
| Changing the floor to carpet | sharp again in about 0.5 s |
These are numbers from one fast desktop. I have not yet measured phones, where both decoding and memory are tighter. It has limits by design:
- You look around from one fixed point. You cannot walk through the room.
- Only the parts that were rendered as layers can change. A new piece of furniture means a new render.
- Live 3D objects are lit by the room but do not cast shadows into it, beyond a soft contact shadow.
Built with
The engine and the scene scripts are mine. They stand on three.js for rendering in the browser, Blender Cycles for the offline path tracing, sharp for the AVIF encoding, and Poly Haven’s CC0 library for textures and a few models.
Want your products in a room like this?
The method suits anything with a fixed shape and many finishes, seen in a real setting: beds and bedroom furniture, kitchens, bathrooms, salon interiors, show homes. If customers need to rearrange the room itself, a real-time 3D configurator is often the better fit. Start with a free 30-minute consultation and we can work out which suits your range.