/********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : TdG_depth_map.pov Version : 3.6.1c / MegaPOV 1.21 Description : To create a depth map, just render the scene with all textures replaced by a single gradient oriented toward the camera. The gradient direction goes from the look_at to the camera location, black for far, white for close. Use the spherical pattern. Have a value of 1 at the origin, that you translate to the camera location, and a value of zero at 1 unit radius, scaled to the depth of your scene. If you scale the onion pattern too small, it goes back to 1 where you want black. You could of course use the onion pattern as a test to make sure the deepest depth is where you want it and use the spherical pattern for the final render (best of both worlds). Date : May 2009 Author : Alain, ChrisB E-mail : p.advanced-users **********************************************************************************/ // Render settings (right-click on a line below): // +w640 +h640 +a0.3 +am2 #version 3.7; #include "transforms.inc" #include "colors.inc" #default {pigment {rgb <1,0,0>}} #default {finish {ambient 0 diffuse 1}} #declare AspectRatio = image_width/image_height; #declare CamZoom = 1.0; #declare CamSky = <0, 1, 0>; #declare CamAng = 70; #declare Test = off; global_settings { assumed_gamma 1.0 } // ---------------------------------------- #declare Camera_Location = <-4,7,-4>; #declare Camera_Lookat = <10,-10,10>; camera { location Camera_Location look_at Camera_Lookat sky CamSky up CamSky direction z*CamZoom right x*AspectRatio angle CamAng } // Union containing all scene objects union { sphere {0,1} sphere {<-2, 0, -2>, 1} sphere {< 5, 0, 5>, 1} sphere {<10, 0, 10>, 1} box {-10, 10} cylinder {<10,-10, 10>, <3, -3, -6>, 0.2} //for testing if scaling is correct: #if (Test) pigment { onion color_map { [0 color rgb 1] [1 color rgb 0] } scale vlength(Camera_Location-Camera_Lookat) translate Camera_Location } #else pigment { spherical color_map { //[0 color rgb 0] //[1 color rgb 1] [0 color Blue] [0.5 color rgb 1] [1 color Red] } scale vlength(Camera_Location-Camera_Lookat) translate Camera_Location } #end finish {ambient 1} }