|
![](/i/fill.gif) |
High!
I just noticed that the mapped version of the pigment is mirrored...
here is the corrected version of the macro:
#include "c:\Programme\POV-Ray for Windows v3.5\include\functions.inc"
// Generates simple cylindrical maps out of spherical prodedural pigment
patterns
// Parameters:
// pigm - name of the pigment to be mapped
// rad - radius of the sphere which surface is to be mapped
// res - map resolution in degrees per pixel
// w - width of the map in pixel
// Note: to generate a seamless, undistorted map,
// the camera angle must be atan(w/camera_distance)/(pi/180)*2, and it
is
// recommended to use the orthographic camera. I included such a camera
within the macro,
// in case different settings are needed, a new camera must be defined
// after invoking the macro.
#macro CylMap(pigm, rad, res, w)
#local a=90;
#while (a>=-90)
#local b=0;
#while (b<360)
box
{
<(b-180)*(w/180), a*((w/2)/90), 0>, <(b+res-180)*(w/180),
(a-res)*((w/2)/90)>
texture
{
pigment { eval_pigment(pigm,
rad*<sin(b*(pi/180))*cos(a*(pi/180)),
sin(a*(pi/180)), cos(b*(pi/180))*cos(a*(pi/180))>) }
finish { ambient 1 }
}
}
#declare b=b+res;
#end
#declare a=a-res;
#end
camera
{
orthographic
location <0, 0, 10> // the camera must look towards -z!
look_at <0, 0, 0>
up <0, 1, 0>
right <2, 0, 0>
angle atan(w/d)/(pi/180)*2
}
#end
Post a reply to this message
|
![](/i/fill.gif) |