POV-Ray : Newsgroups : povray.general : Saturn Ring mapping? : Re: Saturn Ring mapping? Server Time
31 Jul 2024 20:16:21 EDT (-0400)
  Re: Saturn Ring mapping?  
From: Trevor G Quayle
Date: 6 Oct 2006 10:10:00
Message: <web.4526635b53152476c150d4c10@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> "How Camp" <hac### [at] gmailcom> wrote:
> Interesting.  I don't think any of the map_types will give you what you are
> looking for.  The way I understand it, the strips represent one radial line
> of the ring, and it needs to be swept around the origin.  You likely need to
> use user-defined functions to transform the images into a radial pattern.
> If I get time, I'll try to throw together an example for you unless someone
> else has a better idea how to do it.
>
> -tgq

Here's an attempt at mapping the rings and texture properties using the
given images.  (I didn't map the underside image though)

//START
global_settings {
  assumed_gamma 1
}

#declare CamLoc= <200,50,200>;
#declare SunLoc= <5000,2000,-5000>;

camera {
  right x*image_width/image_height
  location  CamLoc
  look_at   0
}

#declare LB=
sphere{0 500 hollow no_image
  photons {collect off pass_through}
  texture{pigment{rgb 1} finish{ambient 25}}
}

light_source{0
  rgb 2
  looks_like{LB}
  fade_power 2
  fade_distance 5500
  translate SunLoc
}



#local PIMAGEb000 = function {pigment{image_map {png "SRb000.png"
interpolate 2}}} //back scattered light (0 deg)
#local PIMAGEb139 = function {pigment{image_map {png "SRb139.png"
interpolate 2}}} //forward scattered light (139 deg)
#local PIMAGEc = function {pigment{image_map {png "SRc.png" interpolate 2}}}
      //colour map
#local PIMAGEt = function {pigment{image_map {png "SRt.png" interpolate 2}}}
      //transparency

#macro CMap(C,T) color_map{[0 rgbt <0,0,0,T>][1 rgbt C*3+<0,0,0,T>]} #end

#declare RingIR=74.510; //inner ring radius
#declare RingOR=140.390; //outer ring radius

#declare FUNKY=function{(sqrt(x*x+z*z)-RingIR)/(RingOR-RingIR)}

#declare
FRe=function{select(FUNKY(x,y,z),0,select(1-FUNKY(x,y,z),0,PIMAGEc(FUNKY(x,y,z),0,0).red))}
#declare
FGr=function{select(FUNKY(x,y,z),0,select(1-FUNKY(x,y,z),0,PIMAGEc(FUNKY(x,y,z),0,0).green))}
#declare
FBl=function{select(FUNKY(x,y,z),0,select(1-FUNKY(x,y,z),0,PIMAGEc(FUNKY(x,y,z),0,0).blue))}
#declare
FTr=function{select(FUNKY(x,y,z),1,select(1-FUNKY(x,y,z),1,PIMAGEt(FUNKY(x,y,z),0,0).gray))}

#declare CL=vnormalize(<CamLoc.x,CamLoc.z>); //camera loc normalized
#declare SL=vnormalize(<SunLoc.x,SunLoc.z>); //sun loc normalized
#declare PA=degrees(acos(vdot(CL,SL)));//phase angle

#declare
FBr000=function{select(FUNKY(x,y,z),1,select(1-FUNKY(x,y,z),1,PIMAGEb000(FUNKY(x,y,z),0,0).gray))}
//brightness at 0deg
#declare
FBr139=function{select(FUNKY(x,y,z),1,select(1-FUNKY(x,y,z),1,PIMAGEb139(FUNKY(x,y,z),0,0).gray))}
//brightness at 139deg
#declare
FBr=function{FBr000(x,y,z)+(FBr139(x,y,z)-FBr000(x,y,z))*(PA)/(139)};
                       //interpolate brightness at phase angle (assume
linear)

#declare B=3;//ring brightness factor

#declare RCola=//fully opaque
pigment{average
  pigment_map {
    [function{FRe(x,y,z)*FBr(x,y,z)} CMap(<B,0,0>,0)]
    [function{FGr(x,y,z)*FBr(x,y,z)} CMap(<0,B,0>,0)]
    [function{FBl(x,y,z)*FBr(x,y,z)} CMap(<0,0,B>,0)]
  }
}
#declare RColb=//fully transparent
pigment{average
  pigment_map {
    [function{FRe(x,y,z)*FBr(x,y,z)} CMap(<B,0,0>,1)]
    [function{FGr(x,y,z)*FBr(x,y,z)} CMap(<0,B,0>,1)]
    [function{FBl(x,y,z)*FBr(x,y,z)} CMap(<0,0,B>,1)]
  }
}


#declare RCol2=//map colour to transparency
pigment{
  function{FTr(x,y,z)}
  pigment_map{
    [0 RCola]
    [1 RColb]
  }
}


disc {
  <0, 0, 0>  // center position
  y,         // normal vector
  RingOR,       // outer radius
  RingIR        // optional hole radius
  pigment{RCol2} finish{diffuse 0.5}
}


sphere{0 1
  texture{
    pigment{image_map{jpeg "saturn.jpg" interpolate 2 map_type 1}}
    finish{diffuse 0.6}
  }
  scale<60.268,54.362,60.268>
}
//END


Post a reply to this message

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