The Index of Refraction, or Refractive Index, commonly known as IOR in the CG world, is a measure of how fast light rays travel through a given medium. Alternatively, it could be said that refractive index is the measure of the bending of a light ray when passing from one medium to another.
In simple words, the IOR dictates how much and in what way light will be reflected and absorbed/refracted when a ray comes in contact with a surface. As mentioned in the beginning of this article Non-Metals have a simple IOR while Metals have a complex IOR.
When we talk about IOR we mostly talk about the Fresnel Effect.
The Fresnel Effect, as observed by French physicist Augustin-Jean Fresnel, states that the amount of light reflected from a surface depends on the viewing angle at which it is perceived. Think of a pool of water. If you look straight down, perpendicular to the water surface, you can see down to the bottom. Viewing the water surface in this manner would be at zero degrees or normal incidence, normal being the surface normal. If you look at the pool of water at a grazing incidence, more parallel to the water surface, you will see that the specular reflections on the water surface become more intense and you may not be able to see below the surface of the water at all.
When viewing a surface at a grazing angle, all smoothed surfaces will become reflectors at nearly 100% at a 90-degree viewing angle. For rough surfaces, reflectance will become increasingly specular but will not approach 100% specular reflection. In other words - the rougher the surface, the less reflective it will become towards the 90-degree viewing angle. This phenomenon is directly related to the Microfacet Theory which is explained in detail in the Physically Based Rendering article.
F0 (Frensnel Zero) stands for Fresnel Reflectance at 0 Degrees. When light hits a surface straight on or perpendicularly (at a 0-degree angle), a percentage of that light is reflected as specular. Using the IOR for a surface, you can derive the amount that is reflected.
We are working with IOR values in VRay so it's good know how to convert IOR to F0 and vise-versa.
F0 to IOR Converter: (1+SQRT(REFLECTANCE))/(1-SQRT(REFLECTANCE))
Example: Plastic = (1+SQRT(0.04))/(1-SQRT(0.04)) = 1.50 IOR
IOR to F0 Converter: (((1-IOR)/(1+IOR))^2)*100
Example: Plastic = (((1-1.5)/(1+1.5))^2)*100 = 4% Reflectance
Common Non-Metals tend to have a F0 ranging between 2-5% or 1.3-1.6 IOR so the difference is hardly noticeable. Gemstones are the only exception as they go up to 17% or 2.4 IOR - this is the max range for Non-Metals. As a rule, any value above 1.8 IOR for non-metals (2.4 for Gemstones) will give unrealistic results.
The most common reflectance value is considered to be around 4% or 1.5 IOR - so if you don't know the F0 of a material just stick with 4%. Here are a few IOR values for common materials:
1.33 (2% reflectance) - Rough stone, Leather, Stucco/Plaster, Fabric, Mud, etc.
1.42 (3% reflectance) - Some leather, Polished stone, Some plastic
1.50 (4% reflectance) - Plastic (plastic can range between 2-5% reflectance or 1.3-1.6 IOR)
2.40 (17% reflectance) - Gemstones
It's common practice to put the metal color into "Reflection Color" slot of a material and then use some insane IOR value like 8-20+, but this will actually produce incorrect results. While Simple IOR has only a Refractive Index property = (n), Complex IOR is composed of Refractive index = (n) and Extinction coefficient = (k).
VRayMaterial can only handle Simple IOR and not Complex IOR. Furthermore, when Simple IOR is raised above 3, the reflection gets inverted . Instead of getting brighter/stronger at grazing angles, it will get darker/weaker.
This table shows how reflectance is handled by the IOR from 0 to 90-degrees. As you can see values above 3 IOR start to give incorrect results. That's why we need to simulate Complex IOR to get an accurate representation of Metals.
In order to get correct IOR for Metals in VRay (prior VRay Next where Metal/Rough workflow is also supported), there are two options - use Siger ComplexFresnel or a Custom Falloff Map. Sigers' plugin allows artists to input (n) and (k) values. The most common site to get (n) and (k) values is Refractive Index.
When using sites like Refractive Index, you have to input a wavelength value in µm. In order to do that, you have to convert Red, Green and Blue colours into wavelength µm values, input these values at the top of the site and then copy back the results in Sigers' plugin. Wavelengths for R, G and B are as follows: Red = 0.65µm; Green = 0.51µm; Blue = 0.475µm
These scanned materials are usually in perfect laboratory conditions and can sometimes have different color values than what you'd expect. Plugins like Sigers' let you change the color but keep the scanned IOR behavior. Here are some photo reference matched settings, courtesy of dubcat:
Sigers' plugin gives very good results, however sometimes we might need a bit more control. That's when we can substitute the plugin with a Custom Falloff Map. Benefits we get from this method:
It's easier to do colour adjustments of the metal.
We can plug a custom metal map with varying colour. This way we can produce richer and more complex metals.
The Custom Falloff isn't an exact match to Sigers' plugin but is close enough to give a plausible result. Here is a comparison:
In this case with gold the Custom Falloff and Sigers' Complex Fresnel almost match perfectly. Some other Metals like Iron have more apparent varying colour between the 0 and 90-degree viewing angle which is a bit harder to reproduce. Here are a few matched curves for reference and a basic Material Library to download and use in your scenes with both methods included.
It is important to note that both of these methods do their own Fresnel calculations and therefore Fresnel Reflections must be turned off.
Turning off Fresnel reflections brings us back to surface roughness. Remember that the rougher the surface (or the lower the Glossiness amount), the less reflective it will be towards the 90-degree viewing angle? In VRay this is done automatically when Glossy Fresnel is enabled. Glossy Fresnel should be turned on by default but when working with materials made in older VRay versions it might be turned off. In such cases, always make sure to check it and turn it on.
When we disable Fresnel Reflections in order to use complex IOR values for Metals, we actually disable Glossy Fresnel. Even if it appears to be turned on, it won't work. Even though the difference in most cases won't be noticeable and we can leave it as is, it's good to know how to fix it.
One way to do it is to gradually start blending the base metal colour with the Complex Fresnel/Custom Falloff when lowering the Glossiness amount. The progression isn't linear so here is a small cheat sheet:
Setting this up is quite easy in most cases, however, there might be more complicated scenarios where we have multi-coloured metal colour. Here are some examples:
Easiest way to do this with Complex Fresnel is using a Mix Map. You can sample the metal colour from the very top/bottom of the Complex Fresnel map. This setup is made for 0.85 Glossiness using 20% for the Mix Amount.
With Custom Falloff maps it's even easier - just plug the metal colour into both slots of the map and use the blend amount between front/back side. This setup is made for 0.85 Glossiness using 20% for the Blend Amount.
A bit more advanced example. Here we have a Glossiness map which varies between 0.5 and 08. We would like to take this into account in our IOR. First step is to remap the Glossiness maps' values between 0 and 1 to create an effective mask. We can then use this mask to create a Mix Amount map - we have to Mix the Amount values we need for 0.5 and 0.8 Glossiness which are respectively 78% and 30%. We can now plug this new map into the Mix Amount slot of our Custom Falloff / Base Colour mix. Et, voila, we are done. With less contrasty Glossiness maps this method might be a bit of an overkill.
Simple IOR maps are greyscale and can be created directly in VRay. We can use them for blending the properties of two different surfaces into one single material or making certain details in the material more/less reflective. An example for an example for mixing surfaces would be painted plastic/wood. Painted Metals can be done as well, however when mixing Metals with Non-Metals it is advisable to use VRayBlendMtl and blend the two materials. So keep in mind to use this workflow only for Non-Metals.
IOR maps can go either into the IOR map slot or into the Fresnel IOR map slot. The first one works only with floating point numbers above one - to use it we can for example make VRay Color map and input 1.5 as a value in the R, G and B channels. This will give us an IOR of 1.5.
The Fresnel IOR map slot works with both floating point numbers above and below 1 where 1 is equal to 0 IOR. That's why it's easier to work with the Fresnel IOR slot as we can also use texture maps in there. Remember that you need to unlock the slot to use it.
You might have noticed when looking at the Glossy Fresnel cheat sheet that with lowering the Glossiness value, VRay also automatically lowers the IOR by a small fraction. This is great, however it does only work on a global scale. It doesn't get into account Micro Occlusion/Small Scale Shadowing - that's when light gets trapped in the small crevasses of the surface. Places where one should notice this effect usually look too bright when rendered, however, when the IOR is selectively lowered there, we can add another layer of depth to our materials. On the other hand, you might want a bit more IOR for example for the tiny stones in concrete.
This workflow gives the impression of extremely detailed lighting that can accentuate small details. Using IOR maps really shines on rougher surfaces like asphalt, tree bark, etc. but can also be used on scratched plastic. Here are a few examples:
No IOR map vs. IOR map
Specular pass: no IOR vs IOR map
Plastic: no IOR vs IOR map
Looking at the plastic example, this method seems like using an old-school Reflection map. In fact, it is lowering the reflection like a Reflection map would do, but it does it in a physically accurate way - we would still get 100% reflection at the 90-degree viewing angle, while legacy Reflection maps work globally and don't respect IOR.
All this said, question is - how to create these maps? Currently there are 2 methods of generating adequate IOR maps:
Based on Cross-Polarized Specular scan - this is the best solution, your render will have identical reflections to the real world cross polarized specular map. This method converts Roguhness/Glossiness map to IOR.
Open the Roughness/Glossiness map in Photoshop
If you're using a Glossiness map press Ctrl+I to invert it
Run this High Pass action script
Add a "Color Lookup" adjustment layer and use dubcat_Roughness_to_IOR.CUBE
Load texture with Gamma 2.2 in 3ds Max (Color Space = sRGB in VRayHDRI map)
Based on height, using a Normal map - this is the second best solution. If you don't have a cross polarized specular scan, you can go this way. You can generate an IOR / Specular map based on the normal map height strength.
Open the Normal map in Photoshop
Run this Normal to Height action script
Run this High Pass action script (same as in Method #1)
Add a "Color Lookup" adjustment layer and use dubcat_Roughness_to_IOR.CUBE
Load texture with Gamma 2.2 in 3ds Max (Color Space = sRGB in VRayHDRI map)
What the LUT does is to map IOR values between 1.1-1.8 to the equalized image after the High Pass. This method, the LUT and the action scripts are all courtesy of dubcat. The generated map is loaded with gamma 2.2 like a color map and goes into the Fresnel IOR slot.
Be mindful that the above actions are set to run automatically without any user interaction. Make sure that you do not accidentally enable user interaction/dialogue pop-ups by switching on the box next to the action in the action pane - the box should stay empty if you want everything to run smoothly.
IOR map generated based on specular data from a scanned surface. This map gives best fine details and true to reality results.
IOR map generated from Normal map. This map will perform quite well but will give more unrealistic results compared to a cross-polarized scan.
As a side note - if you really want to go bonkers and have more control over an IOR map you can recreate the above methods directly in 3ds Max. Note that this will make your material a lot slower to render and in the end you won't see a big difference. Here is an example for the Roughness to IOR converter (setup can be downloaded from here):
We split materials into Metals and Non-Metals based on their IOR (Index of Refraction).
All smooth materials be it Metal or Non-Metal get almost 100% reflective towards the 90-degree viewing angle.
Rougher materials also get more reflective but do not reach 100%.
The specular reflectance of a material at a 0-degree viewing angle is called F0.
The F0 for common Non-Metals falls in the range ot 2-5%. Gemstones are 8% which is also the maximum value. If you're unsure - use 4% or 1.5 IOR.
The F0 for Metals is in the range of 70-100%.
Metals have complex IOR which VRay doesn't support natively. We need to use either Siger Complex Fresnel or Custom Falloff to reproduce Metals.
When using legacy materials make sure that Glossy Fresnel is turned on.
Rougher surfaces will generally have lower IOR values because of Micro Shadowing.
An IOR map can be used to selectively control reflection amount.
Use a script and LUT to generate detailed IOR maps based either on scanned specular data or normal map height.
Linear Workflow: for IOR maps we use Gamma 2.2 (VRayHDRI: sRGB).