As a continuation of an earlier post, here’s a variation of the Fresnel Pixel Bender material. Still obviously inspired by Bartek‘s Unity3D shader, it became a glass material with support for chromatic aberration (what causes the rainbow effect in refracted light). The result could come in handy in some situations, so I thought I’d share and commit it to the Away3D trunk as the GlassMaterial.
The material uses the same environment map to do (fake) refractions and reflections, so it’s not actually refracting the real scene around it. However, if you make a sphere map rendering of your scene, the effect can be convincing enough.
The demo shows a couple of default primitives and several settings of the material (such as glass colour and reflection strength), and also uses a new primitive called TorusKnot (which is a (p,q) torus knot). Consider that a tribute to a demo shown by Ralph during his presentation at FITC Amsterdam ;). Click to cycle through the different settings, and check the source to see how it all works.
Update: As Makc pointed out in the comments (and rightly so), the refraction looked rather icky, so I updated it that it uses linear sampling. It’s a bit slower but looks much better.
These rainbow colors resulting from “chromatic aberration” seem “dirty”, and I think it comes from bad panoramic image (seems like it went through 256 colors conversion at some point, see heavy banding on the sky). Maybe try with better one :D
nah, I still think the problem is with image. I was not talking about “smoothness” of spatial gradient, but about colors themselves, they look like old windows 256 palette. also, banding on the sky can’t possibly be affected by the shader – http://xs.to/image-76B1_4BEC4E10.jpg
Brilliant! Thank you for sharing the source :)
Great work – any plans on creating an fp9 version?
Tim: No, this is using Pixel Bender which is not available for FP9.
Nice effect. I could get lost in that all day long.