I've been meaning for a while to mess around with destructible meshes (they're way cool!). Making physically accurate destructible meshes is hard. Instead, I've opted for a simple scheme that still has great visual results for compact objects. The technique works like this:
Obviously, this technique has limitations. You can't break a mesh into more than two pieces at once, and the hole created by the split is a) not closed and b) pretty jagged. Jagged edges around the split is OK for wreckage. An open mesh also looks OK, as long as both the fronts and backs of triangles are rendered (i.e., turn off back-face culling). I have considered writing some code that will close the hole in the mesh by creating new vertices to cover the hole. However, this modifies the triangle buffer, which might not be good for performance.
I'm sure someone else has thought of it before. It's a pretty simple technique, but it still looks decent!
- Choose a plane to split the mesh along.
- Create two new meshes to hold the fragments.
- For each triangle in the mesh: if the triangle is entirely above the plane, add it to the first mesh. Otherwise, add it to the second mesh.
- Create a new scene node/rigid body for each of the fragments.
Obviously, this technique has limitations. You can't break a mesh into more than two pieces at once, and the hole created by the split is a) not closed and b) pretty jagged. Jagged edges around the split is OK for wreckage. An open mesh also looks OK, as long as both the fronts and backs of triangles are rendered (i.e., turn off back-face culling). I have considered writing some code that will close the hole in the mesh by creating new vertices to cover the hole. However, this modifies the triangle buffer, which might not be good for performance.
I'm sure someone else has thought of it before. It's a pretty simple technique, but it still looks decent!
Comments
Post a Comment