Jump to content
  • Advertisement
Sign in to follow this  
raytaller

Spatial mesh splitting

This topic is 4440 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, I'm working with a big terrain which is not generated from a heightmap, because it can't (it isn't topologically equivalent to a plane). For now, it's a big Mesh object loaded from an X file. I would like to split it in spatial regions, ie smaller meshes with differents LOD. I have found a lot of articles on how to perform ROAM with heightmapped landscapes, but i can't figure how to split my mesh (the directx Split function takes a number of vertices in argument, not a dimension). Should I read the Mesh vertex/index data, and build custom pieces of the original Mesh ? I was planning to use the DirectX Simplify method, since I'm not sure to be able to implement a simplifying algorithm myself. Should I then rebuild Mesh objects from the splitted pieces of the original mesh ? Are the splitting / simplifying operations usually performed at the start of the engine, or before, by the game designers let's say, with external tools or Max scripts for example ? Thanks a lot.

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure if this is what you are asking, but maybe pick axis aligned planes to split your mesh down the "averaged" middle to cut it into two halves with approximately equal vertices. Then apply the same split method on the two split halves to get 4 quarters. Continue recursively until some minimum vertex count is reached.

Share this post


Link to post
Share on other sites
Thanks for answering.
But how to split the mesh ? Do you create new smaller Mesh objects or..?
I can't figure how concretely how to do it.

Share this post


Link to post
Share on other sites
A simple solution is to break the mesh up into an array of quadrants (like 256 faces by 256 faces) as the program starts up and before you start rendering. Then in the rendering loop you select which quadrants to draw by doing a frustum test to determine if one of the four corners of the quad is within the view frustum. This requires you to build planes for the view frustum and do point versus plane tests.

Share this post


Link to post
Share on other sites
Okay, but then, how should I split the mesh ?
What do you think about this :

- allocate 256*256 resizable arrays
- for each quadrant
- for each triangle in indexbuffer unassigned
- if triangle is in quadrant then assign it to the quadrant
- rebuild a mesh object from the triangles assigned to the quadrant
- clean and optimize the mesh
- simplify it in some LODs


I know this code will be slow as hell. Then, i should think about save the computed meshes in a file.
What do you think about it ?

Share this post


Link to post
Share on other sites
Well, I've tried to implement the algorithm but it's really too slow.
Is there a common way to implement spatial partitioning of complex meshes ?

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.

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!