Sunday, August 16, 2009

Anaglyphs using "ColorWriteMask"

The upcoming release of muvee Reveal (R15) features a new primitive effect called ColorWriteMask. Using it, you can selectively render a scene to the red, green, blue or alpha channels of the display area (aka "frame buffer"). Here is an example of a red write mask -

(define red-mask
(effect "ColorWriteMask" (A)
(param "Red" 1)
(param "Green" 0)
(param "Blue" 0)
(param "Alpha" 1)))

When you apply the red-mask to a scene, only the red channel values of the frame buffer will be affected and will consist of the red channel components of the scene itself (unless you have a pixel shader that mixes up channels, that is).

We can use the ColorWriteMask to spatially separate the red and cyan color components of the scene, thereby rendering the scene as an anaglyph. The example style S10000_CubeIn3D shows you how to get this effect. The key functionality is implemented in anaglyph.scm, which you can bring into your own styles like a library using -

(load (resource "anaglyph.scm"))


Now, whip out your red-cyan 3D glasses. Here is a sample muvee made using the "Cube Twist in 3D" style -

No comments:

Post a Comment