POV-Ray : Newsgroups : povray.unofficial.patches : uv_mapping image_map Server Time
2 Sep 2024 18:18:44 EDT (-0400)
  uv_mapping image_map (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
From: Phil Clute
Subject: Re: uv_mapping image_map
Date: 24 Dec 1999 18:49:41
Message: <38640692.8C0774A8@tiac.net>
Thanks, I'll take a look at the toolkit.
-- 
Phil
...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

From: TonyB
Subject: Re: uv_mapping image_map
Date: 24 Dec 1999 22:13:29
Message: <38643659@news.povray.org>
I've got an include for making flags somewhere around here. It works in
official pov, but could use some improvement. You'll have to wait 'til next
week to get it though.


Post a reply to this message

From: Ken
Subject: Re: uv_mapping image_map
Date: 24 Dec 1999 22:18:16
Message: <3864380C.6E1F92D8@pacbell.net>
TonyB wrote:
> 
> I've got an include for making flags somewhere around here. It works in
> official pov, but could use some improvement. You'll have to wait 'til next
> week to get it though.

http://www.geocities.com/CapeCanaveral/7999/

-- 
Wishing you Seasons Greetings, A Merry Christmas, Happy New Millennium !
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Charles
Subject: Re: uv_mapping image_map
Date: 25 Dec 1999 16:26:28
Message: <38653678.5B354300@enter.net>
I think I see what you're saying. I had the same problem when I was
experimentally trying to make a long, curling banner out of multiple
patches and wanted to map one image map across the full length of
it. What you want is that "uv_vectors" keyword on each of your
patches. There's an example in demouv2.pov that comes with the
sample files. First render it as it appears, then try changing
the line that reads...

uv_vectors <0, 0>, <1, 1>

to 

uv_vectors <.5, .5>, <1.5, 1.5>

and re-render, and it should become clear what this does and
how it can help with the "one image across several patches" 
problem. Should be ideal for flags.

Charles


Phil Clute wrote:
> 
> I found a thread on this before but I can't seem to find it twice...
> 
> I am trying to apply 1 image_map to 45 bicubic_patches but I am getting
> 45 image_maps applied to each bicubic_patch, some are even turned in the
> wrong direction.
> In the thread I can't seem to find now, Nathan mentioned using
> uv_vectors
> to correct this. But I'm not sure how this works. I tried fiddling with
> it
> but didn't notice any changes.
> I suppose I could try breaking up the image_map into several pieces and
> apply them individually to each patch but I'd rather learn how
> uv_vectors
> works.
> 
> For those who are curious I'm making a flag.
> 
> TIA
> --
> Phil
> ...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

From: Phil Clute
Subject: Re: uv_mapping image_map
Date: 27 Dec 1999 11:44:02
Message: <38679754.9F41B7AE@tiac.net>
I thought I tried this before, I must have
been doing something wrong.

thanks
-- 
Phil
...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

From: Charles
Subject: Re: uv_mapping image_map
Date: 27 Dec 1999 16:34:40
Message: <3867DA68.5ED8186D@enter.net>
Yeah, this is not easy to grasp at first, based on the demos and
docs currently out there. And if you're dealing with that many 
patches and trying to apply the uv_vectors by hand, you definitely 
have my sympathy! <g> I had a couple problem figuring out the right 
orientations for a 2x3 patch banner. 

Actually if you (or any one else here for that matter) would be
interested, I have what I consider a decent pair of sample demo 
files illustrating this process. It just consists of two POV 
files, and two small PNG files. One POV file uses a single flat 
bezier to demonstrate how to orient maps onto its surface, and 
the other is a pair of those 6 patch banners I mentioned above 
showing how to select uv_vectors to stretch the image across 
the complete banner. Let me know, and I can zip it up and put 
it out on my site for pickup if you'd like. 

Charles
-------
http://www.enter.net/~cfusner


Post a reply to this message

From: Phil Clute
Subject: Re: uv_mapping image_map
Date: 27 Dec 1999 21:37:04
Message: <38682250.4FBC9FE3@tiac.net>
>  Let me know, and I can zip it up and put 
> it out on my site for pickup if you'd like.

That would be great. I'm definately having a hard time figuring out
what direction everything wants to go in. It sometimes seems like 
changing the settings rotates the image. 
Some of the Bicubic patches display the image sideways and I can't 
figure out why. I guess maybe sPatch flips some ofthe patches but I'm
just guessing.

-- 
Phil
...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

From: Charles
Subject: Re: uv_mapping image_map
Date: 28 Dec 1999 18:08:09
Message: <3869421C.B8679D29@enter.net>
Phil Clute wrote:
> 
> >  Let me know, and I can zip it up and put
> > it out on my site for pickup if you'd like.
> 
> That would be great. I'm definately having a hard time figuring out
> what direction everything wants to go in. It sometimes seems like
> changing the settings rotates the image.

Ok. I've zipped the demo files and the png images that they use
and put them at...

http://www.enter.net/~cfusner/tutorial/uvbez.zip

> Some of the Bicubic patches display the image sideways and I can't
> figure out why. I guess maybe sPatch flips some ofthe patches but I'm
> just guessing.

(nods) Yup, I'd be inclined to guess that too. It all has to do
with which order the control points were specified in, so modellers
made before uv_mapping might have been too lax in the past with
the way they chose which points to output at the corners (since
it never mattered before). My second file uvbez.pov was initially
made in Moray (although for clarity's sake I swapped all the y and z
coordinates so it behaves like a regular left handed file), and 
Moray, for example, seems as if it outputs the mathematically lowest
corner of each patch first (although this could just be the 
particular application I put it to, dunno). This makes for an
odd orientation (I had to rotate and flip the image map to get it
right-side up), but at least its consistent, so once the orientation
is figured out it stays the same. If sPatch doesn't do something
similar... well, all I can say is "have fun!" <bg>.

Hope this helps!
Charles
----
http://www.enter.net/~cfusner


Post a reply to this message

From: Phil Clute
Subject: Re: uv_mapping image_map
Date: 29 Dec 1999 13:17:10
Message: <386A5026.894D90D9@tiac.net>
> Ok. I've zipped the demo files and the png images that they use
> and put them at...
> 
> http://www.enter.net/~cfusner/tutorial/uvbez.zip

Thank you

> If sPatch doesn't do something
> similar... well, all I can say is "have fun!" <bg>.
> 

I think I'm going to be having fun :(
I suppose I could arrange the patches manually so that everything
is in the right direction and just forget about sPatch. The flag
I have now is just for experimenting so I'll need to do it over
anyhow.
-- 
Phil
...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

From: Mike Wilson
Subject: Re: uv_mapping image_map
Date: 14 Jan 2000 16:26:58
Message: <387F944D.3F026E48@iastate.edu>
I started using UV-POV a few months ago when I did my "From the desk of
F. Mulder" image (posted to p.b.i.) primarily because I wanted to uv map
text on to slightly curved patches rather than a flat box for the pieces
of paper.  I managed to get it to work with a single bicubic_patch but
until recently I hadn't done any multiple patches.  Here's what I found
out, maybe it will help someone else.

I create all my patches by hand so that they are lying in the xz plane. 
It makes a difference in which order the points appear.  I chose to make
the code look something like the patch itself.  i.e. the first listed
line of points actually represents the four control points of the patch
that are furthest from <0,0,0> and the bottom line is the control points
that actually start at <0,0,0>.

Example:
bicubic_patch{
        type 1
        flatness 0
        u_steps 3
        v_steps 3
        uv_vectors <.666,0>,<1,.5>  //Lower Left Patch
        <0,0,1><.333,0,1><.666,0,1><1,0,1>
        <0,0,.666><.333,0,.666><.666,0,.666><1,0,.666>
        <0,0,.333><.333,0,.333><.666,0,.333><1,0,.333>
        <0,0,0><.333,0,0><.666,0,0><1,0,0>
              
uv_mapping                        
}
This patch would be part of a union{} with an overall texture using an
image_map, like this:

pigment{image_map{
        tga
        "f16hl.tga"
        once
        interpolate 2
        }
        rotate z*90 translate x*1 
}

The rotate and translate statements are necessary to align the image
properly.  I don't know why, but I assume it has something to do with
the internals of how the patch is stored.  This may be a case where I'm
making things harder for myself; perhaps if I defined the patch in the
xy or yz planes the image would line up properly without the
transformations, but I haven't tried it becuase I find the way I'm using
easier to visualize.

I create the other patches in a similar manner, just adjusting the
control points values so that the patches lie side by side.

I found, through trial and error, that the uv_vectors work as follows:

The u-vector has its 0 point at the far z-end of the patch and increases
as it moves in a negative z direction.

The v-vector starts at the lower left of the patch (as least as my
patches are defined) and increases as it moves in a positve x direction.
(crappy diagram follows)

0    ^    
|    |
|    z	
u    x->
|
|
1
0---v---1

If you keep in mind that this 0 to 1 range covers all the patches
regardless of how many there are, it becomes easy to figure out the
uv-vectors for any rectangle of patches in the xz plane.

For example, a union with 6 patches (2 in the x direction and 3 in z
direction) would use the following uv_vectors statments assuming you are
looking down on the patch as it lies in the xz plane:


<0,0>,<.333,.5>      <0,.5>,<.333,1>

<.333,0>,<.666,.5>   <.333,.5>,<.666,1>
 
<.666,0>,<1,.5>      <.666,.5>,<1,1>

Even though the docs say something how it doesn't matter if
transformations are applied before or after the the texture is put on, I
found that I need to scale the patches before applying the image_map to
correct the aspect ratio.  For example, with a 3 by 2 grid of unit-size
patches as shown above I need to scale them with  scale<2,1,1> before
applying a 640x480 pixel image_map.

Mike Wilson

Phil Clute wrote:
> 
> I found a thread on this before but I can't seem to find it twice...
> 
> I am trying to apply 1 image_map to 45 bicubic_patches but I am getting
> 45 image_maps applied to each bicubic_patch, some are even turned in the
> wrong direction.
> In the thread I can't seem to find now, Nathan mentioned using
> uv_vectors
> to correct this. But I'm not sure how this works. I tried fiddling with
> it
> but didn't notice any changes.
> I suppose I could try breaking up the image_map into several pieces and
> apply them individually to each patch but I'd rather learn how
> uv_vectors
> works.
> 
> For those who are curious I'm making a flag.
> 
> TIA
> --
> Phil
> ...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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