// Persistence of Vision Ray Tracer Scene Description File // File: unwrap.pov // Vers: 3.5 // Desc: Cylindrically unrolls an object. // Date: // Auth: Barrett L. Bowen aka "Batronyx" ^"^ // Suggested commandline settings: // +w800 +h533 // +w300 +h200 /************************************************************ This file takes an object and cylindrically unrolls it around the y-axis. This can be useful for objects that do not support UV-mapping by serving as a background layer in paint programs to guide texture creation, or as a morph target in image morphing applications ( i.e. Hijaak Morph) The camera ensures the clip object is always 1 pixel wide. It is centered across pixel boundaries though so (assuming a single base object) you will always wind up with image_width+1 objects. The base object should be generally suitable to either cylindrical or spherical mapping. There are no lights and depth style gradient textures are recommended. Also, the initial object should face the +z direction as this will be the center of the unwrapped image. *************************************************************/ camera { orthographic location <0,0,-1000> right x*image_width up y*image_heigh } #include "transforms.inc" #declare Cutter = // Clipping object intersection{ plane { x .5} plane {-x .5} plane {z 0.05} } //spherical, onion, cylindrical, or even radial might all be useful here #declare WrapTex= texture{ pigment{wood ramp_wave color_map { [0 color rgb 0] [1 color rgb 1] } //rotate x*-90 } finish { ambient 1} } #declare Wrapobject = /* Some object here */ Center_Trans(Wrapobject, x+y+z)} //Get some measurements to use later. #declare skMin = min_extent(Wrapobject); #declare skMax = max_extent(Wrapobject); #declare FitScaleY = transform{ scale ((image_height/2)/(skMax.y))} // Scale so top to bottom fits the screen. #declare Wrapobject = object{Wrapobject transform{FitScaleY} } //Get new min & max extents for the properly scaled version. #declare skMin = min_extent(Wrapobject); #declare skMax = max_extent(Wrapobject); //Now slice and dice :) #declare Count = 0; #declare Trans = -image_width/2; #while (Count <= image_width) object{ Wrapobject //rotate y*180 // orient the front to +z rotate y* ((Count/image_width)* 360) Align_Trans(Wrapobject, -z, <0,0,skMin.z>) clipped_by {Cutter} // take a slice here translate x*Trans // and move it to the correct spot } #declare Count = Count +1; #declare Trans = Trans + 1; #end