Using complex ior files and making your own.

I have no background in physics or maths, so, what follow is just what I gathered from various sources. Please, tell me if you spot any mistake.

Why bothering using them?

You can get very nice effects with metals and dielectric using them. Be careful though, complex iors material use dispersion (that’s the point, especially for dielectrics), so, render cost may be high. For colored dielectrics, you can get very nice falloff, and since you can make ior files from ultra precise lab measurements, ior files are an easy way to get very realistic materials. In some cases, it’s easier to use an ior file than too find right transmittance color and attenuation value. Gemstone rendering is the most obvious application of complex iors.

What are they?

Complex ior files store optical properties of materials at different wavelengths. I won’t go into details about the physics behind the concept. A complex refraction index is a complex number where the real part (generally noted n) is the refractive index, and the imaginary part (often noted k) is the extinction coefficient measuring the absorption of the light going trough the material. For our purpose, it’s ok to treat n and k as two independent real numbers.
A Maxwell ior file stores a set of n/k values over a range of evenly spaced wavelengths.
The structure of the file is very simple: it’s a plain ASCII text file with a first line consisting of 4 numbers giving respectively the unit used to indicate the wavelength, energy of frequency, the value of the wavelength, energy of frequency for the first line of the dataset, the value for the last line, and the number of intervals. All subsequent lines are n/k pairs of numbers. The number of n/k pairs is equal to number of intervals + 1.
All values are separated by spaces (any number). Decimal separator is dot. Comma is not allowed.
Example of first line:
4 380 730 69.
In this example, 4 means dataset is in nanometers (1 is eV, 2 is um, 3 is cm-1, 4 is nm), beginning at 380 nm (limit UV/VIS) ending at 730 nm (limit VIS/IR), with 69 intervals (i.e. a measure every 5 nm).

a useful reference before we go further:


How to make complex ior files?

First case, making an ior file from a n/k dataset.
In a few instances, you can find complex ior data. If the dataset spans over the visible spectrum, and if there are enough points to do a decent interpolation, then it's fairly easy to get an ior file. All you need is a math program to perform some interpolation, and your favorite spreadsheet.

Here is the step by step with the Findgraph software (30 day fully functional free demo, 50 Euro licence with VAT: http://www.findgraph.com/ ).

Step 1, getting the data:
For this example, let's have a look at a dataset coming with the Freesnell Software ( http://swiss.csail.mit.edu/~jaffer/FreeSnell/ ). It uses a file format slightly different from the Sopra database, but it's very easy to convert. Unzip the freesnell program and look at the zn-a.nk file (zinc, parallel to C axis: in this instance, perpendicular to C is almost identical).
Rename the file as zn-a.txt.

Step2, getting the data into Findgraph:
Chose: data, add from file, and open zn-a.txt.


You get this window:


As you can see, findgraph correctly interpret the ASCII dataset. The X axis will represent the energy level (in eV), and Y the n part of the complex ior. Z won't be used for now. Chose “fit to data” for both X and Y axis


Step3, interpolating
Right click on your newly created point set in the left part of the interface, and chose interpolate.


In this instance, as there are not so many points, bezier interpolation gives good results. When you are done, right click on the interpolation, and chose trace>tabulate.


We are interested in visible light, so, we'll interpolate from 1.6 to 3 eV, by 0.02 eV steps.
Click on calculate, then copy/paste to your favorite spreadsheet.

Do it all over again for the k values

Step 4, creating the ior file.

Just open notepad.
As here the unit is eV, from 1.6 to 3, with 69 intervals,
type the first line:
1 1.6 3 69
Then, just copy/paste the n/k values from the spreasheet.

Save as zinc.ior,
You're done!

Many more here: http://www.luxpop.com/RefractiveIndexList.html

To be continued....
User avatar
By hdesbois
Texturing with a spreadsheet part 2: transparent colored materials

Now comes the fun part: to make ior files for colored transparent materials, you don't really need complete n/k data. Mere absorbance data can do the trick nicely, and the good news is that they are much more easy to get than full complex ior datas.
Here is the general idea: colored transparent materials do absorb a good part of the light spectrum, so, they are very unlikely to show any dispersion. You can get very good results by just making files where you derive the values for k from absorbance data, and kind of guessing plausible values for the n part. Even a constant n value throughout the spectrum will look ok, though we'll see how you can come closer to physical accurateness with little effort.

The first thing you need to do to get good looking material is to make a test scene at the right scale. Indeed, except for materials that have zero absorbance values at some wavelengths, this type of material is very sensitive to the scale. A too big object will more or less render at solid black (you can see this in real life with large gemstones which tend to be much darker than small ones).

...to be continued...
By Toxie
could u post ur resultimg file for zinc to compare with the one we obten from ur tutorial?

My one is:

1 1.6 3 69
1.6 1.087
1.62 1.099
1.64 1.109
1.66 1.118
1.68 1.126
1.7 1.133
1.72 1.138
1.74 1.14
1.76 1.138
1.78 1.122
1.8 0.965
1.82 1.443
1.84 1.848
1.86 1.972
1.88 1.666
1.9 1.179
1.92 0.7886
1.94 1.144
1.96 1.167
1.98 1.181
2 1.189
2.02 1.196
2.04 1.201
2.06 1.206
2.08 1.209
2.1 1.213
2.12 1.215
2.14 1.218
2.16 1.219
2.18 1.221
2.2 1.223
2.22 1.224
2.24 1.225
2.26 1.226
2.28 1.226
2.3 1.227
2.32 1.228
2.34 1.228
2.36 1.228
2.38 1.229
2.4 1.229
2.42 1.229
2.44 1.229
2.46 1.229
2.48 1.229
2.5 1.229
2.52 1.229
2.54 1.229
2.56 1.229
2.58 1.228
2.6 1.228
2.62 1.228
2.64 1.228
2.66 1.228
2.68 1.228
2.7 1.228
2.72 1.229
2.74 1.229
2.76 1.23
2.78 1.23
2.8 1.231
2.82 1.232
2.84 1.234
2.86 1.236
2.88 1.24
2.9 1.244
2.92 1.248
2.94 1.253
2.96 1.521
2.98 1.808
By Toxie
Doesnt match with ur ones... but i followed ur tutorial. What did I do wrong?
User avatar
By hdesbois
obviously, your first column is the enegy values in eV, whereas it should be the values for n (refractive index, real part): these values are in the Y column in findgraph. your second column, I have no clue. Normaly, you do the whole thing all over again just changing the Y axis input from column 2 to column 3 in the step 2. I didn't detailed the spreadsheet part, but I will if you have more trouble.
Hope this helps,
By Toxie
that will b great, im still being quite lost...;)
User avatar
By ivox3
Henri, .... really appreciate you putting this together.

It's getting printed and then read and read and read. :lol:

Determined to get this IOR thing down ...... ;)
User avatar
By ivox3
User avatar
By Bubbaloo
Ok, instead of trying and failing miserably at creating my own ior's, I am going to ask if anyone has any good gemstone ior's that aren't in the standard list. Thanks so much!
User avatar
By w i l l
On a bit of a 'trying to understand Physics' tip today. Can I ask.... why are there only IOR files for dielectrics and metals? From reading this.. 'A complex refraction index is a complex number where the real part (generally noted n) is the refractive index, and the imaginary part (often noted k) is the extinction coefficient measuring the absorption of the light going through the material' I would assume that IOR files are used for transparent/translucent materials because of the k value... but why are they used for metals and not plastics for example (obviously metals aren't transparent so I don't understand where the 'k' comes from here)

Anyway I found this software. It can be used to convert complex IOR data to simple IOR which would maybe speed up render time.


Found it from this link (although I dont know if its useful for Maxwell):


Hello! We have just released a new version of the[…]

Hello Achim, Re-reading what I wrote, I think pa[…]

Well, they tell me it's a slow issue because it in[…]

Change Grass materials

Nope :wink: