|
(You'll want to use a fixed width font to view
this article)
First, use textures with transparent
backgrounds, and make sure their boundary pixels are
transparent.
Second, use DECAL texture mode.
Now, for each texture, supply the geometry
with texture coordinates that stretch the
texture's transparent border over those coordinates that you don't
want textured, and stretch the texture over those coordinates that you do want
textured.
If done properly, the textures will not interfere
with each other, and will be positioned properly.
Example:
Consider a TriangleStripArray with 6
coords:
(0)---(2)---(4)
| / |
/ |
| / |
/ |
|
/ | / |
(1)---(3)---(5)
Now suppose we want a texture of a circle to map
to the left rectangle (i.e., the rectangle formed by 0, 1, 2, and 3), and a
texture of a square to map to the right rectangle (i.e., the rectangle formed by
2, 3, 4, and 5). The texture coordinates you should supply to the geometry
follow.
Circle's corresponding texture
coordinates:
(0,1)-(1,1)-(1,1)
| /
| / |
| / | / |
| / | /
|
(0,0)-(1,0)-(1,0)
Square's corresponding texture
coordinates:
(0,1)-(0,1)-(1,1)
| /
| / |
| / | / |
| / | /
|
(0,0)-(0,0)-(1,0) Thus, the circle is mapped to the left rectangle,
and its right edge is stretched across the right rectangle. Similarly, the
square is mapped to the right rectangle, and its left edge is stretched across
the left rectangle. That's why it is important that the edges of the
texture are transparent and you are using DECAL texture
mode.
There are many similar tricks, I leave them to
you to figure out.
Note that each texture is still
being applied across the entire geometry. So, if used unwisely, this
technique could cause a significant performance problems.
-Stoney
|
- [JAVA3D] put a Texture ones on an object??? Martin Frey
- Re: [JAVA3D] put a Texture ones on an object??? Stoney Jackson
- Re: [JAVA3D] put a Texture ones on an object??? Martin Frey
- Re: [JAVA3D] put a Texture ones on an object??? Carlos Vieira
