This project is heavily based on the original publication "Parsing The IESNA LM-63 Photometric Data File" and its accompanying source code, which can be found here.
To render an IES document to an HTML canvas using this library:
import * as IESNA from "iesna";
IESNA.renderToCanvas({
iesData: IESNA.parse("IES document goes here"),
canvas: document.getElementsByTagName("canvas")[0],
});
In addition to IESNA.renderToCanvas()
, light sampling can be done using
IESNA.sample()
. This function takes an IES data object and an x,y,z coordinate
in light space and returns the light intensity at that position.
const iesData = IESNA.parse("IES document goes here");
const intensity = IESNA.sample({ iesData, x, y, z });
There is a demo of rendering IES documents in the browser available here.
To run it locally: npm install && npm run dev
.