Light a scene with an HDR skybox (IBL)
site/media/lessons/learn-skybox.lesson.ts (4 steps) An equirectangular HDR (a 2:1 panorama of the sky) is the cheapest way to make a scene look
real: it becomes both the background you see and the lighting on every surface. You donβt
place any lights β the sky is the light. Point environment.skybox at the file and the engine
does the rest.
-
The scene is already open. If you followed the link above, the skybox scene is loaded and rendering (in the local dev editor:
VGAI_PROJECT=examples/feature-scenes npm run dev, then openscenes/learn-skybox.vscn.json). Three spheres sit under a real HDR sky. The engine loadedtextures/learn-sky.hdrwithRGBELoader, ran it through aPMREMGenerator, and assigned the result to bothscene.backgroundandscene.environment.
One HDR file is the sky and the light. -
The chrome sphere mirrors the sky. A
metalness: 1, roughness: 0.05material is a near-mirror β its blue gradient is the sky reflected in the metal (remove the skybox and the same sphere goes dark). That reflection is the env map: image-based lighting (IBL).
Pure metal mirrors scene.environment. -
The glossy red sphere picks up the sky. A dielectric (
metalness: 0) with low roughness isnβt a mirror, but its specular highlight is the sky β so it still reads as lit by the environment.
Dielectrics catch the sky in their highlights. -
The brushed sphere shows blurred IBL. Raise roughness (
0.45) and the reflection blurs β PMREM pre-filters the env map into mip levels so rough surfaces sample a softer sky. Same map, rougher look.
Roughness blurs the reflection β pre-filtered IBL.
// the whole skybox setup is three lines of environment:"environment": { "skybox": "textures/learn-sky.hdr", "envMapIntensity": 1.0, "toneMapping": { "mode": "aces", "exposure": 1.0 }}Recap
New functionality
- Set an equirectangular HDR as the scene's skybox
- Saw chrome / glossy / brushed spheres lit and reflecting it
New concepts & skills
- environment.skybox β RGBELoader/TextureLoader β PMREM β scene.background + scene.environment
- the same map is both the visible sky and the image-based lighting (no explicit lights)
- roughness blurs the reflection (PMREM mip levels); envMapIntensity + toneMapping tune the look
Next lesson β Materials (manual)
On Your Own!
Extend what you built:
- Swap in your own equirectangular HDR (any 2:1 panorama) and reload
- Lower envMapIntensity to 0.3 β the spheres go dim; raise it for punchier reflections
- Change a sphere's roughness and watch the reflection sharpen or blur