spec2IOR

Getting Reflections and Speculars to look right is one of the most essential parts to creating realistic-looking CGI. At the same time it is also one of the hardest things to get right. This is just a personal opinion on how I think varying specular behavior across a surface can be handled nicer than using traditional ways.

The main thing that gives you a nice specular variance across a surface is using roughness variations. Another technique that is well established alongside that is the use of specular-color/specmaps to modulate the intensity of specular highlights and reflections across a surface. Does it look good? Yep, usually! Is it accurate? Not really…

With the way most shaders are structured in VFX having a specular map to break up the intensity of specular reflections is not accurate. The specular color and specular gain of all shaders should always be white (RGB: 1,1,1). Wait, what? Let me explain…

If you look for example on refractiveindex.info you will notice that no matter what material you look at, they have one thing in common: The specular reflectance at the glancing angle is always 1, which means that if you were to look at any material at a potential angle of 90 degrees they would reflect all incoming light. Furthermore for dielectrics the specular component of the surface maintains its incoming polarization and is consequently not tinting the outgoing reflection. Changing the wavelength of light hitting dielectrics will not have a (perceivable) impact on the amount of light that is reflected so the specular or reflection color should stay white.

Where they all differ is how much light they reflect when looking directly at them at a 0 degree angle (often reffered to as F0, R0, spec0 or something along those lines). This is caused by the different indecies of refraction for the materials:
fresnelgraph

 

Also as you can see in the Fresnel graphs the amount of light that is reflected does not really change that much from 0 to about 45 degrees. If you were to take a sphere and visualize the areas that contribute the most to the overall surface appearance on screen its the range of 0-45 degrees (visualized in green) vs 45-90 degrees (visualized in red):

angle_visualization2

 

Now back to the point why I said the specular albedo should always be 1 is because the way shaders in most offline-renderers work. They calculate the total surface specular reflectance with Specular Color * Specular Gain which is then attenuated by the IOR depending on the angle you are looking at it. So if you were to change the specular color to anything less than 1 you would never potentially reach full reflectance at a 90° angle.
Consequently if your goal is to be technically accurate you would vary the index of refraction across a surface instead of the specular-color or -gain to achieve different levels in specular reflectance:

varying specColor / roughness 0.1

varying specIOR / roughness 0.1

varying specColor / roughness 1

varying specIOR / roughness 1

With varying the specular IOR instead of the color you are making sure you retain enough edge reflectance to create a more plausible surface appearance.

 

The IOR range for most dielectrics is about 1.3-1.8. I will ignore metals on purpose as they come with their own special sauce. These values however are not very artist friendly to work with as they are outside the 0-1 range.
Personally what I like doing is to first remap my spec map in a 0-1 range so I get the contrast ratio I want and then remap the result to the desired IOR range (using the out_min and out_max of a remap/range node for example).
nodegraph

Having a nicely varying specular roughness (alongside potentially anisotropy) across the surface will give most of the realism in most circumstances with a bit of IOR variation to round the whole thing off.

Even tough almost everything these days is path traced at the end of the day rendering is still a hack to imitate the reel world with our limited computing resources. So while this technique in theory should be more “physically accurate” it’s definitely not a solution that will always look best.

At the end of the day whatever makes an asset or a shot look great is usually the right way to go regardless of the technique in my opinion :)

_________________________________________________
If this post has helped you in any way you can express your gratefulness by using the Donate Button below to buy me a coffee! :)

3M5xNSV7g2NzVpHMqzYKhgoKJZ8CWa644m
bc_ldgr_qrcode