POV-Ray : Newsgroups : povray.newusers : Understanding image maps on spheres Server Time
5 Nov 2024 01:25:02 EST (-0500)
  Understanding image maps on spheres (Message 1 to 7 of 7)  
From: jbbarnes
Subject: Understanding image maps on spheres
Date: 30 Dec 2002 05:47:13
Message: <3e102431$1@news.povray.org>
Could someone explain to me how flat images are mapped onto spheres so I can
better manipulate them?

Here is an example of what I am working on:
http://www.geocities.com/jbbarnes77/fictionbannerfull.jpg I'm creating
glass-looking spheres that seem to have pictures inside them. The problem is
that I am having a really hard time getting the images aligned properly for
the camera. Tiling images are not too much of a problem, but let's say I
have an image of a man sitting in a chair and I want him in the dead center
of the sphere. I can set the image size and then play around with rotate
statements, but it's all guesswork because I don't understand the logic
behind the mapping process. I've learned that if I simply rotate the sphere
itself after the image is mapped, I get undesirable effects because only
looking dead-on gives a flat image. From other directions the image is
stretched and distorted. So I need to rotate the image as it is placed on
the sphere. But the x, y, and z don't work as I expect them to. Maybe I
should be using something other than rotate commands.

Here's the definition of the rightmost sphere in the above picture:

sphere { <68, 0, 50>, 10
   pigment {
      image_map { jpeg "nebula.jpg" interpolate 2 }
      scale 20
      rotate 60*z
      rotate -3*x
      rotate 6*y
    }
   finish {
      ambient 0.55
      diffuse 0.7
      phong 1
      phong_size 100
      reflection 0.505
   }
}

This was the closest I could get to making the nebula the right size and
getting it centered, but it's still not quite right. Can someone help me out
so that, once I scale the image correctly, I can understand how to center
the portion I want. Just rotating by x and y does not move it horizontally
and vertically like I had hoped.

Thanks.


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Understanding image maps on spheres
Date: 30 Dec 2002 06:04:26
Message: <20021230120426.18ae4039.jaimevives@ignorancia.org>
On Mon, 30 Dec 2002 01:47:11 -0900
"jbbarnes" <jbb### [at] yahoocom> wrote:

>       image_map { jpeg "nebula.jpg" interpolate 2 }

  I think the problem is that you are using the default planar mapping.
Try using map_type on the image_map statement to set it to spherical.

  Happy mapping!

-- 
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

From: jbbarnes
Subject: Re: Understanding image maps on spheres
Date: 30 Dec 2002 06:23:21
Message: <3e102ca9$1@news.povray.org>
>   I think the problem is that you are using the default planar mapping.
> Try using map_type on the image_map statement to set it to spherical.

Jaime,

I tried spherical, but it did not give the right effect. Everything looked
like it was in a fish-eye lens, with the center very magnified and
distorted. Using planar gives the right effect (a nice, flat, picture) but
is just difficult for me to figure out the logic of how it positions the
image within the sphere.


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Understanding image maps on spheres
Date: 30 Dec 2002 07:14:43
Message: <20021230131442.4b8ca260.jaimevives@ignorancia.org>
On Mon, 30 Dec 2002 02:23:18 -0900
"jbbarnes" <jbb### [at] yahoocom> wrote:

> I tried spherical, but it did not give the right effect. Everything
> looked like it was in a fish-eye lens, with the center very magnified
> and distorted. Using planar gives the right effect (a nice, flat,
> picture) but is just difficult for me to figure out the logic of how
> it positions the image within the sphere.

  Sorry, I read your message too fast. I see now you need a bit more
help...

  First, you need to create the sphere at the origin (<0,0,0>). That
simplifies things a lot. You can translate it to the desired position
later, after the texture statements. 

  Then, you nedd to translate the texture to fit the sphere, not
viceversa. You must know how the image_map is positioned by default.

  Finally, you must stick to planar mapping, as your maps are planar
ones. Only select them carefully to have the desired theme on the
center of the image. 

  I will write it this way:

sphere { 0, .5
   pigment {
      image_map { jpeg "nebula.jpg" interpolate 2 }
      translate <-.5,-.5,0>
   }
   finish {
      ambient 0.55
      diffuse 0.7
      phong 1
      phong_size 100
      reflection 0.505
   }
   scale 20
   translate <68,0,50>
}

  The code is not tested, but I think it must work, after re-reading
sections 6.7.1.5.1 and 6.7.12.7.2 of the docs (that's a fine RTFM! ;).

--
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

From: Peter Hertel
Subject: Re: Understanding image maps on spheres
Date: 30 Dec 2002 16:31:45
Message: <3e10bb41@news.povray.org>
> > I tried spherical, but it did not give the right effect. Everything
> > looked like it was in a fish-eye lens, with the center very magnified
> > and distorted. Using planar gives the right effect (a nice, flat,
> > picture) but is just difficult for me to figure out the logic of how
> > it positions the image within the sphere.
>
>   Sorry, I read your message too fast. I see now you need a bit more
> help...

<znip>

What about:
6.4.2.8 Spherical projection
Using this projection the scene is projected onto a sphere....

Rendering the scene/image you would like to add to the sphere with a
spherical camera, and then mapping it onto the sphere with spherical
mapping, the image won't be fish-eye disorted.
Just a thought.. Or did I misunderstand the problem?

-Peter


Post a reply to this message

From: gonzo
Subject: Re: Understanding image maps on spheres
Date: 30 Dec 2002 17:20:06
Message: <web.3e10c5f3f3cca5d1a0c272b50@news.povray.org>
jbbarnes wrote:

>I can set the image size and then play around with rotate
>statements, but it's all guesswork because I don't understand the logic
>behind the mapping process. I've learned that if I simply rotate the sphere
>itself after the image is mapped, I get undesirable effects because only
>looking dead-on gives a flat image. From other directions the image is
>stretched and distorted. So I need to rotate the image as it is placed on
>the sphere. But the x, y, and z don't work as I expect them to.


I think Jaime's reply above is your basic problem. Start with the sphere at
<0,0,0>. Also move your texture to <0,0,0>.

That's what his translation here does;
   pigment {
      image_map { jpeg "nebula.jpg" interpolate 2 }
      translate <-.5,-.5,0>
   }

The image_map by default is 0 and goes to 1.  Jaime's translation centers it
to 0. Then you can rotate and it should work like you expect.

RG


Post a reply to this message

From: jbbarnes
Subject: Re: Understanding image maps on spheres
Date: 30 Dec 2002 23:39:59
Message: <3e111f9f$1@news.povray.org>
>
>   First, you need to create the sphere at the origin (<0,0,0>). That
> simplifies things a lot. You can translate it to the desired position
> later, after the texture statements.
>
>   Then, you nedd to translate the texture to fit the sphere, not
> viceversa. You must know how the image_map is positioned by default.

Okay, so where I locate the sphere as I put the image map on it makes a
difference... That could be the source of the "inconsistencies" I was
seeing. Especially between identical spheres placed in different locations.
And it did seem like moving the spheres had an effect on the image map.

As you suggested, I will try creating them at <0,0,0> first and then moving
them to where I need them.

Thank you for the code examples and the documentation locations.


Post a reply to this message

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