Sign in to follow this  
Reggie

WeldVertices causing tu, tv corruption

Recommended Posts

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:

Share this post


Link to post
Share on other sites
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):

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this