IES-Like Lights in Cycles / Architectural Lighting

This is so cool. An additional angular dependence can also be done this way. As far as I can tell though this is not enough to represent IES data as that represents a 2-dimensional angular array whereas this technique represents a number of 1-dimensional angular arrays. I’d love to be wrong about that though.


I thought about that too, you’d need a spherical parametrization for the general non-symmetrical case. The reason i only did the rotational symmetric case was because it’s simple to start out with and covers most basic uses. I don’t think yours will work for general rotations, you’d need one stable tangent vectors, i wish we could access local coordinate system axis directly… using your idea, i tried to generate a mapping so we can use an image texture. Mostly succeessfull, but there’s still a kink with rotation i can’t figure out why it’s behaving the way it does… well, i’ll fix that another time.




Demo File
http://pasteall.org/blend/16035

Another thing that might be usefull is to not have mirroring, depending on the use case, think irregular lights that are rotation-symmetric in 360°/n steps

You don’t need a special build for this :wink:

i think he meant a build for storm_st’s work. anyway look on graphicall.org for builds (volumetrics/cyclone i think those were named?), or get the last patch he posted on the mailinglists and build it yourself.

Thanks. Now i see it. I might give it a try to compile it… doesn’t seem to be on graphicall yet…

@gexwing
That looks sweet. The last image is especially cool.

In terms of replicating ies data I think I’ve found a way. Interestingly a point lamp will accept an environment texture, which in 2.63 can be an HDR image. As it’s a point lamp the incoming light angle refers to the correct pixel of the image. The catch is that an HDR image has to be generated for a particular IES file, but I’ve written a little script to do that. Radiance http://radsite.lbl.gov/radiance/ must be installed (windows/Mac/Linux binaries and library files are available from http://openstudio.nrel.gov/getting-started-developer/getting-started-radiance), the binaries oconv, rpict, ies2rad, pvalue and rcalc must be in the system path and the file source.cal must be in the library path. The script, which should be made executable, is run from the command line after navigating to the folder that contains the ies files you want to convert, which should have the extension .ies or .iES.
The script is


#!/usr/bin/python

import subprocess, glob
spheregeo = open('sphere.rad', "w")
spheremat = open('sphere.mat', "w")
spheregeo.write("sphere_plastic bubble ball
     0
     0
     4  0 0 0 1")
spheremat.write("void plastic sphere_plastic
     0
     0
     5  1 1 1 0 0.5")
spheregeo.close()
spheremat.close()

filelistIES = glob.glob('*.IES')
filelisties = glob.glob('*.ies')
filelist = filelisties+filelistIES

for file in filelist:
    filebase = file.split(".")[-2]
    subprocess.call("ies2rad -i 0.001 -t default -o "+filebase+" "+file, shell=True)
    subprocess.call("oconv sphere.mat sphere.rad "+filebase+".rad > "+filebase+".oct", shell = True)
    subprocess.call("rpict -ab 0 -vta -vp 0.0 0 0 -vd 0 0 -1 -vu 0 1 0 -vh 360 -vv 360 -x 500 -y 500 "+filebase+".oct | pvalue -d -h -H | rcalc -e '$1=3.149*$1;$2=3.149*$2;$3=3.149*$3' | pvalue -r -H -h -d -y 500 +x 500 > "+filebase+".hdr", shell=True)

This script will probably not work in windows as is, replacing double quotes with single quotes and vice versa in the long subprocess line may do it.
In cycles the resultant HDR images are loaded into the environment texture node with a mirrorball projection. The only catch is that as the light is a point source, and it’s normal never changes, so any rotation of the lamp has to be replicated within the vector mapping node. The mapping I have in the image below points the light in the negative z direction. Ignore the vector normal node. I don’t think object rotation can be included in a node yet but if it can then in theory the mapping can make the texture align with the lamp’s rotation automatically.
But hacky and a bit complex but basically we have ies lighting in cycles now. In the image below the bottom left image is the orginal ies as rendered by Radiance and the cycles version bottom right. Enjoy


could you share some those converted hdr files for testing purposes? i’m working on the next version with general spherical coordinates, could be handy to have some real ies files instead of my gimp’ed ones :stuck_out_tongue:

Here are a few ies files with the attendant hdr.
ALP200311_H.hdr.zip (499 KB)

i think i finaly got it working correctly with spherical parametrization :slight_smile:




Demo File
http://www.pasteall.org/blend/16055

i included some more general node groups (orthogonal coordinate transform, spherical->cartesian, cartesian->spherical, atan2), so that it’s a bit more readable, became quite chaotic without those…

i realy would like to see the voronoi one rendered with volumetrics :smiley:

If we could distort the voronoi texture we could fake a nice underwater caustic effect, really useful and super fast for underwater scenes.

Sadly there are no parameters to distort Voronoi.

fun to map an environment map to a point light, mapped “incoming”. it’s sort of like a spherical projector bringing a world into a box.

f’ing bloody well done gexwing.

@Qha. Ha, yes that’s pretty neat.

One thing I’ve noticed with this node arrangement though is that when switching to gpu rendering only a quarter of the texture gets rendered.


Me too, same problem.

i have no idea what could cause that, haven’t got an nvidia gpu to test with. you could try “probing” different things inbetween the nodes to see if they look what they’re supposed to, that could help narrowing down the problem.

rareg, marcoG_ita if I unpack the textures it work here with GPU.

Cheers, mib.
@gexwing, cool work, THX.

I’m loading up the textures from my hard disk so I think they are unpacked. I’m running linux64bit 2.63 (stock and trunk). I’ve traced the quarter pattern back to the dot product that creates tangent 1 in co-ordinate transform. Can’t see that pattern generated by anything before that.

I am sorry, after a second test I get the same results with GPU.
No clue what was wrong on my side.

Cheers, mib.

@rareg, mib2berlin, marcoG_ita

did you figure out what’s wrong with the gpu rendering now?

Hi gexwing, no, may I pester one of the cycles devs for this. :slight_smile:
The file is to complex for a bug report.
It only happen with ies 2d3.blend, the other two files are working on GPU.

Cheers, mib.

EDIT: I spoke with dingto and he mention to file a bug report.
If you like I can do.