Overview
Soap bubbles, oil on water, beetle shells and heat-tinted titanium all shimmer with colours that change as you move. The colour does not come from pigment but from thin-film interference: light reflecting off the top and bottom of a very thin layer interferes with itself. MeshPhysicalMaterial simulates this with its iridescence parameters, and this lab shows them on four spheres viewed from different angles at once.
How it works
When light hits a film a few hundred nanometres thick, part of it reflects off the top surface and part off the bottom. The two reflections travel slightly different distances, so for some wavelengths they reinforce each other and for others they cancel out. Which wavelengths survive depends on the film's thickness, its refractive index and the viewing angle, so the colour shifts as the angle changes.
Three.js exposes three controls:
iridescence(0–1) blends the effect in.iridescenceIORis the refractive index of the film, which affects how strongly colours separate.iridescenceThicknessRangegives the minimum and maximum film thickness in nanometres; an optionaliridescenceThicknessMapvaries it across the surface.
The demo's presets set realistic combinations: soap bubble (very thin water film), titanium oxide, oil slick and coated glass. Four synchronised spheres show different angles simultaneously, so you can compare colours without moving the camera.
Exploring the demo
Pick a preset, then sweep the thickness range and watch the palette cycle through the spectrum. Compare the centre of each sphere (viewed head-on) with its rim (viewed at a grazing angle): the hues differ, which is the defining trait of iridescence. Raise the IOR to make the colour separation more intense.
Practical advice
Iridescence works best combined with low roughness and a good environment map, since the effect lives in reflections. It is subtle on matte surfaces and on mobile screens, so check it on target devices. See layered coatings in clearcoat and anisotropy, try parameters interactively in the material editor, and compare with the stylised effect in the hologram shader.