Can Bepu handle a marching cubes terrain?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Jon
Posts: 1
Joined: Tue Mar 12, 2013 5:13 am

Can Bepu handle a marching cubes terrain?

Post by Jon »

Can Bepu handle a large, dynamically generated (But unmodifiable / static) terrain very well? If so, could someone point me in the right direction to get started? Right now I'm generating the mesh using Marching Cubes from a voxel array when the world is loaded. It can't be modified after it's generated in any way, so I won't need to recalculate anything.

Thanks :)

P.S. Awesome anti-spam measures on the registration form. Omega sure was kind to me. Does He accept new worshipers?
You start with fifty ducks. A tornado sucks sixteen of the ducks into its associated towering mesocyclone. Omega, the superintelligent alien Watcher, takes pity upon you and duplicates all of your remaining ducks. How many ducks do you now have?:
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Can Bepu handle a marching cubes terrain?

Post by Norbo »

Can Bepu handle a large, dynamically generated (But unmodifiable / static) terrain very well? If so, could someone point me in the right direction to get started? Right now I'm generating the mesh using Marching Cubes from a voxel array when the world is loaded. It can't be modified after it's generated in any way, so I won't need to recalculate anything.
Yup; the StaticMesh would be a good choice. The StaticMesh hierarchy reconstruction time is a little too slow for runtime modifications common in blockworldy games, but since you don't have any of that, it's just about perfect.

To use the StaticMesh, you'll need to have a vertex list and corresponding index list. The vertex list and index list conceptually act just like vertex buffers/index buffers in graphics. The index list provides the mesh with connectivity information to smooth out the boundary between triangles. So, if two triangles share an edge, they should have the same values for indices in the index list for that edge. An example of what not to do would be creating a big triangle soup where the vertex list and index list are redundant; this would kill off the connectivity information and coplanar triangle edges would have 'bumps'.

If you have a particularly huge world and the construction time is unacceptably long, you may find that separating it into multiple StaticMeshes is valuable. The construction time is O(nlogn), so you can get a little benefit from splitting it. Greater benefit can be achieved by taking the now-separate parts and running the constructions on different threads. If there are a lot of such individual StaticMeshes (hundreds or thousands), you may find that the broad phase performance suffers. At this point, bundling all the separate StaticMeshes into one big StaticGroup would be a good idea.

The BEPUphysicsDemos project contains a StaticMeshDemo and a StaticGroupDemo which show the setup of the above types.

Awesome anti-spam measures on the registration form. Omega sure was kind to me. Does He accept new worshipers?
Of course! Omega is always seeking new disciples willing to participate in testing of new forms of mortal-interference. Applicants should be aware of the potential for: disturbances in subjective experience, loss of the concept of identity, loss of individuality, loss of body, moral and information hazards, and potentially suboptimal monetary gains depending on the choices of the applicant.
Post Reply