> From: "Sam Hasinoff" <[EMAIL PROTECTED]>
>
> I would like to do cylindrical texture-mapping in Java3D but I have been
having problems with the seam area where the texture wraps around and meets
itself. The whole texture gets repeated a second time along a narrow
triangle-strip seam (the international date-line, using the earth.jpg
texture)...
>
> The problem is with the triangles that straddle the date-line - if the
s-components (the normalized angle around the z-axis) of the texture coords for
a given triangle are 0.98, 0.01, and 0.03 for example, then Java3D tries to fit
basically the whole texture in there. What I want is for Java3D to use some
common sense, and regard the 0.98 point as really being -0.02 (for that specific
triangle). Is there a straightforward Java3D way to do this? Or has this code
already been written somewhere?
The texture doesn't really repeat, it gets drawn "backwards" since it has
texture coordinates in the valid range:
0.01----0.98
| /
| /
| /
| /
| /
| /
0.03
Java3D just assigns the texture coordinates and renders the primitive.
You are correct in thinking that this triangle really should have coordinates
like -0.02, 0.01, 0.03 (or 0.98, 1.01, 1.03). You could then specify that the
texture is to repeat and you'd get the effect you want.
> What compounds the problem is that I'm using an IndexedTriangleStripArray for
the geometry, so manually going through and just "cloning" out the points that
are at fault (adding or subtracting 1.0 to the s-component as needed) is a
tricky problem... Help!
I suggest breaking the model into two pieces, each of which goes halfway around
the sphere. You can then handle the boundary cases by adding or subtracting 1.0
to the s-component.
Alternatively, you could identify the points along the boundary which need be
modified and add new points to the IndexedTriangleStripArray.
You should only be using the indexed primitive if it makes your programming
easier. Java3d is going to make a non-indexed primitive internally anyway (for
performance), so if you can solve your problem by going to a non-indexed
TriangleStripArray, that is probably the best solution, since it saves memory
too.
Doug Gehringer
Sun Microsystems
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/