Strange texture wrapping results

Started by
2 comments, last by AndrewSmart 22 years, 1 month ago
Hi there, I don''t know if someone out there has seen this before... I am applying a texture to a mesh in Direct3D, using cylindrical texture wrapping (i.e. U-wrapping) The mesh is basically a cylinder. When I render the mesh, everything looks 100% correct if the mesh is not too close to the camera. As soon as the mesh gets close to the camera, I get all sorts of distortions and strange results on the texturing. If I then back off from the mesh again, it all goes back to normal ????? Some of the texture coordinates are > 1.0, but this shouldn''t matter should it ?? Yours puzzled, Andrew
Advertisement
Well, some screenshots would be usefull!

And no, it shouldn''t matter to set certain TexCoords > 1


Yesterday we still stood at the verge of the abyss,
today we''re a step onward!
Yesterday we still stood at the verge of the abyss,today we're a step onward! Don't klick me!!!
I''ll try to make some screenshots later tonight...

I just wondered if anyone had experienced a similar thing in principle...

Andrew
From D3D 8.1 Docs:
"
Enabling texture wrapping effectively makes texture coordinates outside the [0.0, 1.0] range invalid, and the behavior for rasterizing such delinquent texture coordinates is undefined in this case. When texture wrapping is enabled, texture addressing modes are not used. Take care that your application does not specify texture coordinates lower than 0.0 or higher than 1.0 when texture wrapping is enabled.
"

The reason for this is that texture wrapping causes D3D to treat 0 and 1 as coincident - when the texture coordinate reaches 1 it wraps back round to 0. Therefore coordinates outside this range have no real meaning and so stuff gets messed up.

For this reason, and also because OpenGL doesn''t support texture wrapping, I''ve stopped using wrapping in my programs. You can get the same effect by just duplicating the vertices along the ''seam'' of the cylinder, with one lot having the starting tex coord (eg 0) and the others having the ending coord (eg 1, or higher if you''re trying to tile the texture). I guess if you''re using streams then you dont even need to duplicate the points, just have two sets of texture coordinates.

Good luck
Cameron

This topic is closed to new replies.

Advertisement