This Shader does a per wavelength Dispersion in a refractive material.
It is brut force dispersion shader and need a lot render samples to have a correct look. There is near no optimization, so it's not made for animation.
It was made for educational purpose and should be optimized and rethink for an effective production use. Indeed, results are really good for still pictures.
Small documentation :
Transp Color = Color of the transparent material.
Beware that if saturation is too high, you'll not see any dispersion.
IoR = Main Index of Refraction of material.
disp = Dispersion , in IoR Delta.
correct value are between 0.05 and 0.2.
A higher number give more rainbow in transparency, and slower rendering time.
A too high value ( > 0.3 ) can lead to rendering errors or inconsistency.
Roughness = surface roughness.
A good value is 0.0. Higher values blur refraction and could hide dispersion effect.
Full render = optimization.
1.0 = no optimization, slower render but accurate.
0.0 = no dispersion except for eye rays. You'll see no dispersion on a reflect of the object, and backface is ignored.
It is about 30% to 60% faster, and the difference between realistic and optimized material isn't noticeable for rendering that doen't need pure accuracy.
You can download the OSL Shader here : GDispersive.osl
This shader is made for educationnal purpose only. Use it in production at your own risk.
Closures are for Blender/Cycles. They could need adaptation for your renderer.
If you use this material, please credit it and me. Thank you.