# Iridescence In Cycles?

Is it possible to create an iridescence shader in Cycles?
Specifically for something like DVDs, soap bubbles, engine oil, etc..

Iridescence [is] the property of certain surfaces that appear to change color as the angle of view or the angle of illumination changes.

Thus, the following node setup should suffice:

If you're not familiar with node groups, this will create a new "node" called Iridescence that takes a base color parameter (you probably want white) and a factor parameter (which determines how strong the iridescence is; you probably want about 0.4) to output a color that you can put into a shader. You can see examples of how this works before.

The setup simply takes the dot product of the view vector and the surface normal and maps it to a spectrum. If you're not familiar with vector math, you can basically think of a dot product as a measure of how parallel two vectors are: the dot product of two perpendicular vectors is 0, while the dot product of two normalized parallel (or anti-parallel) vectors is 1.

You can put this node group in any shader and get a nice result. I tried it in a Diffuse BSDF, but putting it in a Glass BSDF might yield some nice bubble renders.

Here's an image of Suzanne wearing her iridescent cloak (the factor is set to 1.0 to exaggerate the effect):

Here's the factor turned down to 40% (lower works in better lighting setups, but my sky texture is blowing it out):

• It's sometimes also nice to Add a magic or distorted noise texture to the Normal or Reflection coordinates – Greg Zaal Aug 13 '13 at 8:37
• Could you post an EXPANDED version of the node-setup in your iridescence shader? I can't even guess at what is in "Group Input" and/or "Group Output"...Otherwise it LOOKS like a great shader... TIA... :O) – David A. Lewis Aug 20 '13 at 23:06
• @DavidA.Lewis please see my edit. – wchargin Aug 20 '13 at 23:09
• @DavidA.Lewis Node groups were changed a lot in 2.67. That is the expanded form, the nodes "group input" and "group output" are now part of the way node groups work (and can't be expanded). – gandalf3 Aug 21 '13 at 2:54
• Why did you use the camera vector? How well would that work with something like a mirror in the scene? Should you perhaps use the incoming vector instead? – Segmented Jul 22 '17 at 5:02

True iridescence is difficult to achieve using Cycles. However, there are ways you can fake the effects of iridescence by shifting the color slightly based on the object normals. This has the advantage of being highly customizable for your particular purpose and much faster than true iridescence would be.

Update: I was able to find an implementation of this using Cycles on this BA thread.

Here is the node setup:

And an example render using the above node setup with different values:

EDIT: Found a better implementation done directly in Cycles. The old BI node setup can be found here.

• Noise Scale: 5 Million!?!? Is that necessary for faking some tiny surface geometry that creates iridescence? (Nice answer, btw) – Mentalist Mar 14 '16 at 8:14
• The setup posted here is far from correct (I know because I'm the author of the mentioned thread). The noise scale only serves for sampling purposes, as we need different seeds for each sample, but as I mentioned in that same thread, the output values are not normalized, and create a strange bias in the wavelength distribution. For diffraction grating (CDs, DVDs, etc), I'd advise to use my OSL script (also in the thread), wich is more accurated and physically based. – Secrop Feb 23 '18 at 10:05

This is where OpenShadingLanguage can step in. Using an OSL script you can get an iridescence effect.

Michel J. Anders has already done the hard work on his Small Blender Things blog with his surface iridescence shader. You may find some of his other scripts interesting as well.

For example: