Thin-film interference and metals with complex refractive index

Description

This Blend file implements physically correct passing of light through thin films of materials, and allows you to render phenomena such as soap bubbles, oxide layers on metals, thin metal films and polychromic car paints. As a bonus, a physically correct calculation of the Fresnel reflectance for metals is included as well, based on complex indices of refraction (also known as n and k values, see [complex refractive index](https://en.wikipedia.org/wiki/Refractive_index#Complex_refractive_index)). Here, n stands for the 'classic' index of refraction and k stands for the extinction coefficient, which describes absorption. This combination accurately describes the interaction of light with many types of materials, including glass-like materials, metals and car paints.

The base layer of the material may be coated with one or two thin, possibly absorbing, layers in which interference can occur. Light can interfere with itself, leading to a variety of rainbow-colored phenomena seen in for example oil spills on the street and soap bubbles. See the images for examples rendered with the script (bubbles lit by and background part of free HDR image pack by www.hdrlabs.com [not included]). The previews of single materials are rendered with the provided .blend file.

_Documentation_

See original [thread](https://blenderartists.org/t/cycles-pbr-thin-film-interference-iridescence-and-metals/672094)

Also, see the [talk](https://www.youtube.com/watch?v=dtXl9Waz5-w) on this topic I gave at BCon22.

Some helpful hints:

_Choosing values for n and k_

The shader allows you to enter the values to use for the refractive index (n) and the extinction coefficient (k) for the red, green and blue channels. These values are often listed as a function of the wavelength of the light, for example at refractiveindex.info. Wavelengths that are perceived as red run from something like 625 nm to 670 nm, green is about 520 nm to 550 nm and blue is about 440 nm to 470 nm. Which wavelength you choose to use for red, green and blue depends on your own preference; there is no wrong choice, and the shader will behave physically correct regardless. Of course for different choices of n and k at slightly different wavelengths, the material is likely to change appearance slightly.

_Optimized values of n and k for metals_

So-called spectral renderers use the tabulated n and k values for each wavelength in the visible light spectrum to calculate what a material should look like. Cycles on the other hand only uses three color channels, one for red, one for green and one for blue. You might wonder what n and k values would best approximate the results of a spectral renderer. I have optimized the values of n and k for the metals that are included in the blend file to look as close as possible to the output from a spectral renderer, when the metal is illuminated with white light.

Comments (22)

C
CaptainRex almost 10 years ago

WOW, that looks amazing man! Looking forward to digging into it :) Cheers, Rex

P
prutser almost 10 years ago

Glad to hear! I'm curious to know what you come up with :)

M
MiguelNacero over 9 years ago

Excelente!

P
prutser over 9 years ago

Gracias!

G
georgesd over 9 years ago

This is awesome! Thanks!!

P
prutser over 9 years ago

Thanks! And you're welcome :)

U
ubi_laptop over 9 years ago

more than awesome !

P
prutser over 9 years ago

Thanks!

C
Comotempera over 9 years ago

This is awesome! Thanks!

P
prutser over 9 years ago

Great :) You're welcome

C
ChameleonScales over 9 years ago

No way. I've been wanting this forever !

P
prutser over 9 years ago

And now you have it! :) Cheers and have fun with it!

V
vhcros over 9 years ago

Amazing.. i´ll make a lot of render with this. Thanks

P
prutser over 9 years ago

You're welcome! I'd be happy to see what you do with it :)

K
kfbreauty almost 9 years ago

Misleading image. How is anyone supposed to parse through this blend file? where are the models? Heres an idea: Why not include all the models AS SHOWN IN THE THUMBNAIL?????? geez.

P
prutser almost 9 years ago

How far does this attitude get you in the real world?

S
SuperChango over 8 years ago

Hey man ! awesome !.. im wondering if the same method could be used to portray an accurate prims effect ? i working on a car model with xenon reflectors and trying to get the chromatic variation on the edges.. currently getting somewhere using 3 different nodes with R glass, G glass and B glass combined with add shaders and then mixed to a white glass.. but it's not very convincing..

P
prutser over 8 years ago

Unfortunately that's as close to prism effects you'll get without faking it in Cycles

L
Leumeister over 4 years ago

Dude, is there a way I can gain a commercial use license for this and the GPU compatible version?!? These look amazing!! EDIT: Oh wait, I didn't realize it was just the shader that was NonCommercial, not the images made with it. My bad! XD

Z
Zaman over 4 years ago

cool! is there any way to use them all with GPU? some of them only work with the CPU.

P
prutser over 3 years ago

Just updated the file, all are GPU compatible :)

M
Mystic_1822447 about 3 years ago

How do you change the transparency?

Sign in to leave a comment.