POV-Ray : Newsgroups : povray.newusers : how to do simple uv mapping? Server Time
4 Nov 2024 23:20:17 EST (-0500)
  how to do simple uv mapping? (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Robert Günther
Subject: how to do simple uv mapping?
Date: 20 Sep 2001 15:24:20
Message: <3BAA426D.EBFC72A4@exmail.de>
ok,
you would think: what a stupid guy
but this is the first try to use uv mapping. i just want to wrap a
wordmap arround a cube. There are a lot of
tutorials, but i can't figure out the first step.
maby there is someone, who is patient enough with me and can explain,
how to wrap a 2d image arround a cube?

help is very appreciated!!

many thanks,

Robert


Post a reply to this message

From: Trevor Quayle
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 16:05:05
Message: <3baa4bf1$1@news.povray.org>
POV 3.1 or 3.5?

-tgq


--
camera{location z*13look_at 0}light_source{15 15looks_like{sphere{0 10
}pigment{rgb 1}finish{ambient 15}}}union{torus{3,0.5rotate x*90}cone{y
*4,.5,-y*8,0}cone{-x*4,.5,x*8,0}pigment{rgb<.7,.6,.4>}finish{ambient 0
diffuse 0reflection{1fresnel on metallic 1}}interior{ior 25}rotate 15}
plane{y,-7pigment{checker rgb 0rgb 1scale 4}finish{diffuse.1}}//   TGQ


Post a reply to this message

From: Robert Günther
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 16:23:56
Message: <3BAA5066.A827172F@exmail.de>
POV 3.5 beta2

robert

Trevor Quayle schrieb:

> POV 3.1 or 3.5?
>
> -tgq
>
> --
> camera{location z*13look_at 0}light_source{15 15looks_like{sphere{0 10
> }pigment{rgb 1}finish{ambient 15}}}union{torus{3,0.5rotate x*90}cone{y
> *4,.5,-y*8,0}cone{-x*4,.5,x*8,0}pigment{rgb<.7,.6,.4>}finish{ambient 0
> diffuse 0reflection{1fresnel on metallic 1}}interior{ior 25}rotate 15}
> plane{y,-7pigment{checker rgb 0rgb 1scale 4}finish{diffuse.1}}//   TGQ


Post a reply to this message

From: Trevor Quayle
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 16:49:03
Message: <3baa563f$1@news.povray.org>
3.5 does have uv mapping for boxes now.  The downfall of it is how the
texture is applied.  For perfect cubes, it works fine but for anything else
it the results are not what you would expect (or maybe they are what you
should expect though).  Look at section "6.7.7  UV Mapping".  For boxes, the
texture used is divided into 6 squares as indicated.  Anything lyingoutside
the limits of these squares is not used in the texture mapping. Note that
each square is 1x1 units.
 The face on the -x side uses the texture located in the square
<-1,0>-<0,1>, -z= <0,0>-<1,1>, +x=<1,0>-<2,1>,
+z=<2,0>-<3,1>, -y=<0,-1>-<1,0>, +y=<0,1>-<1,2>.
The problem is each of these squares is stretched to fit the corresponding
face of your cube, therefore if you have a box that is <0,0,0> to <2,1,1>,
the textures on the +/-z faces will be stretched, the aspect ratio is not
maintained. So if you have text wrapping around the box in this case, on the
x faces it will look fine but the z faces will look wunky.  Same with any
other type of texture or pigment.  Some places you may be able to get away
with it, but in textures that you want to keep the aspect ratio, it doesn't
work and I can't seem to find anything that tells me how to control it
otherwise (uv_vectors can only be used in bicubic patches and meshes).
If I am wrong here, someone else may correct me (I'd like to know myself).
Therefore the only real option in this case is to revert to using meshes,
even for boxes.
That's all for now, maybe later I (or someone else can brush over meshes and
uv mapping)

-tgq



--
camera{location z*13look_at 0}light_source{15 15looks_like{sphere{0 10
}pigment{rgb 1}finish{ambient 15}}}union{torus{3,0.5rotate x*90}cone{y
*4,.5,-y*8,0}cone{-x*4,.5,x*8,0}pigment{rgb<.7,.6,.4>}finish{ambient 0
diffuse 0reflection{1fresnel on metallic 1}}interior{ior 25}rotate 15}
plane{y,-7pigment{checker rgb 0rgb 1scale 4}finish{diffuse.1}}//   TGQ


Post a reply to this message

From: Robert Günther
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 17:16:52
Message: <3BAA5CCD.101724FC@exmail.de>
Many thanks for your  explanations.
That makes some things clear. Nevertheless, i can't figure out, how to activate
uv mapping on, let's say, perfect cubes (that's for the moment what i want.
Later on, i would use a super ellipsoide, but as i understood, there will arise
those problems you mentioned.)
What i tried is the following:

box {
  <-1, -1, -1>, <1, 1, 1>

    texture {
        uv_mapping pigment {
        image_map {
          sys "Earth3d.bmp"
          map_type 0
          interpolate 0
        }
      }
    }
  scale 10.0
  rotate <0,45,45>
}

but that gives me on every side of the cube the whole (the same) picture,  that
i want to wrap arround the whole cube.

Is there any possibility  that you can give me a piece of source code, so that i
can figure out, how it should work?

i'm really an absolute beginner on that topic

sorry,
and thanks for your patience!

Robert


Post a reply to this message

From: Trevor Quayle
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 17:34:29
Message: <3baa60e5@news.povray.org>
image_maps are positioned from 0,0 to 1,1 no matter what the size of the
original image is and by default, it will repeat itself every 1 unit
interval (unless you specify the "once" option), therefore you should be
getting the same image on every side of the cube. if you add "once" to the
image_map, you will only get it on the -z face of the cube.  What you need
to do her is to scale your image map.

Now remember that the uv map texture runs from -1 to 3 so scale your image
map by <4,1,1> and then translate it <-1,0,0> and add "once" to the
image_map.  The image should wrap around every face of the cube with the y
faces blank.  Now replace the scaling with <4,3,1> and the translate with
<1,-1,0> and see what you get.

The key to what you are doing here is the way image_map works.

> box {
>   <-1, -1, -1>, <1, 1, 1>
>
>     texture {
>         uv_mapping pigment {
>         image_map {
>           sys "Earth3d.bmp"
>           map_type 0
>           interpolate 0
             once  // add to prevent image from repeating
>         }
            scale <4,1,1> translate <-1,0,0> // scale and translate
image_map
>       }
>     }
>   scale 10.0
>   rotate <0,45,45>
> }


-tgq


--
camera{location z*13look_at 0}light_source{15 15looks_like{sphere{0 10
}pigment{rgb 1}finish{ambient 15}}}union{torus{3,0.5rotate x*90}cone{y
*4,.5,-y*8,0}cone{-x*4,.5,x*8,0}pigment{rgb<.7,.6,.4>}finish{ambient 0
diffuse 0reflection{1fresnel on metallic 1}}interior{ior 25}rotate 15}
plane{y,-7pigment{checker rgb 0rgb 1scale 4}finish{diffuse.1}}//   TGQ


Post a reply to this message

From: Warp
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 17:41:07
Message: <3baa6273@news.povray.org>

: i just want to wrap a
: wordmap arround a cube.

  You don't need uv-mapping for that.

  Read the help about image maps.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Trevor Quayle
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 17:51:00
Message: <3baa64c4$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3baa6273@news.povray.org...

> : i just want to wrap a
> : wordmap arround a cube.
>
>   You don't need uv-mapping for that.
>
>   Read the help about image maps.



I don't see what you mean in the docs.  Unless something is missing from
them, there is no option to use box mapping with image map and for text, I
don't think spherical or cylindrical would give the results one was looking
for when applied to a cube.  The only alternative would be to use a
different texturing method to apply the planar texture you wanted to each
face individually.  Am I missing something here as well?

-tgq



--
camera{location z*13look_at 0}light_source{15 15looks_like{sphere{0 10
}pigment{rgb 1}finish{ambient 15}}}union{torus{3,0.5rotate x*90}cone{y
*4,.5,-y*8,0}cone{-x*4,.5,x*8,0}pigment{rgb<.7,.6,.4>}finish{ambient 0
diffuse 0reflection{1fresnel on metallic 1}}interior{ior 25}rotate 15}
plane{y,-7pigment{checker rgb 0rgb 1scale 4}finish{diffuse.1}}//   TGQ


Post a reply to this message

From: Robert Günther
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 18:09:30
Message: <3BAA6923.74768649@exmail.de>
haven't read the help about image maps so far (ok, my fault).
But nevertheless, although it may not necessary for tha twhat  i wanted to do
'til now, Travor helped me a lot to understand the handling of uv mapping ;-)

Robert

Warp schrieb:


> : i just want to wrap a
> : wordmap arround a cube.
>
>   You don't need uv-mapping for that.
>
>   Read the help about image maps.
>
> --
> #macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
> rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
> ],13),8)-3,10>#end blob{N(array[6]{11117333955,
> 7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Robert Günther
Subject: Re: how to do simple uv mapping?
Date: 20 Sep 2001 18:10:35
Message: <3BAA6965.A9A35BBD@exmail.de>
thanks for your help!
i will try it.

Robert

Trevor Quayle schrieb:

> image_maps are positioned from 0,0 to 1,1 no matter what the size of the
> original image is and by default, it will repeat itself every 1 unit
> interval (unless you specify the "once" option), therefore you should be
> getting the same image on every side of the cube. if you add "once" to the
> image_map, you will only get it on the -z face of the cube.  What you need
> to do her is to scale your image map.
>
> Now remember that the uv map texture runs from -1 to 3 so scale your image
> map by <4,1,1> and then translate it <-1,0,0> and add "once" to the
> image_map.  The image should wrap around every face of the cube with the y
> faces blank.  Now replace the scaling with <4,3,1> and the translate with
> <1,-1,0> and see what you get.
>
> The key to what you are doing here is the way image_map works.
>
> > box {
> >   <-1, -1, -1>, <1, 1, 1>
> >
> >     texture {
> >         uv_mapping pigment {
> >         image_map {
> >           sys "Earth3d.bmp"
> >           map_type 0
> >           interpolate 0
>              once  // add to prevent image from repeating
> >         }
>             scale <4,1,1> translate <-1,0,0> // scale and translate
> image_map
> >       }
> >     }
> >   scale 10.0
> >   rotate <0,45,45>
> > }
>
> -tgq
>
> --
> camera{location z*13look_at 0}light_source{15 15looks_like{sphere{0 10
> }pigment{rgb 1}finish{ambient 15}}}union{torus{3,0.5rotate x*90}cone{y
> *4,.5,-y*8,0}cone{-x*4,.5,x*8,0}pigment{rgb<.7,.6,.4>}finish{ambient 0
> diffuse 0reflection{1fresnel on metallic 1}}interior{ior 25}rotate 15}
> plane{y,-7pigment{checker rgb 0rgb 1scale 4}finish{diffuse.1}}//   TGQ


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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