I have added a new script to my
osl_useful repo (GitHub, GitLab) which will take a lamp definition in IESNA LM-63 format and generate an OSL shader that implements the directional intensity function.
For example, here
is my rendition of the “Top Post” lamp from the Pixar collection.
I’ve been trying to match Cycles’ behaviour with the same IES files. So far they look close, except for a scaling factor I haven’t yet accounted for.
Going beyond Cycles, I have tried to implement the “tilt” behaviour which is found in some lamp definitions.
Interesting. How does it work with assymetric ies files, such as roadway lighting? Or files that represent up/down lights? (One advantage of the old add-on from 2.7 was the rig it generated, which showed the shape of the photometric curve.)
Like I said, I tried to follow the behaviour of the Cycles IES Texture Node closely. This includes asymmetrical and up/down intensity distributions. If it doesn’t, just send me an example of a problem file.
I have added an option to interpret the IES file according to some encoding other than UTF-8. A couple of those Pixar ones seem to have ISO-8859-1 (or is it Windows-1252?) characters in them.
Of course, this is all completely contrary to the official spec, which says that only ASCII characters are allowed.
I tried a different approach, using an object with an emissive material instead of a lamp, and compared loading the same IES definition directly without OSL, versus putting it through my OSL generator. When done that way, the two look pretty much identical with the same strength setting.