WeldVertices causing tu, tv corruption

Started by
3 comments, last by Reggie 19 years, 4 months ago
When I call weld vertices on a mesh it seems that vertices with different tu, tv coordinates get welded by mistake. That is textures render correctly if I don’t weld but get smeared on some faces when I do weld. I have ensured the WeldEpsilons structure contains zeros for everything including weldEps.TextureCoordinate which I thought meant vertices with differing tu, tv shouldn’t be welded. How can I eliminate completely identical vertices but keep vertices whose only difference is tu, tv ? I’m creating a mesh, locking its buffers, filling it, un-locking the buffers, then calling:

int[] adj = new int[3*nFaces];
mesh.GenerateAdjacency( 0, adj );
WeldEpsilons weldEps = new WeldEpsilons();
mesh.WeldVertices( WeldEpsilonsFlags.WeldAll, weldEps, adj, adj, out faceRemap, out vertexRemap );

Here's an image of the problem:
Advertisement
It looks like you've clamped the texture (i.e. forced it to only display between 0 and 1). I've never used WeldVertices, but look for something like "repeat."
I've ensured the texture addressing isn't set to clamp (tried wrap and mirror) at your suggestion, but this doesn't fix the problem. Also as my textures are fine when not welding this shouldn't be the problem. The above picture is at the intersection of a couple of faces (not one face with clamped texture):
From the DX SDK:
"D3DXWELDEPSILONS_WELDALL
Weld together all vertices that are at the same location. Using this flag avoids an epsilon comparison between vertex components."
(this is from the c++ sdk help, but that shouldn't matter).

Since you're using WeldAll, I think the behaviour is exactly what you're telling it to do.
Sirob Yes.» - status: Work-O-Rama.
Thankyou sirob. That was the problem. Well now I feel stupid. I'm going to have to update my managed directX help as it doesn't have many explainations. I should have checked the C++ SDK though.

This topic is closed to new replies.

Advertisement