POV-Ray : Newsgroups : povray.newusers : Image mapping onto shere Server Time
1 Nov 2024 06:17:55 EDT (-0400)
  Image mapping onto shere (Message 1 to 4 of 4)  
From: geogeo
Subject: Image mapping onto shere
Date: 20 Jan 2010 16:10:01
Message: <web.4b576f88ca4826f2135358dc0@news.povray.org>
I've searched for hours but just can't find a clear definition of how an image
is wrapped around a sphere. The best I can get - and it's far from perfect - is
with the following code, arrived at by trial and error - the image being 2:1
width to height. If I knew what the rules were I might do better! Maybe someone
can clarify this for me.
Thanks, Geo

sphere { <0,0,0>, 1 texture
         {
         pigment { image_map {jpeg "lines3.jpg" }
         scale <2,2,1>
         translate  <0, 1, 0>
                 }
         }
       }


Post a reply to this message

From: Tim Attwood
Subject: Re: Image mapping onto shere
Date: 20 Jan 2010 16:58:34
Message: <4b577c8a$1@news.povray.org>
Spheres are supported by UV mapping,
so...

sphere {0,1 pigment {
   uv_mapping
   image_map {jpeg "lines3.jpg"}
}}

should work fine. In the more general case
(since not all objects are supported by UV mapping),

sphere {0,1 pigment {
   image_map {
      jpeg "lines3.jpg" 
      once // don't repeat the image
      map_type 2 // cylindrical 
   }
   translate <0,-0.5,0> // center the image on origin
   scale <1,2,1> // double the height to match diameter of sphere
}}

All this assumes that your starting image is a cylindrical
map. When you are looking at a cylindrical map there is
distortion near the top and bottom of the image, this means
that to do vertical lines, they are no longer straight, but hourglass
shaped in the source image, otherwise the lines will pinch in
narrower at the poles. So they're a bit hard to manually create
in a paint program, but such images are available online for the
earth and most of the planets.


Post a reply to this message

From: geogeo
Subject: Re: Image mapping onto shere
Date: 21 Jan 2010 10:55:00
Message: <web.4b5878a558ffb9ec846dd2f80@news.povray.org>
"Tim Attwood" <tim### [at] anti-spamcomcastnet> wrote:
> Spheres are supported by UV mapping,
> so...
>
> sphere {0,1 pigment {
>    uv_mapping
>    image_map {jpeg "lines3.jpg"}
> }}
>
> should work fine. In the more general case
> (since not all objects are supported by UV mapping),
>
> sphere {0,1 pigment {
>    image_map {
>       jpeg "lines3.jpg"
>       once // don't repeat the image
>       map_type 2 // cylindrical
>    }
>    translate <0,-0.5,0> // center the image on origin
>    scale <1,2,1> // double the height to match diameter of sphere
> }}
>
> All this assumes that your starting image is a cylindrical
> map. When you are looking at a cylindrical map there is
> distortion near the top and bottom of the image, this means
> that to do vertical lines, they are no longer straight, but hourglass
> shaped in the source image, otherwise the lines will pinch in
> narrower at the poles. So they're a bit hard to manually create
> in a paint program, but such images are available online for the
> earth and most of the planets.

Many thanks, works fine! I already had a suitable POVray cylinder image for
Earth but hadn't twigged the uv-mapping aspect. From a few tests I've done it
seems the aspect ratio of the image is not important - it gets stretched to
cover the sphere. Very handy.

Thanks again
Geo


Post a reply to this message

From: clipka
Subject: Re: Image mapping onto shere
Date: 10 Feb 2010 07:31:09
Message: <4b72a70d$1@news.povray.org>
geogeo schrieb:
> "Tim Attwood" <tim### [at] anti-spamcomcastnet> wrote:
>> [...]
>> sphere {0,1 pigment {
>>    image_map {
>>       jpeg "lines3.jpg"
>>       once // don't repeat the image
>>       map_type 2 // cylindrical
>>    }
>>    translate <0,-0.5,0> // center the image on origin
>>    scale <1,2,1> // double the height to match diameter of sphere
>> }}
>>
>> [...] such images are available online for the
>> earth and most of the planets.
> 
> Many thanks, works fine! I already had a suitable POVray cylinder image for
> Earth but hadn't twigged the uv-mapping aspect. From a few tests I've done it
> seems the aspect ratio of the image is not important - it gets stretched to
> cover the sphere. Very handy.

For completeness' sake, be advised that the typical projection used for 
planetary "image maps" is "equidistant cylindrical" (aka "plate carree") 
projection, that is the coordinates in the image correspond to the 
latitudinal and longitudinal angles - which does NOT match POV-Ray's 
map_type 2, but rather map_type 1 ("spherical").

The terms used in POV-Ray are a bit misleading, as in cartographers' 
terms both are "normal cylindrical" projections, with type 2 being very 
rarely used in cartography, if at all.


Post a reply to this message

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