### Sidebar

This page exists within the Old ArtZone Wiki section of this site. Read the information presented on the linked page to better understand the significance of this fact.

# Working with Refraction Index

Author: Robin Wood

## Introduction

Most 3D graphics applications have a place to specify Refraction Index. But what is Refraction Index, anyway? Why is it important? And how do you know what numbers should go into that field, anyway?

## Step 1 - Bending the Light

Light travels through different substances at different speeds. Generally speaking, the denser the substance, the slower light moves. When light enters a substance at an angle, this change in velocity causes the ray to be deflected, or bent.

This bending is called Refraction. The amount that the substance bends light is its Refraction (or Refractive) Index or RI. (It's determined by using Snell's Law; that is, the sine of the Angle of Incidence (the angle at which light enters) over the sine of the Angle of Refraction (the angle it's bent to) equals the RI of the substance.)

Because the Refractive Index for a given substance at a given temperature and pressure is a constant, Refractive Indices are used in the real world to determine everything from the percentage of water in a sample of honey to the composition and purity of gemstones.

In our Virtual World, we use Refractive Indices to enhance the reality of our renders.

## Step 2 - Refractive Indices

Refractive Indices for many substances are available on the web. (I've posted some of them myself. http://www.robinwood.com/Catalog/Technical/Gen3DTuts/Gen3DPages/RefractionIndexList.html ) You can just look them up, and plug them in.

Different programs employ them in different places; but most will allow you to put that number in somewhere. For instance, in Bryce you have to multiply the RI by 100, and then put the answer into the Refraction slot in the Materials Lab. For Lightwave, you open the Surface Editor, and type the number into the Refraction Index field in the Basic tab. In Cinema 4D, you open the Material Editor, check the Transparency box to activate the Transparency Dialog, and enter the RI into the Refraction field labeled n. Other programs use other methods.

## Step 3 - Getting it Right

Knowing the correct Refractive Index adds realism to your renderings. For instance, one of these glasses has virtual water in it, and one has an 80% sugar solution. You can probably guess correctly which is water. Even though you may not know the RI of water, you've learned what looks “right” from a lifetime of experience.

For a lot of liquids, you can guess “close enough” to the correct RI by using something similar. For instance, if you know that the RI of water is 1.333 and the RI of an 80% sugar solution is 1.49, you could guess that the RI of a glass of Sweet Tea would be somewhere in between. And you'd be right. The higher you made the RI, the sweeter the tea would be.

If that's not good enough for you, you can't find the RI of the liquid you want on the web somewhere, and you like science experiments, you can figure it out for yourself. (You can just buy a refractometer, too; but the ones that will measure Index of Refraction (nD) aren't cheap. (The less expensive ones measure Brix, and you would have to convert it.))

## Step 4 - Critical Angles

When rendering gemstones, there is more to it than that, because the “life” in a cut stone is dependent on the angle of the cuts and the Refractive Index of the stone.

If the angles of the facets are too low, light escapes before it reflects from the inside cuts. If they are too high, light bounces out of the sides of the stone, and you don't see the reflection.

The angle at which light can escape is called the “critical angle.” (Critical Angle = sin-1 (1/RI) where RI is the Refractive Index of the stone.)

For maximum sparkle, the angles of the stone need to be between the Critical Angle and the Angle of Reflection. If you do that math, you will see that the larger the RI, the larger the window you have between these two angles.

## Step 5 - Bow Ties and Fish Eyes...

So, if you'really want to use a certain shape or cut of gem, and you find that you have “bow ties” (dark facets) or “fish eyes” (places in the center of the jewel where there are no reflections, ) a quick fix is to increase the RI. I know, it's not accurate; but sometimes it makes sense to sacrifice accuracy for esthetics.

(This model comes from 3Dlapidary, by the way.)

The model above is Quartz and has RI 1.544

The one below is Crystal and has RI 2.00

## Step 6 - Minimum RI Needed...

You can figure out the minimum RI needed for a particular model by measuring the most accute angle in the pavilion (the bottom of the stone.) Assume that's the critical angle.

The Refraction Index will be 1 divided by the sine of that angle. So, pull out your Scientific Calculator, make sure you are working in degrees not radians, enter the angle, and tap the sin button. Enter that number into memory, clear, enter 1, hit the division key, recall the memory, and tap the equals button. That's the lowest RI that will give you life in that stone. Setting the RI in the program just a hair higher should assure success.

## Step 7 - Other Applications...

The other place where I use Refractive Index in modeling is to determine the Glancing Angle of the Fast Fresnel Shader in Lightwave. The “glancing angle” is the angle from the camera where the fresnel effects (an increase in reflection and decrease in transparency) begin to take effect; so you can use this anywhere in your favorite program where you have a similar control.

For the most realistic effect, this should be set to the Brewster Angle for the material. (When light hits a surface at a particular angle, the reflected rays all have the same polarization. That's the Brewster Angle, and it varies depending on the RI of the surface. If you want to know what all that means, you can learn more here. Read the whole page to get a handle on polarization before you get to the Brewster Angle at the bottom.

Without going into a lot of math, the Brewster Angle for a material in air is just about the ArcTan of the Refraction Index. So, to figure it out, just use your Scientific Calculator, make sure you are working in degrees, enter the RI, and tap the ArcTan (tan -1) button.

As you can see from the Glass Fish, Fresnel Effects add a great deal to the realism, and Fake Fresnel using the Brewster Angle yields the same results as the Real Fresnel (calculated directly from the RI) but with the added benefit of more control over things like highlights. (the top fish has No Fresnel Effects, the one in the middle has Lightwave Real Fresnel, and the one just below has Lightwave Fast Fresnel

(Thanks, Arnie Cachelin, for pointing this out.)

By the way, if you ever wondered how they calculate the RI for things like gold, (which no light is going to penetrate) - they use the Brewster Angle!

And that's it! I hope you enjoyed this tutorial, and that it helps you render better stuff, in less time. Have Fun!