I just want to post my progress on the destruction feature I presented in my DX11 competition entry, Fluidity
Still a lot to do, but the demo below shows the basic jist of it.
I plan on releasing this on the Asset Store in the near feature, once I make it into a more polished tool.
The algorithm uses voronoi partitioning to calculate the shards at run time based on a set of input points. The result is perfect for imitating objects with a very low tensile strength, like concrete or glass.
Planned Feature Set
Online dynamic primitive mesh destruction.
Online dynamic convex mesh destruction.
Offline pre-computed destruction for any mesh. (I’m planning on getting this working for mobile).
Dynamic UV generation for shattered object interiors. There are a couple ways to do this, not settled on one yet though.
Multi generation shattering. So shards themselves can shatter recursively.
Physics triggers, shattering triggered by collision impacts and other special events.
GPU Rigidbody simulation using compute.
If I have missed something that you might like, let me know.
This sounds incredible. I have a quick question about the fracturing. I know unity’s convex hull collider only supports i think 255 tris. Is there any smart way of ensuring a fractured piece doesn’t exceed this limit and thus lose its collision capability? I imagine this fracture style could produce some fairly complex shapes?
It looks nice although the demo only shows a stack of cubes. Could this be applied to a brick wall or solid structure and have the destrucion behave realistically? Like calculate structural weaknesses.
The destruction uses a voronoi algorithm. The beauty of voronoi is that it will create convex segments automatically by nature. This allows me to use a fast convex hull algorithm to get the mesh, at this point I can choose how many vertices/tris to use. The only downside is that I have to pass my nicely computed convex hull to a Unity MeshCollider, which computes it again pointlessly.
Currently I can achieve this effect by making a building from rigidbodies and joints, each with a destruction script on it. I want to include a much simpler way of setting this up in my tool.
Added it to the control panel for you, check it out. You get up to about 800 bodies in that demo.
I have tried using joints for destruction as well. However I found it to be laggy when attempting to do large structures. Here is a test I done before if your curious. Scroll to the end of the video at about 2:05.
So I take it that you are trying to implement a structural stress system?
That’s awesome. Unity doesn’t have any advanced destruction except for flying debris and what not. It would be nice to have something like Geo-Mod. I tried building a destruction system before that handles structural integrity, but its a bit complex and cumbersome.
Yes, Geo-Mod is amazing. I would like to bring something similar to unity in the form of this tool.
Your tests look okay, I much prefer the first video though! Are you just using joints? How come they are laggy as you mentioned previously?
If it came down to it I would write my own simple joint that would do the job. I might end up having to do this anyway depending on how costly it would be to have a whole building made up of these joints.
Making hundreds of buildings made out of individual bricks will take a lot of time though, and I doubt that anyone will do that. Nor do I believe that it will perform very well, no matter what you do to increase the performance… (?)
What I could imagine though, is creating buildings out of several larger props. Similar to the system we want to use in our game:
As you can see, each of the small lines seperates one object from another. These objects then could get destroyed by your destruction system. It is easy to create a building like that, it only takes a few minutes longer than creating a usual building. Making it out of several thousand individual bricks though, will not only be annoying but also take a lot longer to make…
This is a very common way to do things, but it still requires some offline design/modelling (which is good if you have a spare artist at your disposal).
Not only do I want to offer a tool that will break large objects up for you inside unity, but I also am working on a way of doing this completely at run-time using some very clever trickery. I will have another demo up fairly soon demonstrating this.
I probably should of mentioned this earlier, but the brick demo is the first, very primitive step towards what I want the finished result to look like.