Iridescence Thin-Film Materials (r183 roadmap)

Interactive `MeshPhysicalMaterial` lab that showcases angle-dependent thin-film color shifts with iridescence IOR and thickness controls.

Key topics: three.js iridescence, thin film, meshphysicalmaterial, pbr shading, r183

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.
  • iridescenceIOR is the refractive index of the film, which affects how strongly colours separate.
  • iridescenceThicknessRange gives the minimum and maximum film thickness in nanometres; an optional iridescenceThicknessMap varies 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.

What this code does

- Thin-Film Shading: demonstrates `MeshPhysicalMaterial.iridescence` for angle-dependent spectral color response.
- IOR Controls: `iridescenceIOR` tuning changes how strongly hues separate across view angles.
- Thickness Range: nanometer-scale `iridescenceThicknessRange` values shift the visible interference palette.
- Preset Workflow: includes practical looks (soap bubble, titanium oxide, oil slick, coated glass) for fast exploration.
- Multi-Angle Layout: four synchronized spheres make view-angle differences clear without constant camera movement.
- Production Relevance: useful for coatings, films, and stylized materials requiring controlled interference highlights.

Continue Learning

JavaScript Implementation

ES6+
import * as THREE from 'three'

const film = new THREE.MeshPhysicalMaterial({
  color: 0xffffff,
  iridescence: 1,
  iridescenceIOR: 1.45,
  iridescenceThicknessRange: [120, 900],
  roughness: 0.2,
  metalness: 0.25
})

scene.environment = envMap
scene.add(new THREE.Mesh(new THREE.SphereGeometry(1, 64, 64), film))

Related demos

Trending this week

Most popular