Friday, May 15, 2009

How to make one-pass 3D anaglyphs in povray

This requires the Megapov patch of povray

1. Give all your objects a pigment which is of the form rgb < n , n , n > , where n is between zero and one. In other words, black and white.
2. Make up two camera_view pigment patterns in povray, which are identical in every respect, including the look_at vector, except that the locations of the camera are separated by a few pov-units.
3. Make up three subsequent pigments:
i) one that makes use of your left pigment and goes from black to 3*red
pigment{function{left_camera_pigment (x,y,z).red} colour_map {[0 rgb 0][1 rgb <3,0,0>]}}
ii) one that makes use of your right pigment and goes from black to 3*green
iii) one that makes use of your right pigment and goes from black to 3*blue.
4. Set up an average pigment which combines the three with equal strength.
5. Set up a box that fills the camera (see my earlier povray posts) and has the pigment in #4 as its texture.

Now, when you render, you will be automatically creating red-cyan 3D anaglyphs in povray.

Enjoy

No comments: