Der Schmale – David Lenaerts’s blog

Flash Platform Experiments

More Fresnel fun in Away3D: through the looking glass

Tags: , , , , , , , , , ,

glassBallAs 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.

Share and Enjoy:
  • Digg
  • TwitThis
  • del.icio.us
  • Facebook
  • Reddit
  • Netvibes
  • Technorati
  • Google Bookmarks

Tags: , , , , , , , , , ,

6 Responses to “More Fresnel fun in Away3D: through the looking glass”


  1. makc
    on May 13th, 2010
    @ 7:18 pm

    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


  2. makc
    on May 13th, 2010
    @ 8:10 pm

    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


  3. Jerome
    on May 14th, 2010
    @ 10:03 am

    Brilliant! Thank you for sharing the source :)


  4. Tim
    on Nov 3rd, 2010
    @ 8:51 pm

    Great work – any plans on creating an fp9 version?


  5. David
    on Nov 4th, 2010
    @ 12:46 pm

    Tim: No, this is using Pixel Bender which is not available for FP9.


  6. Ryan
    on Jan 15th, 2011
    @ 12:45 am

    Nice effect. I could get lost in that all day long.

Leave a Reply

© 2009 Der Schmale – David Lenaerts’s blog. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.