Jump to content
  • Advertisement
Sign in to follow this  

D3DXIntersect Function

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

I have a couple of questions about this function. First, from reading the documentation found here,

http://msdn.microsoft.com/en-us/library/bb172882(v=vs.85).aspx

It seems this function requires the entire mesh to be made from triangles. Is this true? A mesh made from Quads would not work with this function correct?

Second, how does this function query and choose the triangle that a ray intersects with? Does it iterate through every triangle in the mesh or only a subset? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement

I have a couple of questions about this function. First, from reading the documentation found here,

http://msdn.microsof...2(v=vs.85).aspx

It seems this function requires the entire mesh to be made from triangles. Is this true? A mesh made from Quads would not work with this function correct?


[color=#1C2837][size=2]Second, how does this function query and choose the triangle that a ray intersects with? Does it iterate through every triangle in the mesh or only a subset? Thanks in advance!


1) Well quads are made from two triangles unless your using some fancy software renderer.

2) My guess it would just iterate through the data but use some algorithm to just iterate through a small area near where the ray would be relative to the mesh?

Share this post


Link to post
Share on other sites

It seems this function requires the entire mesh to be made from triangles. Is this true? A mesh made from Quads would not work with this function correct?


Yes, this function only operates on triangle meshes. If you have a quad mesh, you need to preprocess it to split it down to a triangle mesh, before creating a ID3DXMesh out of it. If you exported your mesh to .X format and load it in using D3DX functions, this will have happened automatically, even if the mesh originally did have quads in it in the modelling software.




Second, how does this function query and choose the triangle that a ray intersects with? Does it iterate through every triangle in the mesh or only a subset? Thanks in advance!



I doubt ID3DXMesh generates any kind of acceleration structure to optimize ray intersection queries, so it will simply iterate through every triangle of the mesh to find the closest triangle intersection. At least I've never seen the D3DX documentations state otherwise. If anyone knows the docs to mention anything about this, it would be nice to know.

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!