Glass with Chromatic Dispersion

Description

To recreate chromatic dispersion, before I had to settle on merging red, green, and blue glass nodes together with different IOR values. And it wasn't good.

This shader allows the refractive index to be dispersed over the entire colour spectrum. It is fairly low-noise, only needing 100 or so samples for a clear image.

If you do use this on any project, i'd be happy to know :)

Under the hood:

The shader uses a very small texture that acts as a random number generator with a range of 0 to 1. This is fed into the Hue input on a 'Combine HSV' node. This generates a transmission at a single point in the colour spectrum.

Simultaneously the same output from the random number generator is also fed into a colour ramp. This colour ramp contains the refractive index data. The wavelengths closest to red (0 and 1) are given a higher index, and wavelengths closest to violet (~0.8) are given a lower index.

Essentially, violet coloured transmissions will have a smaller IOR than a red transmission. And all the colours in-between are linearly interpolated accordingly.

Since the texture is so small. Most areas of the colour spectrum are transmitted within a pixel space. Cycles' rasteriser or anti-aliasing averages all the different transmitted colours together for each pixel (I think?).

It's not perfect. Overall there is a slight blue tint. I suspect the Vonori texture used as the random number generator may not have a completely linear distribution of values between 0.0 and 1.0. Also caustics are very noisy, and more than always average out to white (Yes, I failed to render the Pink Floyd album cover).

Comments (6)

M
maus10021 almost 8 years ago

OMG, I'm speechless, it's so beautiful! Great job!

H
hanbinsun_1224457 over 5 years ago

thanks

C
chacha_1394608 about 5 years ago

Thanks bro, this is awesome!

C
CountQuadula almost 5 years ago

Thank you for the videos explaining the how and why you connected the nodes.

N
nyakangi over 4 years ago

thanks it is awesome

I
iamblindman about 4 years ago

amazing

Sign in to leave a comment.