Thin-film interference and metals with complex refractive index

  • July 24, 2016
  • Blender 3.0x
  • Render: Cycles
  • Creator: prutser
  • License: CC-0
You must be logged in to download.


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). 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 [not included]). The previews of single materials are rendered with the provided .blend file.


See original thread

Also, see the talk 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 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.


  • CaptainRex profile picture

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

    Cheers, Rex

    Edited August 03, 2016
  • prutser profile picture

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

    Edited August 03, 2016
  • MiguelNacero profile picture


    Written August 09, 2016
  • prutser profile picture


    Written August 10, 2016
  • georgesd profile picture

    This is awesome! Thanks!!

    Written August 22, 2016
  • prutser profile picture

    Thanks! And you're welcome :)

    Written August 22, 2016
  • ubi_laptop profile picture

    more than awesome !

    Written August 22, 2016
  • prutser profile picture


    Written August 22, 2016
  • Comotempera profile picture

    This is awesome! Thanks!

    Written August 22, 2016
  • prutser profile picture

    Great :) You're welcome

    Written August 23, 2016
  • ChameleonScales profile picture

    No way. I've been wanting this forever !

    Written September 15, 2016
  • prutser profile picture

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

    Written September 21, 2016
  • vhcros profile picture

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

    Edited September 20, 2016
  • prutser profile picture

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

    Written September 21, 2016
  • kfbreauty profile picture

    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.

    Edited June 23, 2017
  • prutser profile picture

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

    Edited July 11, 2017
  • SuperChango profile picture

    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..

    Written October 24, 2017
  • prutser profile picture

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

    Written January 12, 2018
  • Leumeister profile picture

    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

    Written November 08, 2021
  • Zaman profile picture

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

    Written December 05, 2021
  • prutser profile picture

    Just updated the file, all are GPU compatible :)

    Written January 22, 2023
  • Mystic profile picture

    How do you change the transparency?

    Written March 04, 2023
  • jamesodum profile picture

    To change the transparency of an image or shape in Microsoft Office, you can use the Transparency option. Here are the steps to change the transparency of a picture in Microsoft uno online Word:

    Insert a picture in your document. On the Picture Tools Format tab, select Transparency. The menu shows thumbnail-sized versions of seven preset transparency options for your picture (0%, 15%, 30%, 50%, 65%, 80% or 95%). Select a preset option. The picture in the document immediately changes according to your selection. Alternately, you can choose Picture Transparency Options to customize the transparency level. The Format Picture pane opens, and you can drag the Transparency slider rightward to decrease the opacity of the picture.

    Written December 13, 2023
  • andree23 profile picture

    The provided information includes details on how the base layer of the material can be coated with one or two thin, possibly absorbing, layers in which interference can occur watermelon game. This interference leads to rainbow-colored phenomena similar to those seen in oil spills on streets and soap bubbles.

    Written January 16, 2024