Hi all!
I need your help with understanding of base concepts of destructible environment creation.
A little background. We build a 3D turn-based grid-based game in Unity, in which we want to achieve almost full environment destruction - walls, buildings, interior objects etc. (like old X-Com games but full 3D). This also need to allow partial object damaging (aka object hp). Also, our game would involve free aiming feature, so static fracturing may be a little off visually.
So, we've decided to try dynamic real-time mesh fracturing approach. As I understand from viewing a couple of resources on this topic, common method of dynamic fracturing involves Voronoi diagrams in some form. However, all approaches that i've seen lack some detail or I can simply have no needed background for understand it.
Here is how I understand pipeline right now, step by step:
- Generate a set of seed points inside mesh, which will be centers of Voronoi Diagram cells. It must be relatively easy, using impact point, force and some kind of predetermined “fracture pattern”, like Perlin Noise etc.
- Create Voronoi diagram from this set of seed points. Is this diagram need to be 3D or 2D? In most resources I saw 2D diagrams as examples, but then I don't understand, how to apply 2D Voronoi diagram to 3D mesh.
- Intersect created Voronoi diagram with mesh, create cuts on faces according to this intersection. Currently I don't know how to do it, but think that boolean operations will do the trick.
- Create new meshes, inherit and interpolate all texture, normal, color data etc.
- Fill cut mesh parts with new faces, using triangulation. Separater this new back faces in submesh and introduce some sort of “inner material" (or somehow battle with UVs, don't know how)
- For complex structures, consisting of many mesh chunks, create fixed joints, and collapse all structure when there is no connection to the ground (for example, if building level walls is crushed, all building will land down one level)
Can someone help me validate my understanding of entire pipeline, and provide resources or insight of where I need to start and how can I feel the gaps in my knowledge?