POV-Ray : Newsgroups : povray.newusers : Image Maps Server Time
31 Oct 2024 23:28:47 EDT (-0400)
  Image Maps (Message 1 to 7 of 7)  
From: Basiclife
Subject: Image Maps
Date: 14 Nov 2006 18:20:00
Message: <web.455a4e6b21f939cba4c94b1b0@news.povray.org>
Ok, so I'm an idiot. i accept that (at least in regards to povray. Ask me
one on programming...)

I'm trying to do something that must be VERY simple : map an image around a
globe.

I have ye-authentic satellite image of the earth as a JPG (I can change
format if req'd) and I have a sphere with a light on it. I'm having
problems combining the 2

Having read the help file entries on textures I can now make a sphere that#s
shiny, bumpy, and varies from area to area, but I can't get a picture ON my
sphere.

Any help greatly appreciated. If possible, a code snippet would be handy but
I'm sure I can work it out if someone points me in the right direction.

Thanks in advance


Post a reply to this message

From: Chris B
Subject: Re: Image Maps
Date: 14 Nov 2006 18:59:36
Message: <455a5868@news.povray.org>
"Basiclife" <nomail@nomail> wrote in message 
news:web.455a4e6b21f939cba4c94b1b0@news.povray.org...
>
> I'm trying to do ...  map an image around a globe.
>
> I have ye-authentic satellite image of the earth as a JPG (I can change
> format if req'd) and I have a sphere with a light on it. I'm having
> problems combining the 2
>
>
> Thanks in advance
>

Hi, You want something like:

sphere {0,1
  pigment {image_map {jpeg "earth.jpg" map_type 1}}
  translate <0.1,0.2,0.3>
}

The image is mapped to the sphere at the origin using map_type 1 (spherical 
mapping) and is then translated (along with the mapped image) to wherever 
you want it in the scene.

Regards,
Chris B.


Post a reply to this message

From: Chris B
Subject: Re: Image Maps
Date: 14 Nov 2006 19:06:04
Message: <455a59ec$1@news.povray.org>
"Chris B" <c_b### [at] btconnectcomnospam> wrote in message 
news:455a5868@news.povray.org...
>
> "Basiclife" <nomail@nomail> wrote in message 
> news:web.455a4e6b21f939cba4c94b1b0@news.povray.org...
>>
>> I'm trying to do ...  map an image around a globe.
>>
>> I have ye-authentic satellite image of the earth as a JPG (I can change
>> format if req'd) and I have a sphere with a light on it. I'm having
>> problems combining the 2
>>
>>
>> Thanks in advance
>>
>
> Hi, You want something like:
>
> sphere {0,1
>  pigment {image_map {jpeg "earth.jpg" map_type 1}}
>  translate <0.1,0.2,0.3>
> }
>
> The image is mapped to the sphere at the origin using map_type 1 
> (spherical mapping) and is then translated (along with the mapped image) 
> to wherever you want it in the scene.
>
> Regards,
> Chris B.

I should have also mentioned that you might get better results with map_type 
2 (cylindrical mapping) depending on the type of projection used to create 
the image. You may also need to add bands to the top and/or bottom of the 
image, depending on whether the image you have goes all the way to the 
poles.

Regards,
Chris B.


Post a reply to this message

From: Basiclife
Subject: Re: Image Maps
Date: 15 Nov 2006 07:15:01
Message: <web.455b03b9bef31fb5291c31dd0@news.povray.org>
"Chris B" <c_b### [at] btconnectcomnospam> wrote:
> "Chris B" <c_b### [at] btconnectcomnospam> wrote in message
> news:455a5868@news.povray.org...
> >
> > "Basiclife" <nomail@nomail> wrote in message
> > news:web.455a4e6b21f939cba4c94b1b0@news.povray.org...
> >>
> >> I'm trying to do ...  map an image around a globe.
> >>
> >> I have ye-authentic satellite image of the earth as a JPG (I can change
> >> format if req'd) and I have a sphere with a light on it. I'm having
> >> problems combining the 2
> >>
> >>
> >> Thanks in advance
> >>
> >
> > Hi, You want something like:
> >
> > sphere {0,1
> >  pigment {image_map {jpeg "earth.jpg" map_type 1}}
> >  translate <0.1,0.2,0.3>
> > }
> >
> > The image is mapped to the sphere at the origin using map_type 1
> > (spherical mapping) and is then translated (along with the mapped image)
> > to wherever you want it in the scene.
> >
> > Regards,
> > Chris B.
>
> I should have also mentioned that you might get better results with map_type
> 2 (cylindrical mapping) depending on the type of projection used to create
> the image. You may also need to add bands to the top and/or bottom of the
> image, depending on whether the image you have goes all the way to the
> poles.
>
> Regards,
> Chris B.


Many thanks! that was exactly what I needed. The final image will actually
have a varying image and will eb rendered regularly from the command line
for displaying on a webpage BUT I need to get this all shiny first.

Another quick question if I may:

In regards to mapping. Assume I had a checker board shape, I'd like the
horizontal and vertical lines to act in the same way as lines of lat/long.

Secondly, assume my image was 640x480 (for mapping, not the rendered
output). How can I rig this so that it is stretched around the equator once
- as a world map would have to be and covers 90% of the surface top to
bottom?

I'm assuming I add another pigment to specify colouring for those
non-covered areas but I can work that out by myself.

thank you in advance,
Simon


Post a reply to this message

From: Chris B
Subject: Re: Image Maps
Date: 15 Nov 2006 17:16:25
Message: <455b91b9$1@news.povray.org>
"Basiclife" <nomail@nomail> wrote in message 
news:web.455b03b9bef31fb5291c31dd0@news.povray.org...
>
> Another quick question if I may:
>
> In regards to mapping. Assume I had a checker board shape, I'd like the
> horizontal and vertical lines to act in the same way as lines of lat/long.
>
> Secondly, assume my image was 640x480 (for mapping, not the rendered
> output). How can I rig this so that it is stretched around the equator 
> once
> - as a world map would have to be and covers 90% of the surface top to
> bottom?
>
> I'm assuming I add another pigment to specify colouring for those
> non-covered areas but I can work that out by myself.
>
> thank you in advance,
> Simon
>
Hi Simon,

I'm not sure that this is what you mean by a checker board shape as it's 
more a grid, but the example below uses a simple straight line texture and 
layers it over and over again. First it rotates it around the y axis by 10 
degrees at a time, then it moves it vertically to cover the sphere, giving 
an effect like the lines of latitude and longitude on a globe.

On your second question, I'd recommend just making an image the right size 
in a graphics editor and pasting the 640x480 image into the middle of it. So 
it the image covers 90% of what you need, you'd create a new image 640x532 
and paste your 640x480 image into it, aligning it in the middle of the new, 
larger image.

By the way, it's probably best to create a new thread on the newsgroup for 
new questions because a lot of contributors may have stopped reading the old 
thread when they saw the original question answered. By creating a new 
thread you'll get a bigger audience and you're more likely to get your new 
questions answered quicker, plus you may well get a broader selection of 
different techniques and suggestions to choose from.

Regards,
Chris B.


#include "math.inc"
#declare YourObject = sphere {0,1}

#declare LineTexture = texture {
  pigment {
    gradient x
    turbulence 0
    color_map {
      [0      rgbt <0,1,0,0>]
      [0.001  rgbt <0,1,0,0>]
      [0.001  rgbt <1,1,1,1>]
      [1      rgbt <1,1,1,1>]
    }
  }
  scale 10
}

#declare WireframeTexture = texture {LineTexture}

#local I = 0;
#while (I<180)
  #declare WireframeTexture =
    texture {WireframeTexture}
    texture {LineTexture rotate y*I}
  #local I = I + 10;
#end

#local I = -80;
#while (I<90)
  #declare WireframeTexture =
    texture {WireframeTexture}
    texture {LineTexture rotate z*90 scale 2*y*(1-abs(sind(I)/1.1)) 
translate y*sind(I)}
  #local I = I + 10;
#end

object {YourObject texture {WireframeTexture}}

camera {location <0,2,-2> look_at 0}
light_source { <100, 1000, -2000> color rgb 1}


Post a reply to this message

From: Basiclife
Subject: Re: Image Maps
Date: 16 Nov 2006 07:20:00
Message: <web.455c5657bef31fb5291c31dd0@news.povray.org>
"Chris B" <c_b### [at] btconnectcomnospam> wrote:
> "Basiclife" <nomail@nomail> wrote in message
> news:web.455b03b9bef31fb5291c31dd0@news.povray.org...
> >
> > Another quick question if I may:
> >
> > In regards to mapping. Assume I had a checker board shape, I'd like the
> > horizontal and vertical lines to act in the same way as lines of lat/long.
> >
> > Secondly, assume my image was 640x480 (for mapping, not the rendered
> > output). How can I rig this so that it is stretched around the equator
> > once
> > - as a world map would have to be and covers 90% of the surface top to
> > bottom?
> >
> > I'm assuming I add another pigment to specify colouring for those
> > non-covered areas but I can work that out by myself.
> >
> > thank you in advance,
> > Simon
> >
> Hi Simon,
>
> I'm not sure that this is what you mean by a checker board shape as it's
> more a grid, but the example below uses a simple straight line texture and
> layers it over and over again. First it rotates it around the y axis by 10
> degrees at a time, then it moves it vertically to cover the sphere, giving
> an effect like the lines of latitude and longitude on a globe.
>
> On your second question, I'd recommend just making an image the right size
> in a graphics editor and pasting the 640x480 image into the middle of it. So
> it the image covers 90% of what you need, you'd create a new image 640x532
> and paste your 640x480 image into it, aligning it in the middle of the new,
> larger image.
>
> By the way, it's probably best to create a new thread on the newsgroup for
> new questions because a lot of contributors may have stopped reading the old
> thread when they saw the original question answered. By creating a new
> thread you'll get a bigger audience and you're more likely to get your new
> questions answered quicker, plus you may well get a broader selection of
> different techniques and suggestions to choose from.
>
> Regards,
> Chris B.
>
>
> #include "math.inc"
> #declare YourObject = sphere {0,1}
>
> #declare LineTexture = texture {
>   pigment {
>     gradient x
>     turbulence 0
>     color_map {
>       [0      rgbt <0,1,0,0>]
>       [0.001  rgbt <0,1,0,0>]
>       [0.001  rgbt <1,1,1,1>]
>       [1      rgbt <1,1,1,1>]
>     }
>   }
>   scale 10
> }
>
> #declare WireframeTexture = texture {LineTexture}
>
> #local I = 0;
> #while (I<180)
>   #declare WireframeTexture =
>     texture {WireframeTexture}
>     texture {LineTexture rotate y*I}
>   #local I = I + 10;
> #end
>
> #local I = -80;
> #while (I<90)
>   #declare WireframeTexture =
>     texture {WireframeTexture}
>     texture {LineTexture rotate z*90 scale 2*y*(1-abs(sind(I)/1.1))
> translate y*sind(I)}
>   #local I = I + 10;
> #end
>
> object {YourObject texture {WireframeTexture}}
>
> camera {location <0,2,-2> look_at 0}
> light_source { <100, 1000, -2000> color rgb 1}

As ebfore, many man thanks for the help and for the advice also.

Jsut to clarify, I meant that if I were to take a rectangular image of a
grid and place it on sphere, I would like the lines to be mapped in such a
way as the would appear to be lines of lat/long.

To try and sort my ramblings out a little more:

the vertical lines would be x distance apart at the equator and 0 distance
apart @ the pole, horizontal lines would be x distance apart continuously,
as in a globe.

Having said that, I can larn a lot from your example anyway as I'm new to
the whole language.

Once again, thank you


Post a reply to this message

From: Chris B
Subject: Re: Image Maps
Date: 16 Nov 2006 07:35:27
Message: <455c5b0f@news.povray.org>
"Basiclife" <nomail@nomail> wrote in message 
news:web.455c5657bef31fb5291c31dd0@news.povray.org...
>
> Jsut to clarify, I meant that if I were to take a rectangular image of a
> grid and place it on sphere, I would like the lines to be mapped in such a
> way as the would appear to be lines of lat/long.
>
> To try and sort my ramblings out a little more:
>
> the vertical lines would be x distance apart at the equator and 0 distance
> apart @ the pole, horizontal lines would be x distance apart continuously,
> as in a globe.
>

Hi Again,

That's really what the spherical mapping does, so if you have an image file 
containing a grid then the top edge of the image will be mapped to a single 
point at the centre of the top of the object. The midline of the image will 
be mapped to the 'equator'.

Regards,
Chris B.


Post a reply to this message

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