Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column
width100%

Overview


This shader reproduces the effect of thin film interference on a surface. It is based on code found here:

http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/thin-film-interference-for-computer-graphics-r2962

The shader can be used in the reflection color slot of a VRayMtl material through a VRayOSLTex, with the Fresnel option for the material turned off (the shader does its own Fresnel calculations).

The shader code and a sample scene are here: thinfilm.zip

UI Text Box
typeinfo

The hdr image is not provided as part of the sample scene. Feel free to replace it for a similar lighting result.

 

 

Section
Column
width100%

Parameters


thicknessMin - the minimum thickness of the thin film, in nanometers.

thicknessMax - the maximum thickness of the thin film, in nanometers.

thickness - a texture map that specifies the actual thickness of the film between the specified min and max thickness values. Normally this would be something like a noise map to give some variation to the interference effect. If this is left blank, the thicknessMin parameter specifies the film thickness.

nmedium - refractive index of the medium surrounding the material. Normally this is set to 1.0 for air.

nfilm - refractive index of the medium that the thin film is made of.

ninternal - refractive index of the medium below the thin film.

...