Get Adobe Flash player

SmartReLight – relighting with Pixel Bender

27. December 2009 – 17:57

Tags: , , , ,

SmartReLight - relighting with Pixel Bender

Relighting is an interesting method that is often used in video post production pipelines.

Given the vector of its surface normal, it is possible to calculate the brightness of each pixel by a pseudo 3D lightning system.

Checkout the demo of SmartReLight!



As the ‘object space’ – or ‘material’ normal’s have to be known, relighting is mostly used within the post process of CG generated images or videos.

It’s a convenient way to archive great lighting and gives the artist most control as he can tune it in real-time without having to re- render the footage for every adjustment.

As you can see from this example, the complete lighting is done by the shader using only a color pass and the object normal’s:

smartrelight2


This implementation is fairly simple as it doesn´t support reflections and refractions like Normality , but its fast and does the job – and what better way to get through the last cold days of the year than playing half an hour with Pixel Bender?

It’s also possible to relight already lighted sources to some extend, by not using the color- , but an already phong- shaded pass:




You can download SmartReLight here and the source of the demo including the shader here.


Compiling PB shaders at runtime

Last but not least a short but very interesting story:

Recently I was asked if it was possible to compile a PB shader at runtime.

Given it some thought – why not?

And as it turned out the hell of a chap Nicolas Canasse already took care of that matter.
There is also already an AS3 port by James Ward.


All the best for 2010 !

  1. 6 Responses to “SmartReLight – relighting with Pixel Bender”

  2. Great Example- Lot’s of other interesting experiments too. I’m a fan :)

    By Peter Strømberg on Jan 6, 2010

  3. Hi Peter,

    thank you for the complement.

    Great stuff on your page too – I see you also worked with relighting.

    Consider yourself bookmarked :)

    By flashgordon on Jan 6, 2010

  4. Just stumbled across your site by chance – fantastic! :)

    Really like this use of pixel bender.

    By Mike Almond on Jan 12, 2010

  5. Thanks Mike,

    and btw – love the idea of a simple font-asset creater!

    By flashgordon on Jan 12, 2010

  6. Great work!

    One question: what exactly is the object space normals? Is it a recording of the xyz position of the 3d model’s vertices in space? If so which space? The global world space or a space that is local to something else then the global 0,0 position? Maybe the local 0,0 position of the model’s axis?

    By Andre on Sep 11, 2010

  7. Hi Andre,

    yes – you got it exactly right.

    You could also call an object space normal map a world space normal map, and I used it just because it was convenient:)

    It is already in the same space as the light and I didn’t have to deal with object rotation or deformation which is a feature of the tangent space approach.

    By flashgordon on Sep 11, 2010

Post a Comment

Security Code: