- Tue Jul 25, 2006 5:52 pm
#173524
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....
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....
LW 9.2 Win XP pro amd64x2 2.2 ghz 4gb ramThe journey's FAR from over