/* unanaglyph.pov * * Converts an anaglyph to a stereo pair. * * Usage: * Create a file named unanaglyph.inc with the following contents bitmap_type "image_filename" * Width-to-height ratio should be doubled, e.g., if anaglyph is 400x300, * use something like +w800 +h300 or +w400 +h150. * * Copyright © 2008 Richard Callwood III. Some rights reserved, under the * terms of the Creative Commons GNU General Public License. * This software carries no warranty, express or implied. * See http://creativecommons.org/licenses/GPL/2.0/ for more information. * Created 02-nov-2008 * Updated 03-nov-2008 * * Acknowledgements: Kyle, who in turn credits Jaime Vives Piqueres. */ #ifndef (Gamma) #declare Gamma = 2.2; #end //Gamma of anaglyph #ifndef (Cross) #declare Cross = 0; #end //Cross-eyed or no? global_settings { assumed_gamma 1 } #default { finish { ambient 1 diffuse 0 } } camera { orthographic right 2*x up y location <0, 0.5, -2> } #declare fn_Anaglyph = function { pigment { image_map { #include "unanaglyph.inc" interpolate 2 } } } /* Note: Ive has a function to convert JPEG to linear color space: http://news.povray.org/povray.pov4.discussion.general/message/%3C48ef7b0a%40news.povray.org%3E/ */ box { 0, 1 pigment { function { pow (fn_Anaglyph (x, y, z).red, Gamma) } color_map { [0 rgb 0] [1 rgb 1] } } #if (!Cross) translate -x #end } box { 0, 1 pigment { function { pow (fn_Anaglyph (x, y, z).green, Gamma) } color_map { [0 rgb 0] [1 rgb 1] } } #if (Cross) translate -x #end }