You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

Cycles Diamond Dispersion



Kirado shares a technique to simulate dispersion with Cycles.

Kirado writes:

Diamonds rendered in Blender Cycles, using a faked dispersion shader.

I made a diamond shader a few months back; after seeing some diamond renders appearing here on Blendernation I thought I should share the node tree, so people can see what's possible with cycles, and get the most out of their jewellery renders.

I did a mental ray diamond tutorial ages ago on Zaps Mental Ray Blog and wanted to see if I could get similar dispersion shader working in Cycles. The Diamonds were modelled in 3ds Max and imported into Blender.

I only used RGB Shaders with slighty different IOR mixed with ADD.

Here's the link to the dispersion node setup on my deviant art page.

Would be fantastic if someone could hard-code a dispersion setting into the glass node ;-)


    • Yes, you have to use 3 different IOR settings. I used the diamond IOR (you can find actual IOR for diff materials on-line) as a mid point, then I increased the IOR higher and lower for the other two glass shaders, It's important that you combine them using Add, otherwise your glass will not be transparent.

      I also had to add a tiny amount of blur/roughness to each shader, to remove firefly artefacts.

  1. I created a setup like this some time ago, but for Blender internal, and I got some great results too. I set the differences in IOR for R, G and B as follow: The IOR reference value for the G, a smaller value for R, and a bigger for B. The difference in the values determines the amount of diffraction

    • Wow, that's cool to know you can do it on the internal as well. Like I said it would be great to have it as a hard coded option in a glass shader, maybe a dev would like to pick it up, at some stage, when they're not too busy.

      • Yes, i tried for the first time in 2.49, but i had to make some changes for it to work correctly in 2.6.
        I agree, it would be nice to have it in a glass shader, or in the transparency settings, for the B.I.
        Here is an example done with Blender Internal...

  2. Very nice render! It's a very interesting method. I played around with this technique. You can actually speed up the render considerably by making use of the light path node or using a plain reflective material, when the light doesn't pass through the surface. I posted my .blend file on blendswap doing this here I hope they build spectral rendering into blender one day but until then it would be great if they could include something like this (even if it's just a preset node group).

    • Some cool examples. I'm still not sure how the light path node actually works, because I find the terminology for it confusing, eg. you have a glossy node (by glossy do they mean roughness or blurring of the reflection??), and a reflection node..  but reflections are glossy.. and transmission rays? Aren't all rays transmissive ie. they move through a medium, some of them get absorbed along the way to your eye/camera.. ie. the air.. 

      The documentation kinda hops around from real light characteristics and 3d terminology when it comes to defining what they are talking about. I think the light path node could do with some clearer documentation, and some examples of how to use the different light path nodes. I'm not really sure were you can ask these questions about cycles.

      • Yes, it's not well documented at the moment. I had to look at the code to see what was happening. Basically cycles applies a basic path tracing rendering scheme. This casts rays from the camera and bounces them around the scene. Each ray has a state that changes each time it hits a surface. This state includes flags for the type of ray. For example, when it's first cast from the camera these include one for 'camera ray'. if that ray hits a glass surface it randomly chooses to either reflect it or let it refract through. If it reflects it adds a 'glossy' and 'reflective' flag but if it chooses to let the light through it adds a 'transmissive' flag. Either way it removes the 'camera ray' flag. The 'light path' node gives each flag, with a value of 1 for the ones associated with the ray before it hits the material. So, if a mix shader is connected to the camera ray link then one shader will only be used for the first bounce and the other shader will be used for all other bounces. How each shader interacts with the flags isn't well documented and the fact the rays go in the opposite direction to actual light is confusing. I hope that's useful. I may make a tutorial if I get time.

  3. Thanks for sharing, Kirado. I've just tried the node and noticed that it's mimicking the dispersion beautifully. :)

  4. Not sure if you'll see a dispersion code in the glass set-up.  As Lukas states that advantage of Node Groups
    in the Blender Development log:"The advantage of generating such complex effects from simple components instead of adding them as a new node type is customization: You can take an existing shader/particle effect/object, make a copy of it and then tweak any internal part to make a new one. All this can be done by artists or TDs, without having to write C code and either use their own Blender builds or get a patch accepted into trunk."

    • to do proper dispersion it would have to hard coded in, it's not something you can make efficiently with nodes. It's not a hugely important feature, but would be useful to have.

    •  Oh and as he and I discussed in the comments below his video, you could renormalize colors by doing an average calculation instead of doing "max" :)

    • I had a go at increasing the samples like Nion did but for cycles. I included an attempt at this in the blendswap file I mentioned above, with five coloured glass shaders. Unfortunately, I couldn't get this to work. There seemed to be a bug in cycles that prevented too many glass shaders from being combined. I reported this bug awhile ago. Not sure if it has been fixed yet. Three colours does seem to be perfectly reasonable though. The spectrum can still be smoothed more with non-zero roughness or by adding a little noise to the IOR.

  5. Brilliant! I just finished testing Cycles with Fresnel's experiment, and just hit the end of the physics with Newton's prism. I was stuck for a solution, but this is brilliant. Still have some ideas brewing, involving mesh precomputation. I'll let y'all know what I come up with.

Leave A Reply

To add a profile picture to your message, register your email address with To protect your email address, create an account on BlenderNation and log in when posting a message.