Jump to content
  • Advertisement
Sign in to follow this  
Reggie

WeldVertices causing tu, tv corruption

This topic is 4951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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."

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!