Overview
Image-based lighting (IBL) lights a scene from a captured environment rather than from individual lamps, so surfaces pick up colour and soft illumination from everything around them. It used to be associated only with physically based materials, but recent Three.js versions let the classic MeshLambertMaterial and MeshPhongMaterial use scene.environment too. This demo compares them side by side under a live environment probe.
How it works
A CubeCamera continuously captures the surroundings, including rotating coloured emitters, into a cube render target, which is assigned to scene.environment. Every material that supports environment lighting then samples it:
- Lambert uses the environment for diffuse lighting only. The surface takes on the average colour of the light around it, tinting gently as the emitters rotate.
- Phong adds a specular reflection of the environment, controlled by its shininess, so you see coloured highlights moving across the surface in addition to the diffuse tint.
A GUI slider sets the environment intensity for both materials equally, so the comparison stays fair. Because the emitters move, the probe updates every frame and the effect of IBL is obvious; with a static HDRI the lighting would be just as rich but unchanging.
Exploring the demo
Watch the colours sweep across both objects as the emitters rotate. The Lambert object changes tint softly and evenly; the Phong object also shows sharper coloured reflections. Turn the intensity to zero to see how dull both materials look with only direct lights, then raise it to see how much IBL contributes.
Practical advice
Lambert and Phong are cheaper than MeshStandardMaterial, so this is a useful option for large numbers of objects or lower-end devices that still need to sit naturally in an environment. For realistic scenes, prefer prefiltered HDRIs processed with PMREMGenerator. See the materials gallery for a lights-only comparison, environment maps for reflective PBR materials, and light probes for localised environment capture.