November 5, 2014 4 Comments
During my investigation on supporting IES lights for the Frostbite engine (With the help of Rodney Huff!) I have met several hurdles. The IES format is rather badly specified and when implementing a parser, many questions come without answer (And handling the different sysmetry is insane). This post is about helping people to find their way to support IES lights in their engine. And I will say that it is preferable to support EULUMDAT format, but sadly there is less resource on the web.
There is few references about implementing photometric lights for real-time on the web. I already write several information about photometric lights, for both IES and EULUMDAT format,in the Siggraph 2014 PBR course notes of the talk Moving Frostbite to PBR. So I will not rewrite them here. Please refer to section 4.5 of the course notes. Here is some useful links:
IES and EULUMDAT viewer: http://www.photometricviewer.com/
IES unofficial specification : http://lumen.iee.put.poznan.pl/kw/iesna.txt
EULUMDAT unofficial file format: http://www.helios32.com/Eulumdat.htm
The iesna.txt document speaking about the IES format is written by Ian Ashdown who is a member of the IES Computer Committee responsible for LM-63-02, and he also maintain the EULUMDAT file format specification on the Web. His website www.helios32.com contain the latest information about these formats (http://www.helios32.com/resources.htm#Formats).
There use to have companion files with code for the iesna.txt document. But it is no more accessible. I get the permission from Ian Ashdown to host them here, and this is the only purpose of this blog post. The files below contain the IES parser with the C source code and some example files mention in the iesna.txt document (WordPress doesn’t handle zip file, so right-click then save target. Then rename extension to “.zip”) :
And here is some advice from Ian Ashdown:
The code was last updated in 1998. The code is still used in Ian Ashdown commercial products, so he cannot release the latest version. However, here is the (edited) change log for IES_READ.C reads:
// 98/09/12 – Fixed vertical axis symmetry determination error in ReadFile.
// 99/05/21 – Modified ReadFile to initialize horz_dist data member for luminaires with vertical axis rotational symmetry and to initialize vsymm_flag data member.
// 99/06/04 – Modified GetLine to check for buffer overflow.
// 99/08/15 – Modified ReadFile to call strncmp rather than strcmp to support lines with trailing whitespace.
// 01/08/07 – Modified ReadFile to initialize lum_dim data structure.
// 02/04/26 – Modified ReadFile to accept LM-63-2002 format files.
// 05/03/21 – Modified ReadFile to flush photometric data if error.
IESNA Type A and Type B photometric data files van be ignored – He have never encountered them in 20 years of architectural and roadway lighting work.
LM-63 specifies a maximum of 132 characters (inherited from the days of IBM Hollerith punch cards), but he have seen LM-63 files with up to 4,000 characters per line in the candela fields.
And lastly if you are generating a photometric web from the data for ray tracing or radiosity, you should interpolate the horizontal angles using a cubic spline curve (open or closed depending on whether the full 360 range of horizontal angles is specified).