IES Lamps to Cycles


(Lockal) #1

***Link to the addon for 2.66 trunk builds (new nodetrees):
https://gist.github.com/AngryLoki/4364512/raw/ies2cycles.py


24.06.2013. Changes in version 0.8:

  • Use pythonless drivers to match the new security policy in recent blender builds.

Changes in version 0.7:

  • Added “Generate Rig” feature, which allows to change angle by means of rig object, instead of struggling with Mapping Node. Rig Object scale also works as Intensity multiplier.
  • Added Lamp Properties panel for rigs, which allows to change emission color and strength multiplier.
  • Meshes for rigs depend on light distribution, so debug became much easier. Version 0.7 includes many changes in angle calculations and symmetrical lamps.
  • Added Color Temperature presets



IES files contain information about the light distribution of a lighting fixture. These files are typically provided by lighting fixture manufacturers. This addon converts IES data into greyscale PNG or EXR. From LuxRender wiki:

The main use of IES is measuring real world lamp models, many manufacturers sites offer their IES library for free. Generic IES can also be made with applications like “IES Generator”. Since IES profiles can be applied to meshlights and arealights, they can be used to control the light spread angle, much like a spotlight cone. Arealights with the IES profile of a spot will illuminate like a spot but will have a physical size. This will make them easier to balance in intensity with other physical lights. However, to have the physical intensity of a specific ies scaled correctly the ies must be used with pointlights (mesh and planes will still make the correct ‘shape’ , but the intensity will be altered by their power, efficiency and size)

After installation of this addon new item “IES To Cycles” appears inside “File” -> “Import” menu (also don’t forget about space menu). After selecting any *.ies file new “Save as…” dialog appears, which allows user to save generated image (unfortunately packed images are not supported by cycles). After that the addon creates a new pointlamp and generates a huge nodetree and rig for this lamp. There are number of settings at this moment:


Different *.ies lamps use different scale for luminosity data, so strength could be adjusted either here or later in nodetree. By default images are exported in PNG format, but EXR is also available for float data (up to 5 textures in cycles). There is no visible difference between PNG and EXR though.

This is a collection from a few lighting vendors. Most of them are for outdoor lighting. While these are mostly direct links to the IES downloads, it’s probably a good idea to look at the lamp they are representing first so you know what result to expect.

I tested only few of them (like IES files from above which came from http://www.mrcad.com/download-free-ies-lights/), so there could be some bugs in the addon. Feel free to report about them and suggest new features in this thread.


(NinthJake) #2

Seems very useful but the link to the download page doesn’t work.


(Lockal) #3

Oops, one extra character got in link. Fixed now!


(Lell) #4

Wow! Really interesting! I tried and works! I’m just curious to understand what the png image generated rappresents, and if it’s dimension influences quality of the result. It could be interesting if one could draw particoular png to create strange effects or tweak the light result.


(Lockal) #5

Added new option.
http://i.imgur.com/EO0Nq.png
http://i.imgur.com/Z4tRz.png


(Lell) #6

How do you know what color has at a certain temperature? Could you make an osl node or a normal node combination to output color based on temperature?


(Ray Tracer) #7

Great work Lockal, I really appreciate it!


(tmaes) #8

wow! great work, does it strongly affect rendertimes?


(Lockal) #9

New version with new Vector Curves support! No need to create images anymore, but this option is available only for builds from trunk (Vector Curves node was added 13 days ago). If IES has horizontal angles data, mean value is used, which suits for the most of lamps in real life. Now it generates rather simple nodetree for any lamp:

Also this version generates better node setup for Nx1 images, -10 nodes for each lamp.

tmaes, the great thing is that there is no big difference between a regular point lamp and an imported ies lamp, especially with vector curves!


(Ray Tracer) #10

Now this is a big Christmas gift!


(gexwing) #11

Just playing around with it, realy easy to use, big +1 from my side. One thing i noticed is when using the exr/png ones that on some angles it seems a bit too dark. Maybe i’m only imagining it though :wink: I realy hope this ends up being included in blender for all the archviz people.


(Sanne) #12

Awesome, thank you!


(Ray Tracer) #13

I think it will definitely be included soon!
It also deserves a post on Blendernation asap…


(bashi) #14

nice Script. thanks

The Revision Check on Line 421 doesn’t work with Revision Numbers with M at the End…

File "/Volumes/MacintoshBig/DATA/Users/bashi/Library/Application Support/Blender/2.65/scripts/addons/ies2cycles.py", line 421, in <module>    if int(bpy.app.build_revision) > 52886:
ValueError: invalid literal for int() with base 10: '53328M'

The Kelvin Color conversion is awesome… Where did you get this from? Have you any links to the source, or how it works?
(I wish Kelvin would be implemented in Blender Color, like RGB, HSV…)


(Lell) #15

Of course this node setup is better, but with this version there a workflow problem. With the previous version you could load a different png to change the light shape. With this you have to import the ies again, and that creates another lamp and then put the new lamp data to the old lamp data. So this procedure is longer than changing the png texture. So I ask if it is possible to have the ies source in the node setup, to change it for the same lamp.


(Lell) #16

Ah, so how could I mix the simplier node setup of this version with the png input of the first version?

Thanks!


(Lockal) #17

Lell, not everything is so easy: let’s look at the node tree:


This is how typical 1D image looks like. If you connect the generated node group to shadeless sphere (12, 13, 14) and set Strength to 1, you could see how it works. Node 1, 2, 3 are the common way to map 1d-texture to the sphere. And there starts the difference. Blender Internal render has Image Mapping panel:
http://pix.toile-libre.org/upload/original/1356635594.png
Cycles does not have any of these settings, it always repeats the image. And it blends the rightmost and the leftmost pixels which is definitely visible with low-res textures. To bypass this limitation, the generated image contains 2 extra columns of pixels, which are used to prevent blending. Nodes 4, 5 are used for scaling uv-map [formula: (u + 1/(width-2)) * (width-2)/width], so those 2 generated columns of pixels won’t show. With vector curves there is no need to do this.

As I said, Cycles always repeat textures, but 18 should remain black, and that is why 8 and 10 exist. With vector curves there is no need to do this.

With 2D images there are 9 more generated nodes, 7 of them are used to simulate atan2 function, which cycles does not support. New math operations like atan2 or hypot or ceil/floor could be easily added to cycles, even I could do this. My worst fear is that such operations were not added yet only because of GPU limits. Need to ask Brecht about this.


(Lell) #18

Ok, too much math for me here! :smiley: So I’ll use the first version if I prefer png interchangebility, or the second if I made a new light with new ies!

And what about light colors? Is it possible to have something available for all lights?

Thank you very much anyway! You made possible something really useful!


(Lockal) #19

Wait, there is no need to use older versions of this addon. Vector Curves is just an option, you can switch it back to PNG in the bottom left corner before selecting ies file (see post #5). To insert the same lamp multiple times in the same scene it is better to use data linking instead of generating new nodes each time.

And by light colors you mean Temperature to RGB node? This one is at the top ofCycles ToDo.


(Ray Tracer) #20

Lockal, I wonder if there is a way to visualize the photometric shape in the viewport, instead of the classic point lamp symbol.
This would be especially useful for asimmetric lamps, as would enable the user to correctly rotate the lamp without the need to render the scene.