Sign in to follow this  
Scylexan

Mesh.Intersect

Recommended Posts

Scylexan    150
I was wondering if any knows how DirectX's Mesh.Intersect method works? I'm having some trouble searching for it. I'm trying to figure out how it actually performs the intersection tests and if it's faster than what I could write by hand. I would like to assume the developers of the API did a good job at accelerating the intersection tests and also that the tests are all ray/triangle tests; however, I never settle with just assumptions. Thanks.

Share this post


Link to post
Share on other sites
pogsworth    157
I don't have any hard facts for you, but I assume that they are just looping over all of the triangles in the mesh and doing a ray/tri intersect on it. I assumed this because it is rather slow for a large mesh (I used it for a while on some large terrain meshes). To speed it up, I wrote a KD-tree to divide up the triangles into smaller chunks and traverse that tree with the ray before looping over the tris that are in a small bounding box (leaf of the tree).

I can't think of how they would accelerate the intersect method unless they do some kind of hierarchy or grid to reduce the set of triangles to test with.

I haven't done any timings or tried to look at the code, so I am not absolutely certain, but I know my kd-tree is faster.

Share this post


Link to post
Share on other sites
Scylexan    150
Thanks for the reply.

I actually was planning on implementing a KD-Tree but just curious if I was ok with using the builtin intersect calls or would I be better off creating my own intersect method. Glad to hear that it made things faster for you, I'll have to give it a try.

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