// Persistence of Vision Ray Tracer Include File // File: panorama.inc // Vers: 3 // Desc: Spherical camera projection for making quick panoramic animations of scenes. // Date: 98.50 { horizontal mirror, camera field of view fixed. Added perspective, mclock. } // Auth: Bob Hughes, emailto:versecurse@aol.com // Dedicated to POVers everywhere, esp. PCR DaveD, David DRP (thanks to AmaltheaJ5 for the idea) global_settings { assumed_gamma 2.2 max_trace_level 2 } #declare SCT = 1 // 0 = create hemisphere, 1 = create pan. #if (SCT=0) #include "c:\progra~1\pov-ra~1\povscn\dragnjam.pov" // scene file to be "panned". #end #declare _C_ = clock // clock variable /* DEFINITIONS FOR SCENE _____________________________________________________________________ // Copy and paste into your pov scene file. #declare HEM = 1 // 1 = +z hemisphere, 2 = -z hemisphere. /* hemisphere creation only */ #declare TCX = 0 // camera x-axis location. #declare TCY = 0 // camera y-axis location. #declare TCZ = 0 // camera z-axis location. // increase to correct HF illegal grid value dda_traversal errors. #declare CCD = 1 // camera center distance multiplier. #include "panorama.inc" END DEFINITIONS FOR SCENE _________________________________________________________________ */ // DEFINITIONS FOR PANORAMA __________________________________________________________________ // Use for final panoramic animation. #declare clock_type = "S" #include "clockmod.inc" // the Colefax clock modifier. /* Panoramic creation only */ // the values shown here are examples. #declare CPT = 0 // 0 = ultra_wide_angle, 1 = perspective camera type. #declare NCH = -.225 // [-1><1] camera y-axis location. #declare NCA = 67 // camera zoom [angle 67 = direction 1]. #declare CSP = 33 // camera start position [degrees around y axis]. #declare PAN = 234 // camera pan [degrees of rotation]. #declare IN = "panorama" // input image name (made from hemisphere pair). #declare RCX = 0 // degree x spin for final panorama (clock optional). #declare RCY = PAN*mclock // degree y spin for final panorama (a clock is needed). #declare RCZ = 0 // degree z spin for final panorama (clock optional). #declare ISS = 1 // image_map y scale for final panorama. /* ---------------------------------------------------------------------------------------- */ // Special effect definitions // Camera up vector #declare CUX = 0 // sky up x-axis for final panorama. #declare CUY = 1 // sky up y-axis for final panorama. #declare CUZ = 0 // sky up z-axis for final panorama. // Sphere rotation vector #declare CRX = 0 // horizon x-axis for final panorama. #declare CRY = 0 // horizon y-axis for final panorama. #declare CRZ = -.05*mclock // horizon z-axis for final panorama. #declare clock_type = "J" // zoom type (see clockmod text). #include "clockmod.inc" // the Colefax clock modifier. #declare DZM = 1+(.5*mclock) // camera zoom over time [ 1 = none ]. #declare NCA = NCA*DZM /* ---------------------------------------------------------------------------------------- */ // END DEFINITIONS FOR PANORAMA ______________________________________________________________ /* OVERVIEW AND INSTRUCTIONS The purpose of this include file is to produce an animated panorama of an already made scene by rendering both hemispheres (the opposite two 180 degree fields of view of a scene) and then applying the resulting image(s) as an image_map used on the interior of a sphere for a 360 degree vista of that scene. The camera is then rotated to view this over the duration of the animation in various ways, ie. 360 degree revolution upon the y-axis. The viewpoint will be dependent upon camera location used when making the hemisphere images. First create two separate images of an already existing scene and then use the combination of these two (pasted together), each are to be made manually by setting the HEM definition to one of the two hemispheres, in succession. Next, with the default SCT definition set to 1, that image will be used as a spherical image_map and the camera rotation, which is setup inside that sphere, is animated. This end result is far faster than the same animation that would be rendered if the actual scene file were used instead. Note: Each hemisphere must be made in turn, and use a square image resolution (300x300). Hint: Try 1 and 2 at the end of the original pov scene name (example: +Oc:\images\povscn1). Paste both images side by side with an image editing program (make a new double-width image). Example command-line parameters and step by step procedure: Place a "panorama.inc" line into your scene file *after* any camera statement. With HEM set to 1 +w300 +h300 +oC:\Images\povscn1 +a (anti-aliasing optional, but recommended) Render scene. With HEM set to 2 +w300 +h300 +oC:\Images\povscn2 +a (anti-aliasing optional, but recommended) Render scene. Paste these two resulting images together, side-by-side, and save it for final use (place into a Library Path [+L] or use entire path, excluding tga extension, when stating IN definition). Open this include file and render using it, not the pov scene file (anti-aliasing not needed). The default SCT definition (1 instead of 0) is ready to render a panorama, just set the saved image name into the IN definition and render with an INI file for animation as desired. See the beginning of this include file for usable "copy/paste" section of #declare variables to be used as inclusion in your scene file before this include file is invoked. Additional info: HEMISPHERES The TCX,TCY,TCZ definitions are for camera placement within the pov scene. The CCD definition is a center-offset amount. Heightfields might error with the camera near the <0,0,0> vector origin, so increasing this value can prevent errors. PANORAMA PART The PAN definition may be any degree of rotation. 360 is full circle, 180 for semi-circle. The NCH definition is for adjusting camera height along the y-axis, closer to ground or sky. NCA is camera angle or zoom, CSP is the y rotation starting postion for the camera. RCY is the camera rotation during animation, based upon the PAN value. RCX and RCZ are camera x and z rotations. The last six definitions are sky vector and image_map sphere rotation, for changing orientation and to cause other effects during panning. */ // SET PARAMETERS /* THE FOLLOWING DEFINITIONS CAN BE PLACED INTO A POV SCENE FILE */ /* ---------------------------------------------------------------------------------------- */ #ifndef (SCT) #declare SCT = 1 #end // 0 = create hemisphere, 1 = create pan. #ifndef (HEM) #declare HEM = 1 #end // 1 = +z hemisphere, 2 = -z hemisphere. /* hemisphere creation only */ #ifndef (TCX) #declare TCX = 0 #end // camera x-axis location. #ifndef (TCY) #declare TCY = 0 #end // camera y-axis location. #ifndef (TCZ) #declare TCZ = 0 #end // camera z-axis location. // increase to correct HF illegal grid value dda_traversal errors. #ifndef (CCD) #declare CCD = 1 #end // camera center distance multiplier. /* THE ABOVE DEFINITIONS CAN GO INTO A POV SCENE FILE */ /* ---------------------------------------------------------------------------------------- */ /* Panoramic creation only */ #ifndef (NCH) #declare NCH = 0 #end // [-1><1] camera y-axis location. #ifndef (NCA) #declare NCA = 67 #end // camera zoom [angle] 67 is normal. #ifndef (CSP) #declare CSP = 0 #end // camera start position [degrees around y axis]. #ifndef (PAN) #declare PAN = 360 #end // camera pan [degrees of rotation]. #ifndef (IN) #declare IN = "povscn0" #end // input image name (made from hemisphere pair). #ifndef (RCX) #declare RCX = 0 #end // degree x spin for final panorama. #ifndef (RCY) #declare RCY = PAN*_C_ #end // degree y spin for final panorama. #ifndef (RCZ) #declare RCZ = 0 #end // degree z spin for final panorama. #ifndef (ISS) #declare ISS = 1 #end // image_map y scale for final panorama. /* ---------------------------------------------------------------------------------------- */ // Camera up vector #ifndef (CUX) #declare CUX = 0 #end // sky up x-axis for final panorama. #ifndef (CUY) #declare CUY = 1 #end // sky up y-axis for final panorama. #ifndef (CUZ) #declare CUZ = 0 #end // sky up z-axis for final panorama. // Sphere rotation vector #ifndef (CRX) #declare CRX = 0 #end // horizon x-axis for final panorama. #ifndef (CRY) #declare CRY = 0 #end // horizon y-axis for final panorama. #ifndef (CRZ) #declare CRZ = 0 #end // horizon z-axis for final panorama. #ifndef (clock_type) #declare clock_type = "O" #include "clockmod.inc" // the Colefax clock modifier. #ifndef (DZM) #declare DZM = 0*mclock) #end // camera zoom over time [ 0 = none ]. #declare NCA = NCA*DZM #else #end /* ======================================================================================== */ #switch (HEM) #case (1) #declare COS = -.01 #break #case (2) #declare COS = .01 #break #end // BEGIN SCENE camera { #switch (SCT) #case (0) // Make Hemisphere panoramic location <0,0,0> angle 179.999 up 1*y right 1*x translate look_at <0,TCY,0> translate #break #case (1) // Make Panorama #if (CPT>0) perspective angle NCA #else ultra_wide_angle angle NCA*2.6 #end location <0,0,0> right 1.333*x translate <0,NCH,COS*CCD> rotate CSP*y rotate RCY*y rotate RCX*x rotate RCZ*z look_at <0, NCH, 0> up #break #end } #if (SCT>0) #declare ImageName = concat ( IN, ".tga") sphere {0,1 pigment {image_map {tga ImageName map_type 1 interpolate 2}} // default finish only scale -1*<1,-1*ISS,-1> // mirror horizontally rotate *360 } light_source { <0,0,0> color rgb 1.5 } // equal illumination #end /* END OF FILE ____________________________________________________________________________ */