Search Unity

Accurate Run-time Dynamic Destruction

Discussion in 'Works In Progress - Archive' started by smb02dunnal, Feb 1, 2013.

  1. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    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.


    Here's the webplayers

    Tower of Boxes Demo
    Convex Destruction Demo
     
    Last edited: Mar 12, 2013
  2. The Cube

    The Cube

    Joined:
    Jan 29, 2013
    Posts:
    26
    This is incredible , well done and can't wait to see this finished and out.

    Best off luck. Happy gaming.
     
  3. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Really cool. I enjoy slicing the bricks apart. ;D
     
  4. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Excellent work. Looks fantastic.
     
  5. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Really well done, great job!
     
  6. GeneBox

    GeneBox

    Joined:
    Nov 15, 2012
    Posts:
    480
    This is amazing!
     
  7. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Thanks for all the support.

    If there are any features that you would like to see implemented then let me know and I'll do my best.
     
  8. xenius

    xenius

    Joined:
    Sep 30, 2010
    Posts:
    523
    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?
     
  9. FlyingRobot

    FlyingRobot

    Joined:
    May 5, 2012
    Posts:
    456
    Really awesome!
     
  10. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    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.
     
  11. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    255
    Hey there. That is pretty awesome. One question though, can you add a number that displays the current ammount of physical props that are moving?
     
  12. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    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.
     
  13. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    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.

    http://www.youtube.com/watch?v=4r2GnfaoIPQ

    So I take it that you are trying to implement a structural stress system?
     
  14. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Yes, that is the desired goal. I will upload another webplayer soon with a demonstration of this working.
     
  15. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
  16. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    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.
     
  17. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    255
    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...
     
  18. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439

    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. :D 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.
     
  19. cCoding

    cCoding

    Joined:
    Jul 3, 2012
    Posts:
    118
    This is amazing. Sadly my pc almost froze while trying the demo. I guess I need to update it again lol.
     
  20. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Great idea for a new feature, destruction quality settings. Seems kind of obvious but easy to forget if you have a beast! :)

    Thanks!
     
  21. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    Yeah I'm using joints. It did not lag for that one building, but when I tried applying it to a big airship structure, the framerate dropped a ton, and I wanted to apply destruction to all buildings in cities. I was getting the feeling it wouldn't work.



    Olafson : Yeah thats the best idea. Your building looks to be a bit high poly though with the sections. You might be able to get away with less detail on the peices, and make them larger. I would probably want to make the peices as large as what a small cannon would do if it hit. I'm going off battlefield 3 here, (since you'd think they know what their doing).
     
  22. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    255
    Well in my opinion the pieces are too large already. Especially for a small cannonball that in reality only blows a really small hole into the wall...

    Polygons are fine, the model itself has about 10.000 polygons which is totally fine in my opinion. If I want to have some destructible and precalculated (since thats the easiest way over Network...) objects, I have to count with a relatively high poly count. However, applying some instancing and a proper lod system will make it work quite well. Furthermore, our game is not going to feature any huge cities, which makes it easier aswell.

    Battlefield 3 actually has quite large "destruction zones" on most of their buildings. A single wall is split into 1, maybe 2 different objects. That is waaay to large for small destruction, as we want it. Obviously it is totally fine for BF3, since they only have big guns anyway...

    What I dream of is a easy way to make a building consist of hundreds of individual props, without having to model them all interdependently. Something like a texture map for the current material that tells a script where to cut the building into several brick pieces. But I guess thats just a dream...

    That sounds awesome. can not wait for it :)
     
  23. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    An update to everyone, I have just submitted the first part of the destruction suite (the box destruction as shown in the webplayer) to the store.

    There are two versions, the standard version, which comes with class libraries instead of source, and the pro version, which of course comes with source. They are priced $10 and $30 respectively.

    The asset comes with the demo scene I used for the webplayer, and some comprehensive instructions to get you set up with anything you need.

    Stay tuned for more updates as I have them.
     
  24. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    255
    Great. Looking forward to it.
     
  25. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Here's an update!

    That's the first version of this up on the asset store, here is the link : https://www.assetstore.unity3d.com/#/content/7193

    The pro version (with source code) isn't up yet, as I'm having a couple problems with getting the asset store tool to work right all the time. But hopefully this latest submit I've done get's it online!

    Some more news, I have been working on improving performance, and I have almost halved the computation time for generating shards, this will roll out in the next update after I do some more testing.

    More stuff coming soon ;)
     
  26. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
  27. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    It looks promising. Although the bridge appears a bit fragile. It would be better if the bridge was attached to the supports its on rather then stacked on top. Keep up the work!
     
    Last edited: Mar 7, 2013
  28. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    I put this demo together really quickly. Hopefully I will get some time soon, where I can build a nice scene to demonstrate this tool properly! :)
     
  29. sherlockturtle

    sherlockturtle

    Joined:
    Jan 23, 2012
    Posts:
    592
    That is amazing! Keep it up! Its so fun to play with >.<
     
  30. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
  31. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    It's pretty nice so far. However, I was hoping you would release a demo of a completely destroyable building. Is that possible with your system? Also, do you plan on continuing development?