Papervision3D Anaglyph Scene


Ever since I was a kid I've loved blue-red 3D glasses and a while back I got my hands on a pair at the office. Just this week I finally got around to making use of Papervision3D to create an interactive anaglyph animation.

Here's how it works...

Basically you need to create 2 viewports and 2 cameras, one for each color lens. On the first viewport, set colorTransform = ColorTransform(1, 1, 1, 1, 0x00, 0xFF, 0xFF) to appy a blue tint. On the second viewport, set colorTransform = ColorTransform(1, 1, 1, 1, 0xFF, 0x00, 0x00) for a red tint and set the blendMode = BlendMode.MULTIPLY to mix the two viewport results together. Move each camera equidistant from the center of the x axis to simulate the distance of the eyes. Each time you render the scene, you need to render once for each lense.

In the demo source code you will find two important classes, AnaglyphScene and AnaglyphCamera. AnaglyphScene is akin to BasicView, and sets up the viewports, cameras, scene and renderers for you. You simply add your scene objects and when you want to render call AnaglyphScene.render(). AnaglyphScene also makes public a object named "camera" which you can move using moveUp(), moveDown(), moveLeft(), and moveRight().

If you do anything cool with this, or stuble on any cool use of anaglyph imaging please leave a url in the comments!

Demo

Source

Comments

makc said…
Nice, but your color transforms damage actual colors. You should use (1, 0, 0) and (0, 1, 1) instead.
Forrest O. said…
I pulled the views apart to make a StereoScene for cross-eye viewing: http://wonderfl.net/code/f99cfba56cd56c38eef1a4b6c9cfe9a312c99ed0 (rollercoaster)

Popular Posts