POV-Ray : Newsgroups : povray.general : uv_mapping around a box Server Time
1 Nov 2024 15:28:20 EDT (-0400)
  uv_mapping around a box (Message 1 to 9 of 9)  
From: Jeremy M  Praay
Subject: uv_mapping around a box
Date: 5 Sep 2004 13:25:49
Message: <413b4c1d$1@news.povray.org>
I've read the documentation on uv_mapping around a box, and I thought it
made perfect sense.  Then I tried it, and I'm apparently missing quite a
bit.

Here's my situation:

box {0, <5,3,2>}

and I have an image where each 100 pixels is one unit, and it is layed out
like the documentation shows (I think).  Basically, then I'm left with a
1400x700 image (in x direction: 200+500+200+500, in y direction:
200+300+200) layed out in the wrap-around shape that the documentation
shows.

I can't figure out how to get that to map onto the box.  I've tried some
experimentation, but the scaling and translations aren't making any sense to
me at this point.

-- 
Jeremy
www.beantoad.com


Post a reply to this message

From: Warp
Subject: Re: uv_mapping around a box
Date: 5 Sep 2004 15:57:09
Message: <413b6f95@news.povray.org>
Perhaps a more complete code of what you are trying to do would be
more helpful in giving a proper answer...

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Slime
Subject: Re: uv_mapping around a box
Date: 5 Sep 2004 15:59:56
Message: <413b703c$1@news.povray.org>
> Basically, then I'm left with a
> 1400x700 image (in x direction: 200+500+200+500, in y direction:
> 200+300+200) layed out in the wrap-around shape that the documentation
> shows.

Regardless of what size the sides of the box are, each box face in your
image must be 1/4 of the image width and 1/3 of the image height, as shown
in the image in the documentation. If you have some faces which are 200
pixels wide and some which are 500 pixels wide, they won't UV map onto the
box in any sensible way.

One solution: Take each of the individual faces in a 2D editor and resize
them to 200x200 pixels (this may make the images appear squeezed
horizontally or vertically, but that effect will be reversed when they are
placed on the box which is not 1x1x1 in size). Then composite them in an
800x600 image. This image should UV map properly without any
transformations.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Jeremy M  Praay
Subject: Re: uv_mapping around a box
Date: 5 Sep 2004 17:12:16
Message: <413b8130$1@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote in message
news:413b703c$1@news.povray.org...
> > Basically, then I'm left with a
> > 1400x700 image (in x direction: 200+500+200+500, in y direction:
> > 200+300+200) layed out in the wrap-around shape that the documentation
> > shows.
>
> Regardless of what size the sides of the box are, each box face in your
> image must be 1/4 of the image width and 1/3 of the image height, as shown
> in the image in the documentation. If you have some faces which are 200
> pixels wide and some which are 500 pixels wide, they won't UV map onto the
> box in any sensible way.
>
> One solution: Take each of the individual faces in a 2D editor and resize
> them to 200x200 pixels (this may make the images appear squeezed
> horizontally or vertically, but that effect will be reversed when they are
> placed on the box which is not 1x1x1 in size). Then composite them in an
> 800x600 image. This image should UV map properly without any
> transformations.
>


Thanks for the help.  I see how it works now.  As far as the image is
concerned, all sides are equal in size.

For any non-square box, that seems like a real pain.  I think I'll just map
the images onto each face of the box by creating each face separately and
not using uv_mapping.  That actually sounds easier to me than stretching my
images in strange ways.

-- 
Jeremy
www.beantoad.com


Post a reply to this message

From: Slime
Subject: Re: uv_mapping around a box
Date: 5 Sep 2004 18:02:31
Message: <413b8cf7$1@news.povray.org>
> For any non-square box, that seems like a real pain.  I think I'll just
map
> the images onto each face of the box by creating each face separately and
> not using uv_mapping.  That actually sounds easier to me than stretching
my
> images in strange ways.

Another option would be to define the textures for each face separately in
the <0,0> to <1,1> area, and then scale them and translate them to the right
place and composite all 6 into a single texture, which would be UV-mapped.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Bob
Subject: Re: uv_mapping around a box
Date: 7 Sep 2004 11:45:35
Message: <226pj01rbua1jm4c842gk4g8im4hhkfnqq@4ax.com>
On Sun, 5 Sep 2004 18:02:22 -0400, "Slime" <fak### [at] emailaddress> wrote:

>> For any non-square box, that seems like a real pain.  I think I'll just
>map
>> the images onto each face of the box by creating each face separately and
>> not using uv_mapping.  That actually sounds easier to me than stretching
>my
>> images in strange ways.
>
>Another option would be to define the textures for each face separately in
>the <0,0> to <1,1> area, and then scale them and translate them to the right
>place and composite all 6 into a single texture, which would be UV-mapped.
>
> - Slime
> [ http://www.slimeland.com/ ]
>

Hey!  That's a cool idea!  I've been doing it the hard way: making
a mesh by hand with two triangles for each face of the "box".  :D


Post a reply to this message

From: Jeremy M  Praay
Subject: Re: uv_mapping around a box
Date: 7 Sep 2004 12:30:13
Message: <413de215@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote in message 
news:413b8cf7$1@news.povray.org...
>> For any non-square box, that seems like a real pain.  I think I'll just
> map
>> the images onto each face of the box by creating each face separately and
>> not using uv_mapping.  That actually sounds easier to me than stretching
> my
>> images in strange ways.
>
> Another option would be to define the textures for each face separately in
> the <0,0> to <1,1> area, and then scale them and translate them to the 
> right
> place and composite all 6 into a single texture, which would be UV-mapped.
>


If I understand correctly, you're saying to do all of the scaling and 
translation in POV-Ray.  How would you code a texture like that (with 
image_map's)?  I can think of a possible way to do it by using "once" and 
then translating each occurrence and layering the textures.  Is that what 
you have in mind?  In theory, it seems like that would work.

-- 
Jeremy
www.beantoad.com


Post a reply to this message

From: Slime
Subject: Re: uv_mapping around a box
Date: 7 Sep 2004 15:56:27
Message: <413e126b$1@news.povray.org>
> I can think of a possible way to do it by using "once" and
> then translating each occurrence and layering the textures.  Is that what
> you have in mind?

Pretty much, yeah. It might slow down the texture evaluation since there
would be 6 layers. Or maybe you could use a texture_map with some sort of
function that easily divided up the XY plane into the 6 areas. Gradient
patterns could also be used.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Jeremy M  Praay
Subject: Re: uv_mapping around a box
Date: 7 Sep 2004 16:18:28
Message: <413e1794$1@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote in message 
news:413e126b$1@news.povray.org...
>> I can think of a possible way to do it by using "once" and
>> then translating each occurrence and layering the textures.  Is that what
>> you have in mind?
>
> Pretty much, yeah. It might slow down the texture evaluation since there
> would be 6 layers. Or maybe you could use a texture_map with some sort of
> function that easily divided up the XY plane into the 6 areas. Gradient
> patterns could also be used.
>

Thanks again for the help, Slime! (that sounds uncomplimentary, somehow.) 
I'll give this a try.

-- 
Jeremy
www.beantoad.com


Post a reply to this message

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