Desiree Hilbring wrote:

> Where does Java3D start to map the texture? I thought it would be the
> (0,0) of the s,t coordinates, but that is not the case in my example.

I think you might be making some wrong assumptions somewhere.
Unfortunately I am running out of time to look at this as I fly back to
Oz in a couple of hours and then will be off on holidays for a couple of
weeks. If you can't fix it by 1st week of Jan, can you fire me a
reminder email and I'll take a look at it then.

> > are only guaranteed a maximum of 16 repetitions on a single polygon (ie S & T
> > cannot be any bigger than 16.0 for your texture coordinates).
> >
> Sorry Justin, but I do not get the point here, I thought the s,t
> coordinate have a range between 0 and 1. Could you explain that for me?

A texture coordinate defines how much of the texture is to appear to
that point. Let's use an example where you wanted to have a texture
appear twice on the side of a box. A normal texture, that completely
covers the side of a box would have the following texture coordinates:

1,0  +-----+ 1,1
     |     |
     |     |
     +-----+
0,0          0,1


As you say, the coordinate value goes from 0 to 1. A the point where the
value is 1, that means you have given it a range of the exact width of
the underlying image (1 - 0 = 1) so all of your texture image pixels
(texels) are transefered onto the surface of the box.

What you need to think here is what those values represent. Really they
are just way of saying "copy this percentage of the image onto this
surface". Another standard example is where you only want say half the
image to be textured on the box. To do this, you would set up the
coordinates to be:

1,0  +-----+ 1,0.5
     |     |
     |     |
     +-----+
0,0          0,0.5



So, if I can nominate fractional values to "clip" the texture to fit the
box, why not use values greater than 1? That clip is really just a
percentage multiplier. 0.5 says to give me half the image, so 2 would
say "give me twice the image" Back to our textbook case - what if I gave
you the coordinates:

1,0  +-----+ 1,2
     |     |
     |     |
     +-----+
0,0          0,2


Does this not say "give me twice the image on the horizontal axis"?

Ok, so what does "twice the image" mean? In the world of textures, that
basically says to copy the image twice, or just do a repeat. A value of
1.0 is the same as 0.0, so the part of the side of the box that goes
from 1.0 to 2.0 is really just an identical copy of the bit from 0.0 to
1.0.

Taken to it's logical extent, that means I could supply values of 256
and it would present a box where you get the same image wallpapered 256
times in that direction.

Back to the original email - wrapping takes memory. It also takes up a
lot of CPU/GPU time to do as you have to do lots of calculations to map
textures to 3D space. The OpenGL spec states that you can only expect
have a max texture coords of 16 - ie 16 wraps.

--
Justin Couch                         http://www.vlc.com.au/~justin/
Freelance Java Consultant                  http://www.yumetech.com/
Author, Java 3D FAQ Maintainer                  http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
                                              - Greg Bear, Slant
-------------------------------------------------------------------

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to