By Dim Kuzmenko
Published: November 19, 2026
Updated: November 19, 2026
12 min read
Guides

Baked Lighting in three.js: Moving a Corona Kitchen Into the Browser

Baked lighting means the light, shadows and bounce light of a scene are calculated once, offline, and stored in textures, so the viewer reads them instead of computing them. Between November 4 and 17, 2026 we used it to move a kitchen from 3ds Max and Corona into three.js: a walkable browser tour with 8 opening storage groups, a pendant light switch and a 3D courtyard. This is the build log, with the numbers we measured and the mistakes we made.

Most guides to baked lighting are written for Unity and Unreal Engine games. A web archviz scene differs in three ways: the source lighting comes from an offline renderer like Corona, the result has to download over the web, and buyers will open doors you baked shut. Each section below covers one of those problems.

The interactive kitchen in three.js with the island pendant switched on; light, shadows and reflections come from baked Corona maps
The finished tour in the browser, island light on. Every visible shade comes from a baked Corona map.

How Baked Lighting Works in a three.js Scene

Game engines usually bake a separate lightmap and multiply it with the material's own texture at runtime. We baked differently: Corona wrote the complete appearance of each surface, colour, light and shadow together, into a texture laid out on the object's second UV channel (UV2). In three.js every surface then gets an unlit material that simply shows that texture.

That choice has three consequences:

  • The picture matches the render. There is no runtime lighting to drift away from what the visualizer approved in Corona.
  • The device does little work. No shadows or global illumination are computed in the browser.
  • Nothing relights itself. A door that opens does not change the shadow it casts. Every state a visitor can reach has to be baked in advance.
Approach and dateWhat it givesOur decision
Direct GLB export from 3ds Max (Nov 5)One file, no extra toolsRejected: two exports lost or mixed up UV2
FBX to Blender to glTF (Nov 5)Keeps the second UV channelChosen
Full-colour bake in Corona plus three.js (Nov 4–17)The look of the source renders, with interactionChosen; moving objects do not recompute bounce light
Unreal Engine with pixel streamingLive lightingDeferred; not built in this project
Gaussian splats (earlier apartment test, 9.7 MB)Free movement through a captured sceneNot used: soft blobs up close

The Pipeline From 3ds Max and Corona to the Browser

The route that survived two weeks of fixes has eleven steps:

  1. Receive FBX, EXR maps, alpha masks and a list of replacements and states. Keep the untouched originals.
  2. Check every archive: file count, full object names, UV2 and dimensions. Read the exit code and the log, not just the folder.
  3. Import the FBX into Blender on a server. Never assign maps by numeric prefix alone.
  4. Match replaced assemblies and remove duplicates. Keep open states and material variants as separate objects.
  5. Check problem fronts both in an isolated render and in the assembled scene.
  6. Export glTF, compress it for transport and write an explicit manifest of objects and maps.
  7. Assign materials, states, light pairs and movement limits.
  8. Take before and after screenshots from the same camera. Check edges, the underside of furniture, glass and plants separately.
  9. Upload binary files to object storage and verify their sizes and checksums.
  10. Change the text files through a pull request and wait for a successful deploy.
  11. Check the public page, every interaction and the console. Write down what is still open.

Export: Why FBX Beat GLB From 3ds Max

Our first two exports were GLB files straight from 3ds Max, 148 MB and 522 MB. Both lost or scrambled the second UV channel, and the baked maps landed on the wrong parts of the mesh. Switching to FBX, importing it into Blender and exporting glTF from there kept UV2 intact. After the import we assigned each EXR through UV2 and flipped the V axis. On the first pass the maps fitted 38 of 39 objects; the next corrected set covered 42.

What to Ask the Visualizer For

Most of our fixes traced back to the delivery, not to the browser. This is the brief we now send before a bake:

  • A unique full name for every object and its map. A number on its own is not an identifier.
  • UV2 without overlaps on every baked object, with enough space and padding for narrow edges.
  • Corona Render to Texture with BASE COLOR, the full colour with light. No LUT, bloom or vignette.
  • EXR in half float. As a guide: 4096 px for large surfaces, 2048 px for furniture, 1024 px for small items.
  • A closed and an open version of every door, each with its own map, and a list of surfaces whose light changes.
  • ON and OFF versions of every switchable light, with identical geometry, UVs, camera settings and exposure.
  • For plants, a beauty map and a real alpha mask for each unique UV set. The alpha must not be a copy of the beauty map.
  • Every object whose shadow is already in the bake, including planters, plants, posts and fences.
  • After the bake, remove the Shell Material with Clear Shell Material, Original. Deliver FBX with UV channels, EXR, alpha and the .max file through Resource Collector.

Seams Between Fronts: Geometry or Lightmap?

Thin bright lines between cabinet fronts were the longest-running defect. They looked identical but had different causes, so one fix never covered all of them.

We reworked 43 fronts and 45 gaps: each gap became 1.2 mm wide with a recessed opaque strip behind it, so the background could no longer show through. On our control images the thin bright pixels in the upper section dropped from 298 to 4, and in the lower section from 56 to 0. Those counts come from the selected control images and one comparison script, not from every seam in the scene.

Upper kitchen fronts before the fix, with bright lines showing between the panels
Before: bright lines between the upper fronts.
The same upper fronts after the gaps were rebuilt with recessed backing strips; the bright lines are gone
After: same camera and lighting, gaps of 1.2 mm with backing strips behind them.

The lower cabinets kept one bright stripe. We swapped the background behind the scene to magenta: had the stripe been a hole, it would have turned magenta too. It stayed white, so the cause was an overexposed area in the baked map, not a gap. For three panels we re-projected the edge UVs onto the wood area of the map within 4 mm of the front, and left the open states untouched.

The Regression We Shipped and Reverted

Our first edge fix went too far. We extended the projection to the full depth of the tall side panels, and the wide side of one unit turned into horizontal smeared stripes instead of wood grain. The next fix limited the projection to 4 mm from the front and to faces pointing the right way, and split shared vertices before editing. The original UVs of the wide side came back with an accuracy of 1e-7, and no vertex moved.

A tall kitchen unit after the faulty edge fix: its wide side panel shows horizontal smeared stripes
The regression: the edge fix stretched the texture across the whole side panel.
The same tall unit after the projection was limited to the front 4 mm; the side panel shows its original wood grain again
Reverted: same camera, original side UVs restored.

The lesson went into our checklist: any edge correction is checked from the side and from below, not only from the front.

A Light Switch With No Wait

The first light switch downloaded the ON maps on click, and the pause was obvious. We converted the maps to 88 HDR-companded WebP files and compressed the geometry with Meshopt and gzip. The kitchen asset set went from 1,140,998,711 bytes to 41,435,960 bytes. Both lighting states now download in advance and are uploaded to the GPU before the visitor reaches the switch.

The conversion is not mathematically lossless. The mean colour error on screen is 0.00294, and the worst mean on a single map is 0.00891. The original EXR files are kept.

Swapping maps alone did not make the lamp look switched on, because the diffuser itself stayed grey. We separated 525 triangles of the diffuser into their own emitting surface. We have not measured the switch delay in milliseconds on a visitor's device, so we do not call it instant.

One deployment trap: serving the gzip files with a Content-Encoding header made our edge worker decompress them a second time. We now ship plain .bin.gz files and unpack them in the browser with DecompressionStream.

The Courtyard: a 45.8% Smaller Download With Identical Triangles

On November 17 our 3D artist delivered the courtyard behind the windows: 63 meshes, each with two UV channels, from the same 3ds Max project. Because the courtyard uses unlit materials, several exported attributes were never read. We removed normals, the first UV set and two vertex colour sets, merged only vertices that were identical in every remaining attribute and reordered the indices.

MetricBeforeAfterHow we checked
Compressed geometry21,483,604 bytes11,645,286 bytesFile size
Vertices in the exported file2,974,4261,909,827Accessor count
Triangles2,471,3152,471,315Position and UV signature of every triangle
Courtyard textures63 WebP filesThe same 63 filesSame URLs, unchanged files

We also moved the courtyard downloads behind the large kitchen models. A first version with 8 early requests slowed the kitchen itself, so the final one starts 6 low-priority requests. In a paired test the page load fell from 18.74 to 13.37 seconds, with 169 requests in both runs and total transfer down from 125,028,970 to 115,212,032 bytes. That was one run per version in Chromium with the SwiftShader software renderer on our server. A later fully public run took 19.7 seconds, so network and shader compilation move the number; treat it as a direction, not a benchmark.

The delivery itself hid two errors. Two plant alpha masks were copies of the beauty maps, which turned leaves into rectangles; we replaced them with masks from instances that share the same UVs and rebuilt a missing one. And the fence group floated 1.206 m above the ground.

The courtyard fence in the first assembly, floating above the ground behind the kitchen windows
Before: the fence root group sat 1.206 m above the ground.
The same view after the fence group was lowered onto the ground
After: same camera, the whole group moved, not its child meshes.

Four planters arrived empty, although the bake already contained the shadows of their plants. We filled them with 28 instances of a grass model from the same courtyard set, drawn as one InstancedMesh with no new textures. That is a reconstruction: the original planting layout is unknown.

Empty planters around the courtyard seating, with baked plant shadows but no plants
Before: empty planters with plant shadows already baked into the courtyard.
The same planters filled with 28 instances of grass from the courtyard set
After: 28 grass instances, one InstancedMesh, no new downloads.

What Did Not Work Behind the Windows

Before the courtyard model arrived we tried to fill the windows ourselves, and three approaches failed:

AttemptWhat we builtResult
Flat image (Nov 11)A picture behind the glassRejected: quality, and it slid wrongly as the camera moved
Grounded 360° (Nov 12)A CC0 garden panorama from Poly Haven, 8192 px, 8,496,120-byte WebPRejected: distorted away from its capture point
Procedural 3D yard (Nov 12–13)Geometry and plants, then a terrace, pergola and furnitureParallax worked; the look was rejected twice

We showed a white background until the courtyard from the original 3ds Max project arrived. Every one of those attempts passed its technical checks and still failed on looks.

Window Frames: When to Break the Bake

The window profiles were baked as black acrylic. Brightening that map removed the black but flattened the profile into a white strip, and the result was rejected. The fix broke the bake on purpose for two objects only: the two profile meshes got a MeshStandardMaterial, white, roughness 0.55 and envMapIntensity 0.22, with normals and a one-time 2048 px shadow map. The old baked map now only darkens the recesses. The rest of the kitchen stayed fully baked.

The window frame as delivered in the bake: black acrylic profiles
As baked: black profiles.
The window frame after brightening the baked map: white, but flat with no visible edges
First attempt: brightened map, flat white strip.
The window frame with a lit standard material: white profiles with visible edges and their own shadows
Final: two meshes lit in the browser, with their own shadows.

Lessons for a Baked-Lighting Web Scene

  • A full name beats a number. Four replaced objects on November 11 only worked once geometry, UVs and maps matched by name.
  • A white line is not always a hole. The magenta background test told a lightmap defect from a gap in one look.
  • Measure speed apart from quality. The courtyard got 45.8% lighter with every triangle and UV unchanged.
  • Passing checks is not approval. Two procedural yards passed every test and were still rejected on looks.
  • Check a local fix from the side. One edge correction damaged a wide panel; the revert restored UVs to 1e-7.
  • A bake needs the whole scene. Four empty planters only showed up when someone looked at the courtyard.

What We Have Not Measured Yet

All timings above come from server-side Chromium with a software renderer. That renderer is good for screenshots and functional checks, but it says nothing about frame rate on a visitor's hardware. Still open: frame rate, memory and switch response on a desktop GPU, loading and heat on phones, and a full 24-view walkthrough of the latest version. We will add those numbers here when we have them.

For the buyer's side of the same project, what visitors can open and when an interactive tour is worth building, see our guide to the interactive virtual tour.

Turn Ideas Into Visual Stories

Whether you’re planning a product launch, marketing campaign, or real estate project, high-quality CGI helps communicate ideas clearly and accelerate decision-making. Our team creates photorealistic visuals used in marketing, presentations, and pre-sales worldwide.
Book a call
Dim Kuzmenko, co-founder — Maverick Frame 3D rendering studio team

Dim Kuzmenko

Co-Founder

View full profile

FAQ

Frequently Asked Questions

Didn’t find your question?

Ask it here. A producer replies within one business day — with an answer, not a sales call.

Got it — thank you. Expect an answer in your inbox within one business day.
What is baked lighting?

Lighting calculated in advance and saved into textures, called lightmaps. The viewer reads the textures instead of calculating light, shadows and bounce light in real time, which makes realistic lighting cheap to display.

Can three.js use baked lighting from Corona or V-Ray?

Yes. Bake the lighting into a texture on a second UV channel, export the model to glTF with that channel intact and show the texture with an unlit material. We baked full colour with light in Corona and displayed it in three.js r170.

Should I export GLB directly from 3ds Max for a baked scene?

In our project, no. Two direct GLB exports lost or mixed up the second UV channel. FBX imported into Blender and exported to glTF kept it.

Does baked lighting work with doors and drawers that open?

Only if every state is baked. We delivered each door closed and open with its own map, and each switchable light as an ON and OFF pair, because a moving object does not recompute baked shadows.

How large is a baked-lighting web tour?

Our kitchen asset set went from about 1.14 GB of source maps to 41.4 MB after conversion to WebP and Meshopt compression. With the courtyard, one server-side test transferred about 115 MB for the whole page.

Remote studio, your time zone

Planning visuals for a project? Talk to a producer

Thirty minutes on scope, deliverables and timing. Pick a day and a time in your own time zone; the invite comes by email.

Book a 30-minute call

  1. Day
  2. Time
  3. Email

Which day suits you?

What time?

Where should we send the invite?

  • 30 minutes
  • Free, no obligation
  • Invite by email
The call is booked. The calendar invite is on its way to your inbox. Need another time? Just reply to it.