In the previous article we talked about how we shot our footage in stereo. Now we are going to talk about how to render those stereo images for 3D glasses. And how to render Papervision3D for 3D glasses.
There are many techniques for displaying stereoscopic 3D images. We opted for Anaglyph, the one you need the red/cyan glasses to view, since those are the glasses people are most likely to have laying around somewhere. Also these are the least expensive glasses of the lot and that mattered since we were also going to do a mailing of Barcinski & Jeanjean 3D glasses.
In short, an anaglyph image is obtained by taking the red color channel from the left camera and combining it with the blue & green color channels from the right camera. The drawback of this technique however, is the loss of color information, mostly affecting the red color component. So that was an issue we had to take into account as to what colors we would use in the website. Black doesn’t suffer in any way by anaglyph, so that kind of pushed us towards a basic graphic black & white design for the intro and menu cube.
On to rendering Papervision3D in anaglyph! For our website we have created an AnaglyphView class which offers anaglyph renedering in Papervision3D with the ease of use of the BasicView class. Click on the image below to view the demo. Toggle anaglyph rendering on and off by clicking on the Stage.
The AnaglyphView has one camera and two viewports. For each frame it moves the camera to the left, renders the camera projection to the left viewport, then moves the camera to the right, renders the camera projection to the right viewport and finally moves the camera back to it’s initial position. This way you still have complete freedom of camera movement in between the renders. Best is to use a Target Camera and move the target object to the focus point, creating the same mechanics as our eyes when focusing.
The left and right viewports are combined using ColorTransforms and BlendModes. While this offers a fast way of combining the two channels to an anaglyph image it is important to note that the viewports will not render correctly when not completely opaque. That’s why the AnaglyphView uses extended Viewport3D classes that make sure the viewports have a background filled with the supplied background color.
To combine 2D stereo images with 3D stereo rendering you need to attach the 2D stereo images to their respective viewports. That’s what we did in our website. The left panorama video is added to the DisplayList of the left viewport and the right video to the DisplayList of the right viewport.
Needless to say stereo rendering in Papervision3D can be very heavy. Your aim would be to keep the scene as simple is possible and limit the redraw regions as much as possible. We’ll be going into some optimization tricks in our article covering the Papervision3D side of our website.
Feel free to download the AnaglyphView class and start playing with it. The example above is also included in the package.