Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Fracture - Dynamic Destruction System

Discussion in 'Assets and Asset Store' started by smb02dunnal, Apr 5, 2013.

  1. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Sorry I've not posted anything, or updated in a while. I've just moved house and not had internet for a long time!!!

    But I have still been working away. Got lots of new features in the pipeline!
     
  2. tombali

    tombali

    Joined:
    Jun 7, 2012
    Posts:
    132
    Great tool, thank you :)
     
  3. Gatto_matto

    Gatto_matto

    Joined:
    Feb 15, 2011
    Posts:
    60
    Looking forward to try this. My game project is called "Destroyer". So this tool is perfect. Great job!

    Just one question: can I destroy buildings with some cubes inside that stand for floors and pillars?

    Thanks
     
  4. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Yes, you certainly can, it doesn't have to be cubes anymore either! Any convex mesh will do.
     
  5. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Support for this is coming, I'm currently working on some GPU based optimizations that will solve the only major issue (as far as I'm concerned right now) which is frame rate and how it's linked to the number of shards. Let me assure you though, that after I've submitted my latest improvements, that will be the least of your concerns. ;)

    As for breaks being to clean, there's nothing stopping you solving that problem. For instance, you could use tessellation to improve the visual quality of the edges using a noise lookup, or do a similar thing with POM shading.
     
  6. MegaStevenLP

    MegaStevenLP

    Joined:
    Feb 27, 2013
    Posts:
    69
    Can you release a limited free version?
     
  7. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    how is the project for this going? Are we able to destroy fully textured and modeled buildings? It would be nice to see another video. If you want I can provide a building model.
     
  8. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Yes, the LITE version is becoming free as we speak! :)
     
  9. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Hey, if anyone can supply me with models of stuff they want to see smashed. Sure, please send! Manage your expectations though, I am not superman, there is a limit to whats possible.
     
  10. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    Here is a building I made very quickly. I wasn't sure how to model it exactly so it works with the destruction system, but hopefully it does.
     

    Attached Files:

  11. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    It's quick, and it's dirty, and it has highlighted some crucial problems with my newer tools (not yet released). Thanks for that! And without further Big Ass Building Demol

    I was really rushed putting this together, but you get the jist of it. No optimization, just threw the script on a mesh (after altering it to remove some quads that have no volume, thus cannot shatter properly).

    Each "section" gets fractured into less than 20 fragments. All your UV's are kept intact and new UV's are placed on the inners.

    It should be noted that this new fracturing technique might be available soon, the reason it's taking so long is I'm writing it all in C++ (although the webplayer version is using the C# counterparts) the C++ version is considerably faster and is parallelized using tbb.
     
  12. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    What happened to the windows and the inside of the building? The demo looks ok. There's still some flaws like chunks that should fall because there's barley anything holding them up. And it gets pretty laggy when the destruction starts happening. Keep at it though.
     
  13. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    Good job my friend, i have the lite version but i cannot access the custom trigger, can you help me?
     
  14. MerlinWoffSwiss

    MerlinWoffSwiss

    Joined:
    Jul 20, 2013
    Posts:
    2
    Hi great work
    I have a question: Can you make a simple textured house in the lite version?
     
  15. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    What do you mean?
     
  16. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Do you mean, can you destroy house model with the free version... No :)
     
  17. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    Can this work with raytrace?
    Can you provide a demo with raytrace?
     
    Last edited: Sep 6, 2013
  18. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    What do you mean by raytrace sorry?
     
  19. Al-ras

    Al-ras

    Joined:
    Oct 19, 2012
    Posts:
    3
    Hi!
    It looks nice!, i've the lite version and make some tests. Questions: It only works with box shaped objects? Or this is a limitation of the Lite version.
    Now, i only need to destroy simple buildings in my game, mostly rectangular houses. But in the future i want to go a little deeper and make it more complex. Can i fracture objects of any shape ? is it possible to specify the inner texture of the chunks?

    Thanks and keep working like that!
    Cheers!
     
  20. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Hi, thanks for trying.

    Yes the LITE version only handles boxes. But the PRO version will handle any convex mesh.

    Future versions include the ability to specify inner materials but unfortunately it's not ready yet :(
     
  21. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    615
    hello! with this does it offer parameters to change how something breaks. like glass or stone or wood?
     
  22. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    I have done the whole process correct (i use lite) but i cannot access the trigger component on the cube to call the function.
     
  23. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Do you have a code example?
     
  24. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    Well i just tried to test it. I created a new script and wrote in Start():

    GameObject.Find("Cube").GetComponent<Trigger>().TriggerDestruction(par1, par2);

    But it says it can't find the Trigger Component. Also please could you explane me the parameters again? I didn't understand them from the doc.

    Thank you.
     
  25. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    This looks amazing! Does it have any support for dynamic slicing?
     
  26. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    If I remember rightly Triggers are in a namespace, so you will have to use the fully qualified name.
     
  27. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Not as of yet, I plan to release an update early next year though, it would be simple to include such a feature.
     
  28. BooBi

    BooBi

    Joined:
    Jan 18, 2010
    Posts:
    534
    Hi,

    I just bought the pro version, and I'm having issue with all your demo projects.
    For example on your Shatter - Structural, On play, I get 999+ errors saying that there is no MeshCollider attached to the "Shad" game object.

    The error come from the script Shard.cs, line 28 -> meshCollider.convex = true;
    As there is no Meshfilter component and no mesh attached to the shard, it can't create the meshcollider and if I click on the object to break it I get the error No Meshfilter attached to the "Fractured shard" gameobject, but you try to acces it in the following scripts: Shard.cs line 18 and line 56 and BaseFracture.cs line 323 and line 176.

    I get the same problem when I try to follow your quick tutorial in your documentation in an empty scene with your shardpool, a cube with the boxfracture.cs and a plane as the ground. I get 801 errors, 800 being the no MeshCollider attached to the "Shad" game object from shard.cs line 28 and one error saying No Meshfilter attached to the "Fractured shard" gameobject, but you try to acces it in the following scripts: Shard.cs line 18 and line 56 and BaseFracture.cs line 323 and line 176.

    What am I doing wrong ?

    Thanks a lot for your help

    Boris
     
  29. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439

    Hi Boris,

    Sorry I just got a chance to look at this, I have been away for the Christmas period and I'm just back! :D

    Hmmm... Sounds as though it may be a problem with the tool as a result of some Unity update as I haven't changed the code in a long time and it was obviously working once upon a time.

    I've had a wee look, and have a fix for you.

    In the "Shard.cs" script, on lines 26 27 the following lines of code should be there:
    Code (csharp):
    1.            
    2. meshFilter = GetComponent<MeshFilter>() ?? gameObject.AddComponent<MeshFilter>();
    3. meshCollider = GetComponent<MeshCollider>() ?? gameObject.AddComponent<MeshCollider>();
    4.  
    Change those to:
    Code (csharp):
    1.  
    2. meshFilter = GetComponent<MeshFilter>() == null ? gameObject.AddComponent<MeshFilter>() : GetComponent<MeshFilter>();
    3. meshCollider = GetComponent<MeshCollider>() == null ? gameObject.AddComponent<MeshCollider>() : GetComponent<MeshCollider>();
    4.  
    My guess is that Unity has done some dodgy stuff that's resulted in GetComponent having a slightly different behavior under the ?? operator... Which should just be a null conditional... Any takers from Unity? I'll need to file a bug report about this.
     
  30. BooBi

    BooBi

    Joined:
    Jan 18, 2010
    Posts:
    534
    Thanks a lot for your reply and your help. It works now!
     
  31. peter_field

    peter_field

    Joined:
    Sep 4, 2013
    Posts:
    6
    Hi smb02dunnal ,

    Fantastic work by the way. I had a few questions about the Lite version of Fracture, as I am unsure weather I need to get the full version for a feature that I want.

    Is it only possible to fracture a mesh once, or can you chip away at a brick multiple times? It seems like once you fracture a an object it is deleted and replaced with a load of fracture shards.

    In the structure demo it looks like a large mesh that can be fractured multiple times. Is this possible in the full version of Fracture or is the house made of lots of little meshes that are attached together somehow?

    $Destroyed Building.png

    Cheers,
    Peter
     
  32. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    In that demo, the house is prefractured and the structural integrity calculations are made offline. Then at run time, the pre fractured shards can be fractured again dynamically.

    This is a feature of the pro version sorry.
     
  33. peter_field

    peter_field

    Joined:
    Sep 4, 2013
    Posts:
    6
    No worries, thanks for the quick reply. :)

    So fractures can never be fractured further, but if I got the Pro version I could pre-fracture a large mesh and chip away at the corners to achieve the effect I want?

    Also, are the fracture sizes based on the force of the impact? So small hits chip tiny bits off the mesh and large hits knock huge chunks off?

    Cheers,
    Peter
     
  34. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    No worries, yes that's the jist of it. :)


    Yeah, the size of the shards are proportional to the force of the impact.
     
  35. peter_field

    peter_field

    Joined:
    Sep 4, 2013
    Posts:
    6
    Thanks smb02dunnal, I cant wait to start playing around in Fracture Pro. :)
     
  36. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Ok, so here's how I understand your system:

    There are two fracturing systems: the dynamic fracture at runtime and the pre-calculated fracturing in the editor.

    The dynamic fracture system will fracture a given mesh, once the requirements have been fulfilled, into a number of shards (determined by the force of impact), of which none can be fractured further.

    The pre-calculated system allows you to select a mesh in the editor and designate it for fracturing (presumably with configurable requirements), upon which a new object composed of dynamically fracturable meshes is created.

    Is this correct?


    How does your system interact with prefabs? If were to create a structure out of several meshes, pre-fracture them, and create a prefab, how would the system react?

    Would it be possible to set up your system such that on a raycast hit pre-fractured shards are detached from its connections and then fracture? I'm aiming to simulate the effect of a powerful laser.
     
  37. peter_field

    peter_field

    Joined:
    Sep 4, 2013
    Posts:
    6
    Hi smb02dunnal,

    How are you pre-fracturing your mesh? Are you using an external program to split the mesh before you import it into Unity?

    Cheers,
    Peter
     
  38. tbg10101_

    tbg10101_

    Joined:
    Mar 13, 2011
    Posts:
    191
    Does the pro version have the ability to fracture shards? I guess what I really want is for the shards to be fractured infinitely but the smaller the shard, the stronger it is (and thus harder to fracture) to control the number of shards.

    Also, how easy is this to hook into Unity's built-in networking? (probably not that hard but I want to ask before purchasing)

    EDIT: I realize that posts above say that shards can't be fractured further but perhaps you can take this as a feature request?
     
    Last edited: Jun 9, 2014
  39. jaijai76

    jaijai76

    Joined:
    Aug 5, 2013
    Posts:
    21
    i don't have the pro version yet but im wondering if i can make my gun break the objects into the shards. the bullets from my gun are ray cast, i don't know how to trigger the destruction, currently using lite.
     
  40. jaijai76

    jaijai76

    Joined:
    Aug 5, 2013
    Posts:
    21
    forgot to mention my ray cast adds force to rigid bodies, it works on all rigid bodies but not the fracture able ones or shards. since all objects with the script are rigid bodies will i be able to make a skyscraper with multiple floors and objects inside without it falling over due to it being a rigid body. don't know if this is possible but couldn't you just make the shards that are broken off rigid bodies and not the structure its self, this may help with lag because as you mentioned above the rigid bodies create a lot of the lag.

    last thing, is there a way to make the shards that have been broken off render to not be visible and there rigid bodies go idle when the player is a certain distance away, not sure if this would make the object they came from go invisible and rigid body idle as well.
     
    Last edited: Apr 9, 2014
  41. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Is this asset no longer supported?
     
  42. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Sorry guys, yes it's still supported. It seems I stopped getting notifications from Unity for this thread! :(
     
  43. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Not that hard I would say. It may require some tweaking if you wanted to make the generated shards deterministic across the network... Although not impossible! Let me know if you'd like this and can do some testing for me.
     
  44. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    The prefracturing is actually done using the latest version of fracture... In which you can fracture any mesh (not just convex ones). Also I've added a neat offline fracture tool, which preserves UV's etc...

    I've been working on making this run time efficient as well, but it will likely end up being a PC only feature to start off with.
     
  45. JanCDS

    JanCDS

    Joined:
    Jun 30, 2014
    Posts:
    15
    Hi, your Fracture system looks really promising, but I was wondering is there a way to store a destruction event (a building collapsing for example) and then playing that as an animation to save on CPU/GPU power? I'm talking about something similar like the "levolution" events in Battlefield 4. Smaller structures/objects would still need to be calculated and displayed in real time though. Any thoughts on this?

    Greetings
    -Jan from CDS
     
    Last edited: Jul 1, 2014
  46. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Sounds like a pretty cool idea!

    And sounds like it would be really handy... Let me see what I can do.
     
    JanCDS likes this.
  47. JanCDS

    JanCDS

    Joined:
    Jun 30, 2014
    Posts:
    15
    I was actually also wondering exactly how flexible is it in terms of materials? As from the demoes i've seen and used. The structures/objects fracture like glass, stone or the like. How would it handle for example the rupturing of metal from a shipping container?
    Also, how well would this work on a moving object? As currently we're making a sci-fi mecha/infantry combat based fps. And the mech's have armor that breaks down and loses "hitpoints" Is there a way to keep track how much you've lost of a single armor plate? The addition of this system would add a lot to our game both visually and in terms of mechanics.
    Lastly is there a way to limit the amount of pieces on screen at a time? Getting rid of the smallest parts, or changing them to a static object? Again like my previous post, this is mainly to keep cpu/gpu strain as low as possible, as I don't have the greates desktop in the world.

    Greetings
    -Jan from CDS
     
    Last edited: Jul 4, 2014
  48. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Its voronoi fracturing, so its really geared towards materials like stone and glass sorry.

    You could track how many pieces a single piece of armour has broken into sure.

    There are some tools which cone with fracture which allow you to control how long the broken pieces hang around for and whether to keep then while they are offscreen.
     
    JanCDS likes this.
  49. JanCDS

    JanCDS

    Joined:
    Jun 30, 2014
    Posts:
    15
    Alright, thank you. I'll certainly be picking up Fracture Pro when I get the funds to do so. Until then, I'll keep messing around in Fracture Free.

    (p.s.: I was actually wondering, how does this affect navigation meshes? Is there a way to know, like hey I can't walk here anymore cause this building fell over?)

    Greetings
    -Jan from CDS
     
    Last edited: Jul 4, 2014
  50. LanceShields

    LanceShields

    Joined:
    Aug 13, 2014
    Posts:
    1
    Will the LITE version ever see shard lifespan? This is a nice framework, however as a student doing a project for a class, the buildup of shards is really damaging to the performance of this game.