Anaglyphs With Pixel Bender & Depth Map

Pixel Bender and displacement maps were so much fun to develop that my next experiment led me to create some more advanced effects. Do you know anaglyphs? Anaglyph images are used to provide a stereoscopic 3D effect, when viewed with 2 color glasses. There are multiple types of glasses (colors), but the most comon is red-cyan combination. So, I have created this simple pixel bender kernel that makes anaglyph images based on original image and its depth map (just like those used in displacement maps)

Take on your red cyan glasses and lets see the result:

I have been asked to make it also work for other types of glasses, so I made left/right glass matrices dynamic, now you can define any values you like (based on your glass color). The default matrices are:

shader.data.matrixLeft = [0.0, 0.0, 0.0, 0.7, 0.0, 0.0, 0.3, 0.0, 0.0];
shader.data.matrixRight = [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];

… these values are taken from optimized method for red cyan combination. There are some more for this color combination.

There is also the zBase parameter that takes values from 0.0 to 1.0. Defaul value is 0.5. With 0.0, the scene appears to be in front of monitor, with 1.0 depth goes behind the monitor. With 0.5 closer objects appears to be before monitor, distatnt ones behind:

shader.data.zBase = [0.5];

Take care so your head will not explode :-) Download pixel bender kernel (.pbk) file for anaglyphs here.

Where to go from here:

4 comments so far

  1. [...] Did you know you can make anaglyphs using this technique? [...]

  2. [...] Did you know you can make anaglyphs using this technique? [...]

  3. [...] with Pixel BenderAndrei Ionescu | 26.07.10 | Comment? Jozef Chúťka has did manage to create anaglyphs using Pixel Bender and displacement maps. The result is [...]

  4. [...] has been a lot of excitement around this post from Jozef Chutka: Anaglyphs With Pixel Bender & Depth Map, because it is really cool. A great 3D depth-map effect done with Pixel Bender. 3D image from Jozef [...]

Leave a comment

Please be polite and on topic. Your e-mail will never be published.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes