POV-Ray : Newsgroups : povray.general : Saturn Ring mapping? : Re: Saturn Ring mapping? Server Time
31 Jul 2024 20:19:41 EDT (-0400)
  Re: Saturn Ring mapping?  
From: Roman Reiner
Date: 6 Oct 2006 05:45:01
Message: <web.452624055315247699ba499e0@news.povray.org>
I just can't memorize how to get back the colors from a pigment function let
alone transparency. I think it was possible with splines... anyway, this
should at least handle the mapping issue:

//start code

camera {
  location <-25,50,-150>
  look_at <0,0,-75>
  angle 65
}

light_source {
  <50,25,-150>
  rgb <1.7,1.4,1.2>
}

#declare r=75; //minor radius
#declare R=100; //major radius

#declare f_pigm = function { pigment { image_map {  png "testimage.png"
interpolate 2 }}};
//replace with your testimage

#declare f_pigm2 = function {
f_pigm((x-r)/(R-r),(y+.375*(R-r))/(.75*(R-r)),z) };
//scaled and translated function which matchs the radii of the ring

#declare f_rad = function { sqrt(x*x+y*y+z*z) } //returns the distance from
origin

disc {
  0, y, R, r
  pigment {
    function {
      f_pigm2(f_rad(x,y,z),0,0).gray
      //this is where it happens, no more colors here :(
    }
  }
}

polygon { //displaying the test image
  4,
  <0,0,0>,
  <0,1,0>,
  <1,1,0>,
  <1,0,0>
  pigment {
    image_map {
      png "testimage.png" interpolate 2 transmit all .5
    }
  }
  finish { ambient 1 diffuse 0 }
  scale <R-r,.75*(R-r),1>
  translate <r,-.375*(R-r),0>
  rotate y*60
  no_shadow
}
//end code

Hope this helps!
Regards Roman


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.