SmartReLight – relighting with Pixel Bender

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 !

6 thoughts on “SmartReLight – relighting with Pixel Bender”

  1. Andre

    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?

  2. flashgordon Post Author

    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.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="">