Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Motorherp

Optimizing D3D meshes

This topic is 5278 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

Hi there people, I was wondering if anyone could help me please. I am attempting to create a collision engine for convex geometry based on the Voroni clip algorithm. In order to simplify the code and be able to traverse between adjacent features efficiently I require that each feature be unique (ie no duplicates). The convex geometry class I have written takes a D3DXMESH as an input from which it creates its features (and voroni regions). However I have noticed that many vertices are duplicated in the mesh''s vertex buffer leading to feature degeneracies, even for simple objects such as a cube created using the D3DXCreateBox function. I have tried using the mesh optimize and optimize in place functions but they dont remove these duplicate verticies (unless of course Im using them wrong). Does anyone know if directX has any built in functionality to perform this kind of operation or will I have to create my own? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
The MeshView program with the SDK has a weld vertices option that may do the trick

Share this post


Link to post
Share on other sites
Cheers for the reply but I''ve solved the problem and it was just me being silly. Still not quite used to this direct x stuff. The D3DXCreate* functions make non-indexed meshes and my .x loaded meshes weren''t working correctly because I had a DWORD pointer looking at the index buffer instead of a WORD pointer. Doh.

Share this post


Link to post
Share on other sites
Duplicate positions will happen when the vertex needs to be split because of UV mapping, or normals (for sharp creases in the mesh), among other reasons.

If you want no duplicates, you should re-map the position data into a welded array yourself after loading. It''s really quite simple to do using, say, binning on the X coordinate, or hashing. Or just plain O(N^2) search -- probably will be lost in the noise.

Share this post


Link to post
Share on other sites
Thanks for the ideas. The main area of confusion however was that I assumed the D3DXCreate* functions created indexed meshes which they dont. As you say it is often necessary to duplicate verts in meshes for rendering purposes. However these meshes are often far to complicated to use for collision detection. For anyone interested in implementing a similar collision system I suggest creating purpose built simple collision meshes. This way the number of collision checks are reduced and vertex degeneracy can be avoided in the modelling package. Just dont do what I did and assume you can use the D3DXCreate stuff as a quick check. Very confusing. Then again they're designed for rendering so (for the box at least) it was appropriate for it duplicate the verts. Just not got my thinking cap on

[edited by - motorherp on June 5, 2004 5:16:18 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!