Three.js IES Light Profiles (Photometric Lighting)
Photometric lighting in Three.js from IES LM-63 profiles, using an included parser, candela lookups per vertical angle in a custom shader, photometric web visualizations, four fixture types and loading of your own .ies files.
Key topics: three.js ies, photometric lighting, lm-63, light profile, architectural lighting, candela
Game Over
What this code does
- IES Files: LM-63 text lists vertical and horizontal angles and a candela table measured from a real luminaire.
- Parsing: the demo reads counts, angles and candela after TILT=NONE, averaging horizontal planes into an axially symmetric profile.
- Lookup: candela by angle (0–180°) is stored in a float texture, and the shader reads it from the angle to the fixture's nadir.
- Patterns: narrow downlights, wall washers, batwings and haloed spots throw their characteristic scallops on the wall.
- Photometric Web: each profile is revolved into a wire "web" so you can see its intensity distribution.
- Controls: IES on/off (plain cones for comparison), intensity, warmth, webs, per-fixture profile and loading your own .ies.
Related Demos
Continue Learning
JavaScript Implementation
// IES LM-63: after TILT=NONE come counts, then vertical angles, horizontal angles, candela table
function parseIES (text) {
const nums = text.slice(text.indexOf('\n', text.search(/TILT=/)) + 1).trim().split(/\s+/).map(Number)
const [, , multiplier, nV, nH] = nums
const vertical = nums.slice(13, 13 + nV)
const candela = nums.slice(13 + nV + nH, 13 + nV + nH + nV).map(c => c * multiplier) // first horizontal plane
return { vertical, candela }
}
// Upload candela(θ) as a 1D texture; in the fragment shader:
const glsl = `
float theta = degrees(acos(dot(-L, lightAxis))); // angle from the fixture's nadir
float cd = texture2D(uProfile, vec2(theta / 180.0, 0.5)).r;
color += albedo * cd * max(dot(n, L), 0.0) / distanceSquared;`