POV-Ray : Newsgroups : povray.general : Placing a 2d image on a sphere Server Time
1 Aug 2024 00:21:31 EDT (-0400)
  Placing a 2d image on a sphere (Message 1 to 2 of 2)  
From: davidafisher
Subject: Placing a 2d image on a sphere
Date: 10 Jul 2006 11:45:00
Message: <web.44b27561374d3c34ed548b310@news.povray.org>
I have generated a sphere to represent the moon code below, but I would like
to add an image to the sphere e.g. pigment { image_map { jpeg "y842.jpg"
map_type 1 once } }

but how do I combine the two so I get the image, plus the bumpiness, etc??

DavidF
*******************************************************
   #declare Moonsp = sphere         // 389 is the Sun:Moon distance ratio
   <0,0,PPs[HeD][Moon]/Scalar>, PPs [rad][Moon]*Scalar/389

   texture{
     bumps scale 30 turbulence .75
texture_map{
/**/
    #if (PPs[al][Sun]>0.0)  //suns above horizon - make it semivisible
          [0 pigment{rgbf .95}finish{diffuse 1 specular 0 ambient 0 }]
      #else
          [0 pigment{rgb   1} finish{diffuse .2 specular 0.0 ambient<.3 .5
1>}]
    #end
          [1 pigment{rgb   1} finish{diffuse 1  specular 0.0 ambient<.3 .5
1>}]
                }
          }   /*
           hollow off
           no_shadow
           rotate <-PPs [al][Moon], PPs [az][Moon], 0>    // move to true
position
           rotate <refidx,DAz,0>                          // move to
apparent position
         };
  Moonsp


Post a reply to this message

From: Mike Sobers
Subject: Re: Placing a 2d image on a sphere
Date: 10 Jul 2006 15:10:01
Message: <web.44b2a59e23f5f5a31009749b0@news.povray.org>
"davidafisher" <dav### [at] coppernet> wrote:
> I have generated a sphere to represent the moon code below, but I would like
> to add an image to the sphere e.g. pigment { image_map { jpeg "y842.jpg"
> map_type 1 once } }
>
> but how do I combine the two so I get the image, plus the bumpiness, etc??
>
> DavidF

Try this, assuming you're using a spherical projection map:

#declare moon_tex = texture {
pigment {
  image_map {
    jpeg "moon_usgs.jpg" // the file to read (iff/tga/gif/png/jpeg/tiff/sys)
    map_type 1        // 0=planar, 1=spherical, 2=cylindrical, 5=torus
    interpolate 2     // 0=none, 1=linear, 2=bilinear, 4=normalized distance
  } // image_map
}
  normal {
    bump_map { // uses image color or index as bumpiness
      jpeg "moonbump_pixelemporium.jpg" // the file to read
      map_type 1        // 0=planar, 1=spherical, 2=cylindrical, 5=torus
      interpolate 2     // 0=none, 1=linear, 2=bilinear, 4=normalized
distance
      bump_size 1     // 0...3
    } // bump_map
  }
}
//-----------------------

Mike


Post a reply to this message

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