Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[Released] DestroyIt - Cinematic Destruction System

Discussion in 'Assets and Asset Store' started by DeadlyAccurate, Jun 14, 2014.

  1. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    We just finished putting together a Getting Started tutorial video. In the video, I start with an empty scene and pull only the first person controller and GameManager from the demo scene, then get to work making the free Shanty Town Refrigerator model destructible.



    The next tutorial video will pick up where this one leaves off and we'll dive into making a destroyed prefab, triggered damage effects, a custom fallback particle, and more.

    If you can think of a specific DestroyIt video you'd like to see, or think would be helpful to others, let us know!
     
    Danirey likes this.
  2. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    518
    Hi,

    I'm making a game featuring fully destructible environments(almost…) And i'm looking for the right way to achieve that without a huge hit on the performance. You have combined pretty feel particles, textures and fractured objects. Will you add some fracturing utility in the future? I think One of the most time consuming jobs when you want to break objects( a lot of objects) is to actually create those pre fractured versions of all your objects. A great feature for your asset could be a couple of ways to fracture an object inside unity and make a prefab for it. It could be a rich solution for the cause! ;)

    Right now, i'm working in the vehicle destruction. (In my case only static vehicles are needed since it is a turn based game) I love what you have done with the SUV! Have you created custom models for the broken parts too?

    Anyway good job! I'm following your progress.
     
  3. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    I would love some kind of automated way to pre-fracture objects.
     
    Danirey likes this.
  4. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Hey guys,

    Thanks for the comments. I would love to add a fracturing system to DestroyIt. I was actually working on one months ago, where you could click on a game object that had a mesh and select "Fracture It!" from the menu and it would fracture it with a voronoi pattern and put mesh colliders and rigidbodies on each piece. Then you just drag the fractured game object to the project view to create your destroyed prefab. After a month or two of working on it, I had a *very* simple version.

    But my version had issues with even mildly complex geometry:
    • When faces were not closed on all submeshes, it wouldn't identify mesh chunks correctly.
    • It wouldn't detect and separate mesh islands correctly. For example, if the black "U" below is a mesh, and the red line is where it fractures the mesh...

      ...then you'd want the two top mesh "islands" to be separate game objects that each get colliders and rigidbodies, but my algorithm treated them as one object. Detecting these types of mesh islands and separating them was difficult.
    • I would often get fractures that resulted in tiny "chips" you could barely even see. I needed to find a way to ignore fractures that resulted in tiny pieces and re-fracture that slice in order to reach the desired number of chunks-per-mesh.
    I quickly realized that any fracturing system I created would need to support a lot of options and fracturing variety in order to be useful. I was looking at a LOT of work, and even if I could come up with something good, I'd have to raise the price of DestroyIt to make it financially viable.

    Couple that with free products like Blender's built-in Cell Fracturing plugin, and it just didn't make sense for us to spend so much development effort to make a worse version. And we would never be able to compete with RayFire or PulldownIt. So in the end, we decided to shelve the idea and focus on what we're good at.

    That being said, we're not opposed to adding a pre-fracturing system to DestroyIt, if we can figure out a way to do it reasonably. We're open to suggestions or ideas. Or I could do a tutorial video on using Blender to fracture a model, if that would be helpful.
     
    Last edited: Sep 18, 2017
    Gekigengar likes this.
  5. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Blender has a built-in automatic prefracturing plugin? Awesome! Did not know that. Yes a tutorial on how to use it with your asset would be super helpful.
     
    zangad likes this.
  6. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    One thing to consider with any auto-fracturing tool is that it's only going to do cell fracturing or something similar. You can't get the kind of destruction that the SUV was destroyed into without doing it by hand. Auto-fracturing is great for breaking rock, concrete, walls, etc., but it's a lot less realistic to break a car into voronoi chunks.
     
  7. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    The only custom model we created from scratch was the engine. There would have been nothing under the hood, otherwise. We thought it'd be cool if you could see an engine in there, and if it could be damaged and billow smoke.

    There were several other places where I "filled out" a model in order to create the destroyed version. For instance, for the tire I cut out the front and back wheel area and then created geometry to fill in the inner part of the wheel.



    That way, we could have a tire that pops and leaves the metal wheel/rim behind:

     
    Danirey likes this.
  8. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    518
    Nice!

    Thanks for all your explanations!
    I understand the complexity of a fracrurig system, so don't worry. The way you are handle this is 100% correct! :)

    In my project i used a pre fractured 3d model for walls and things like that, but now i'm trying to achieve certain level of destruction with cars which has nothing to do with walls destruction. I suppose there is no easy/cheap way to get it done :p

    Thanks a lot and good work!
     
    zangad likes this.
  9. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    I just finished making a tutorial video on how to Cell Fracture a model in Blender, and how to import the destroyed model back into Unity and use it as a destroyed prefab for DestroyIt. Enjoy!

     
    eridani and Danirey like this.
  10. Darth Buyer

    Darth Buyer

    Joined:
    Dec 15, 2014
    Posts:
    6
    Hey!

    Great Package. I am having issues with the Material_Preload. I can see the damage being reflected in the inspector. Yet, live in game I get inconsistent results with my own mats. I have the debug on yet am getting no errors whatsoever.

    Thanks
     
  11. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    Is your Material_Preload folder under \Resources? All the materials that use the DestroyIt shaders have to be in the Resources folder. Also, when you run the scene, you can look on the Material Preload script on the game manager and see if it made multiple damage-level versions of the material in question.
     
  12. Darth Buyer

    Darth Buyer

    Joined:
    Dec 15, 2014
    Posts:
    6
    Thanks for the speedy reply:

    So the /Resources/Material_Preload/ is in its correct place.

    The MaterialPreloader script finds the mat in the Material_Preload/ directory when the scene is not active, yet when the scene is started it no longer finds my material.

    The multiple damage levels are viewable when slider is moved.

    To be more specific, it actually disappears out of the script upon activation of the scene.
     
    Last edited: Dec 16, 2014
  13. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Hey Darth,

    While the scene is running, check to see what the DamageMaterial script on your Destructible object has in the Damage Level Materials field. You should see four materials in the array, one for each damage stage:



    As your object takes damage, it should switch to one of these materials, based on its current damage level (20%, 40%, etc).

    The most common reason for this not working is your material is not in the Resources\Material_Preload folder. It's happened to us many times, when we've made a new material and we're wondering why it doesn't display progressive damage.

    Another troubleshooting thing you might try: assign one of the DestroyIt DamageLevel materials (like Marble-DamageLevel) to your destructible object, just to see if the progressive damage works with that material.
     
  14. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Oh, one other thing that might help - if you're still having trouble take a look at the Tutorial #1 - Getting Started video. I go through the process of taking the refrigerator's material and making it have progressive damage levels.

    Skip to the part where progressive damage begins (4:47):


    If you're already doing all of that, let us know and we can continue troubleshooting.
     
  15. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    I just spent 20 minutes trying to figure out why I wasn't getting progressive damage myself, only to realize I was missing the MaterialPreloader script in the Destruction Manager. So that's another thing to look into.
     
  16. Darth Buyer

    Darth Buyer

    Joined:
    Dec 15, 2014
    Posts:
    6
    Awesome pictorial :) Still no luck. I have followed the steps in the vid (right when I bought the package, thanks for posting).

    So I was missing the DamageMaterials. Yet, it made little difference. I was able to resolve the MaterialPreloader not finding my mats by removing it and re-adding it to the _GameManager prefab.

    Steps:

    * Repulled _GameManager prefab from demo.
    * Used default (provided mats) - Works
    * Mirrored settings from examples
    * Rewatched Vids
    * Tested with multiple mats
    * Loaded demo scene and pulled my fabs in

    Edit: 20min later.
    It just started working. It started to work when I removed the DamageMaterials script from the object. I will work out what I have been doing wrong and post results; but am sure it is a user issue :)

    Really do appreciate all the help provided!!

    One more question. I am creating fractured walls and would like to re-parent the progressive damage state to the child object upon destruction. Do I need to rip the mat off my fractured wall?

    Regards and thanks again!!
     
  17. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    We're not 100% sure how to answer your question - I think we need to know more about the effect you're going for.

    By default, if you have a destructible wall and set Replace Materials on the Destructible script to replace the destroyed wall's materials, it will automatically transfer the progressive damage, too. It just grabs the destroyed version (material #4 in DamageMaterials script's array) of each material and transfers them to the destroyed pieces:



    But I'm not sure from your question that that's what you're going for. What does your wall object's hierarchy look like?

    Example:
    Wall (destructible)
    -- Child Wall Piece (not destructible, gets unparented from the Wall when Wall is destroyed)
    -- Child Wall Piece (not destructible, gets unparented from the Wall when Wall is destroyed)

    If you're doing something like that, then yes, you'll need a small script to transfer the Wall's progressive damage state to the children's materials, since there's nothing really linking them together.

    However, if I wanted to do broken child pieces like that, I'd probably do it with cling points or the chip away debris feature. Cling points would leave some broken pieces of wall clinging to the ground and surrounding structures, and the progressive damage materials would get transferred automatically for you when you setup your Replace Materials section. The only overhead would be setting up the cling points.

    But again, it depends one the effect you're going for. Feel free to send us a sample of what you're working on and we'll take a look at it and see if we have any ideas. (support@modelshark.com)
     
    Last edited: Dec 17, 2014
  18. Darth Buyer

    Darth Buyer

    Joined:
    Dec 15, 2014
    Posts:
    6

    Thanks again for all the help!!

    I got it all figured out for the most part. I am using your system in conjunction with another fracturing system and countless number of prefabs. So have a very strange workflow with your system. I fixed my issues by simply duplicating the mat at its highest damage state and transferring to that upon destruction. I have begun to play with the cling points a bit, as is needed for stacking walls for desired effect. Let you know how it goes!

    Looking forward to your next packages (planned launch day?)! Your team has done a great job and really have the best product on the market. Will definitely be picking up the next pack.

    Would love to see:

    * collision detection for progressive damage
    * blood/flesh/torn effects for adding damage to enemies (already added to AI characters was a pretty neat test. really just needs the right damage textures/masks, if collision detection is added, it'd be just about perfect.)

    Keep up the good work and I'm more then happy to keep throwing monies at you guys!!
     
    zangad and DeadlyAccurate like this.
  19. Darth Buyer

    Darth Buyer

    Joined:
    Dec 15, 2014
    Posts:
    6
    Y'all were lacking in reviews. Added to your 5* :) Well done and thanks again.
     
    DeadlyAccurate likes this.
  20. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    Thanks so much! If you have any more questions, please don't hesitate to ask.
     
  21. Darth Buyer

    Darth Buyer

    Joined:
    Dec 15, 2014
    Posts:
    6

    Hey Guys!!!
    I am running UFPS and would love to get this working yet I get failures. I tried updating the references (as they looked out of date, still no luck.) What do I need to do?

    Thanks,
    Darth
     
  22. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    We'll need some more information before we can attempt to help.

    What are you doing when the failure occurs, and what is the error message?
    Is the failure on UFPS's side or DestroyIt?
    Are you importing DestroyIt into a project with UFPS already installed, or are you importing UFPS into a project with DestroyIt already installed?
    Which versions of UFPS and DestroyIt are you running? (You can find the version number on the asset store page just above the screenshots).
     
  23. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    583
    Hi,

    this asset looks not bad. Could i use it for a multiplayer based RTS game? Mostly for destroying buildings and trees.

    I have my own damage causing and damage taking script, i just need to control the damage texture and the beginning of the mesh destroying and the destroyed parts lifetime. The meshes are about 5k - 20k. It must be fast (shouldn't eat too mich FPS), shouldn't be too accurate and shouldn't create too much game objects at exploding, because they have to send over internet.

    I saw it is well suitable for tree and building destruction, i guess the car destruction would be too expensive for an RTS game.

    What is your opinion, does it make sense to use it for an RTS as destruction system?

    Thanks for your answer in advance
     
  24. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    583
    Hi,

    i bought this asset and i like it. One thing what i missing is, the object destroying behavior for RTS games. The palm tree destruction is a good example. At destruction the tree object is destroyed by replaceing it with a second tree object and the second tree object stay until the pool reaches it max. capacity. This is good probably for an FPS game, but an RTS game would like another behavior. For an RTS game the second game object must lost its collider (after a short time) and it should be able to set a timer for Destroy(palm2). In the time of until destruction a simple tree animation, e.g. moving the 2. tree prefab slowly down and fading out, would be acceptable.

    I didn't found in your documentation any hints for this feature, is the described behavior possible? If not, i can write this by myself, its not a big deal, because i dont have to change much in your code.

    Thanks for your answer in advance.
     
  25. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Yeah, I think it would work fine for an RTS game. An RTS usually has a lot more objects, which can be expensive, but on the plus side those objects usually have much lower poly count and use simpler (and fewer) colliders.

    For destroying a building in a multiplayer RTS, I would only send across the wire that the building has been destroyed, and let it play out on each client separately. It means a building may crumble and fall differently on each player's system. To have it crumble in exactly the same way on each client would mean passing location/velocity/rotation information across the wire for each debris piece - way too chatty. Doing it this way also allows you to scale performance for each client, so one player may see a beautiful crumbling building with smoke and lots of debris with shadows, another may see the same building destroyed as a particle effect, and a player on a super low-end computer may see it just disappear.

    For a destroyed tree, I might send the falling tree top's location across the wire to all clients, depending on whether it's important where the tree lands in my game. If it could smash a nearby building, then it's probably important to keep its location in sync with all clients.

    For the damage texture, you might take a look at our progressive damage shaders and handle it that way. For an RTS, you could make a grungy "burned out" texture and have it progressively applied over buildings/tanks/etc to show damage. In my experience using Unity and DestroyIt, the mesh poly counts generally aren't as important as the number of colliders, particle effects (especially ones that use reflective/transparent shaders), and shadows. So you could have a lot of debris on each client, but don't communicate the debris over the wire unless it's important. Also, making the debris fade out over time (with the DestroyAfter script) or get collected (with the DestructionManager debris pool) is also important.

    Yeah, the level of destruction with the SUV wouldn't fit every game. Still, you could achieve similar results by converting the SUV's debris pieces into mesh particle effects, and making multiple levels of destruction with your destroyed prefabs. So the undamaged SUV would have 20% of the total hit points. When destroyed, a Damage Effect particle plays a door flinging off and a window shattering, and the object converts to the destroyed prefab (the next "stage" of destruction) with 20% hit points. When that one is destroyed, it converts to the next destruction stage, and so on:



    Coupled with particle effects, I think it could look pretty cool, and it wouldn't be very processor/graphics heavy.
     
    Last edited: Sep 18, 2017
  26. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    We used to have a script named FadeOut that did this. After a specified number of seconds, it would strip off all colliders and rigidbodies from the object and fade it out. So you could put the script on the destroyed object at the parent level and it would handle fading out all the child objects.

    The reason we removed it was because in order to fade objects out, we had to switch the current shader on the object with a transparent shader. Transparent shaders eat up a lot more resources, and fading out hundreds of pieces of semi-transparent debris was causing poor performance. Also, when rigidbodies and colliders are stripped off, it causes objects that were resting on those pieces of debris to shift. So a destroyed building's rubble would shift and settle over and over until all the debris was gone, and we thought it looked a little weird. Admittedly, that was a special case though, and might not crop up in "normal" play.

    So there are a couple of options - if you just want to destroy the debris after a set amount of time, you can put the DestroyAfter script on your destroyed object at the parent level, and it'll take care of it. Or you could re-pool the object with the PoolAfter script, although you would need to reset the destroyed prefab before re-pooling it. And lastly, I can dust off the FadeOut script, re-tool it for the current version of DestroyIt, and post it here for you guys to use if you want to try to use it. I can probably have it ready tomorrow, just let me know.

    Oh, and thanks for your support!
     
    Last edited: Jan 11, 2015
  27. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    583
    Thank you for the detailed answers. This is the tool i want exactly for my damage system.
     
  28. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    I've updated the FadeOut script to the current version of DestroyIt, but in doing so we realized we need to create a few more Transparent progressive damage shaders, specifically TransparentBumpedDiffuse and TransparentBumpedSpecular. So I didn't get it finished today, but I'm shooting for tomorrow.
     
  29. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Here's a small Unity package that contains the FadeOut script and the TransparentDiffuse progressive damage shader for anyone who's needing this feature now. For everyone else, this feature will be rolled into the next DestroyIt update, along with a bunch of Transparent progressive damage shaders to assist with the fading transition.
    (link removed - this feature is part of DestroyIt now)

    How it works:

    You put the FadeOut script on the destroyed prefab you want to fade out, set the delay (After Seconds) and fade-out time (Fade Length), and it will fade out that object and all debris under it, as well as stripping off all colliders and rigidbodies (if they are sleeping). So once the debris starts fading out, it doesn't impede movement or take up as many physics resources.

    And here's a quick video I made of me testing the feature out. In the video, I put the FadeOut script on a couple destroyed prefabs and then shoot the objects up, and you can see the debris fade out.

     
    Last edited: Sep 18, 2017
  30. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Hi all,

    The "SUV Showcase" demo scene (included in DestroyIt) is now available on our website as an interactive web demo. Have fun blowing it up! :)

    Our current web demos:



     
  31. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    583
    Hi,

    thank you for the FadeOut script!. I had have trouble with the new FadeOut script, didn't work well with trees. Based on the FadeOut script i created the FadeDown script, which brings the feature to move down the object (in my case a tree) through the terrain in fading state. If a game object has no transparency, then the script doesn't create any similar shader for it (tree has cut out shader and that was filled by the shader replacement, strange...). Moving slowly down the terrain always works.

    Settings for the tree replacement (Destroyed tree on the Destructible script.):

    For testing, use the default values on the script, add a capsule collider to the tree along the trunk and add a Rigidbody with Mass 300, Drag 8, Angular drag 0.5 and freez the Y-Rotation.

    Zangad, you can use the script freely (change it for your needs), please put it in the next version somehow. I wouldn't send here any code, but you did it, so i did it based on it too. This script ment to be for a strategy game, where we dont want any garbage on the map.

    Just one question:

    I use the same tree for the replacement (as destroyed tree), which is not well optimized as replacement. I would just need to deactivate the Kinematic option on the Rigidboddy after the collision and activate the FadeDown script. Is it possible somehow, or am i have to extend the Destructible script for that?
     

    Attached Files:

    Last edited: Jan 16, 2015
    zangad likes this.
  32. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    DestroyIt 1.2 is now available on the Unity Asset Store.

    Changelog:

    Enhancements

    • Added FadeOut script. When attached to a destroyed prefab, strips colliders and rigidbodies from debris after a set amount of time and fades them out with a transparent shader.
    • TGA texture files converted to .PNG format. (Saved 105 MB on the package download size.)
    • Added three new damage masks, "Random Growth", to give you more variety for progressive damage.
    • Transparent Reflective progressive damage shaders were improved to enhance the look of the damage. This can be seen in the shattered glass effect in the demo scenes.
    • New shattered "safety" glass texture and normal map added.
    Fixes
    • Changed "Debris" layer to "DestroyItDebris" to resolve a conflict with UFPS, which uses a layer by the same name but for a different purpose.
    • You can now save/load your ObjectPool entries if you have renamed your DestroyIt - Core folder.
    • HUD in the demo scenes can now be turned on/off independently of the targeting reticle.
    • Impact rigidbodies (like the cannonball) will now have their momentum correctly maintained when destroying an object as a particle effect.
    • Removed back face on Glass Pane in demo scene and fixed UV stretching issue on a couple of the broken shards. This also fixed the glass shards flickering when they fall.
    • Fixed a lighting issue with Specular progressive damage shader - it was darker than the Bumped Specular version.
    • Fixed Scenario #10 in demo scene, where sconce bulb was "flashing out" even when not tagged as Powered.
     
  33. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Sorry about that, I didn't test the FadeOut script with the tree in the demo scene. I see what you mean though, when it starts to fade the branches lose their alpha cutout and look like opaque planes.

    To fix this, we added the "Transparency" property to the DestroyIt\VegetationSwaying shader. Since nature shaders already use alpha cutouts, this shouldn't add any performance hit. We'll be including the updated shader in the next version of DestroyIt, but if anyone needs it now, here it is:
    (link removed - this feature is part of DestroyIt now)

    So now destructible vegetation that uses this shader fades out properly with the FadeOut script:



    That's a great idea! Thanks for the script modifications. I see what you're doing, stripping off the colliders and leaving the rigidbodies so the debris falls through the ground. I like that, definitely good for a zoomed-out, top-down style RTS game, and it solves a lot of issues that switching shaders causes. I think I'll add it to the FadeOut script as an option - you select which style of fading out you want: 'transparency' or 'fall through ground', and then you get the appropriate options for that selection. I'll put this on my to-do list for the next version.

    So, you want the object to sink into the ground without instantiating a destroyed prefab? If so, add this code to the
    ProcessDestruction() method in the DestructionManager script, line 176:

    Code (CSharp):
    1.             // OPTION: LET DESTRUCTIBLE OBJECT SINK THROUGH TERRAIN FOR DESTRUCTION INSTEAD
    2.             // First, turn Kinematic off for all rigidbodies under this object.
    3.             Rigidbody[] rbodies = oldObj.GetComponentsInChildren<Rigidbody>();
    4.             for (int i = 0; i < rbodies.Length; i++)
    5.             {
    6.                 rbodies[i].isKinematic = false;
    7.                 rbodies[i].WakeUp();
    8.             }
    9.             // Next, strip off all colliders so it falls through the terrain.
    10.             Collider[] colliders = oldObj.GetComponentsInChildren<Collider>();
    11.             for (int i = 0; i < colliders.Length; i++)
    12.                 colliders[i].enabled = false;
    13.             // Attach the DestroyAfter script to the object so it will get removed from the game.
    14.             DestroyAfter destAfter = oldObj.gameObject.AddComponent<DestroyAfter>();
    15.             destAfter.seconds = 5;
    16.             // Exit immediately - don't do any more destuction processing.
    17.             return;
    18.             // END OPTION
    Here's a video of the effect, with a quick how-to for anyone else who needs this behavior:

     
    Last edited: Sep 18, 2017
  34. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    171
    Great assets! Looking to buy but have two questions.

    1. How hard would it be to have the debris be "cubed" shapped
    2. To be clear, I can apply this to any mesh and shadder? I am trying to do a ambient occlusion shader and was wondering if it would work with that type of shader.

    Thanks :)
     
  35. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    Thank you.

    You could have cube-shaped debris, but you'd either have to use a 3D modeling program to make a destroyed version of your model that has been sliced into cubes, or use a single cube duplicated within a game object. For example, I did this

    ** Photoshop removed 3rd-party hosting for images, and these images appear to have disappeared from the site **

    By using one Unity cube as the undestroyed object, then 27 cubes to make up the destroyed version.



    If you needed to preserve the UVs on the destroyed model (such as if you had a picture on the sides), you'd need to create a destroyed version in a 3D modeling programming.

    If you want our progressive damage (cracks that grow as the model takes more damage), you'd have to use our DestroyIt shaders, but otherwise, yes, you can use any shader you want. If you have Shaderforge, you could use one of our shaders as a base to make an AO progressive damage shader.
     
    Last edited: Jul 3, 2017
  36. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Bought this after playing the demo and the blender tutorial was EXTREMELY helpful. Just how quickly and efficiently you taught me something. Going to watch the other vids. Not sure if you have one about how you made the SUV (I'm at work right now so haven't read all the posts in this thread yet), but that would be a great one - even just a basic overview and workflow. Getting excellent performance in the demos, nice workflow. Really excited about this asset. Ah, almost forgot the damage modeling on the cube I always wondered how that was done and that's a great bonus. Gotta figure out how to make it fade away over time if you don't break it completely, but that will be a good lesson learning that.

    Edit - Also found that free "Detonator" asset for awesome explosions. Time to blow some S*** up!
     
    Last edited: Jan 31, 2015
  37. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Thanks for the kind words - you made our day. :)

    The next video on my to-do list is Part 2 of the Getting Started tutorial, to finish up the refrigerator destruction with mesh fracturing/deforming and custom particle effects. I'd like to do a video for the SUV, but I wouldn't be able to do that one in Blender, since we do our modeling work in MODO. But I like your idea of basic overview and workflow - it might at least provide some insight into the process and get someone started in the right direction.

    You can use the FadeOut script (mentioned earlier in this thread) on any object, it doesn't have to be broken/destroyed. So I would probably extend the Destructible script's DamageEffect code to allow you to assign any MonoBehaviour as a damage effect - not just particle effects. That way, you could assign the FadeOut script to the object at, say, 60% damage as a damage effect, and it would fade away regardless of whether it was destroyed or not. Just an idea.

    Wow, those are some nice explosions. It looks like they've been significantly updated since I last saw them a while back. He also has a web demo on his website...very addictive. :)
    http://benthroop.com/detonator/
     
  38. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Hey everyone,

    A customer had a question about how to do a road-cracking, "burrowing" effect, and while it's not directly related to DestroyIt, I can see others needing to do this type of destruction, so I thought I'd share the solution here.

    Here's a video of the effect. The road would need to be textured of course, and you might want to fracture it into smaller pieces depending on your game, but hopefully you get the idea:


    To accomplish this effect, create a simple rectangle mesh in a modeling tool and cell-fracture it (tutorial on cell-fracturing in Blender). Then in Unity, mass-select the fractured pieces and add kinematic rigidbodies and mesh colliders to them. Then add a trigger collider to the scene that will pass through the fractured pieces, turning off kinematic and adding some explosive force as it passes. That's it!



    Collider Code:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class MoveSphere : MonoBehaviour
    4. {
    5.     private void FixedUpdate()
    6.     {
    7.         transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z - .25f);
    8.     }
    9.  
    10.     public void OnTriggerEnter(Collider other)
    11.     {
    12.         if (other.rigidbody != null && other.rigidbody.isKinematic)
    13.         {
    14.             other.rigidbody.isKinematic = false;
    15.             other.rigidbody.WakeUp();
    16.             other.rigidbody.AddExplosionForce(250f, transform.position, 2f, 2f);
    17.         }
    18.     }
    19. }
    Here's a working project with a fractured mesh and code if you want to see how it's done in more detail or use it in your game:
    http://www.modelshark.com/content/misc/roadbreaktest.unitypackage
    (Note: you're free to use the model/code contained within the RoadBreakTest package in your own commercial or non-commercial projects royalty-free.)
     
    Last edited: Sep 18, 2017
  39. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    DestroyIt with Photon Unity Networking

    There was a question from a customer about how to get DestroyIt working with Photon PUN. We did some research and came up with step-by-step instructions on getting a simple demo scene working with Photon. We did a multiplayer test across Photon's free cloud-hosted network, and we were able to see both progressive damage and simple particle effect destruction of the boxes.



    If anyone else is looking to get Photon working with DestroyIt, here's our step-by-step guide that starts from scratch:

    1) Start a new project, import DestroyIt and Photon.
    2) Sign up for Photon cloud with your email address and get your App Id from your Photon account (Dashboard -> My Applications online). Enter this info into the PUN Wizard to configure your project with Photon.
    3) Open the scene \Photon Unity Neworking\Demos\DemoBoxes\DemoBoxes-Scene.
    4) Create a new game object called _GameManager. This will contain the necessary DestroyIt scripts.
    5) Drag the DestroyIt DestructionManager script onto _GameManager and assign DefaultLargeParticle and DefaultSmallParticle prefabs (located in \DestroyIt - Core\Resources\Default_Particles)
    6) Drag the DestroyIt ObjectPool script onto _GameManager and add DefaultLargeParticle and DefaultSmallParticle prefabs to the pool (10 instances of each)
    7) Drag the DestroyIt MaterialPreloader script onto _GameManager.
    (see completed GameManager screenshot, below)

    8) Drag the DestroyIt Destructible script onto the BoxPrefab prefab located in the \Photon Unity Neworking\Demos\DemoBoxes\Resources\ folder. This will make all the boxes we instantiate in the scene destructible.
    9) Click on the BoxPrefab prefab and under the OnClickDestroy script check "Destroy By Rpc". This will allow us to customize what happens when the player clicks on the box.
    10) Open the OnClickDestroy script and change the DestroyRpc() method to this:
    Code (CSharp):
    1. [RPC]
    2.     public IEnumerator DestroyRpc()
    3.     {
    4.         var destObj = gameObject.GetComponent<DestroyIt.Destructible>();
    5.         if (destObj != null)
    6.             destObj.ApplyDamage(20);
    7.    
    8.         yield return 0;
    9.     }
    This will apply 20 points of damage each time a player clicks a cube.
    11) Find the material BoxPrefab uses (UnitMaterial) and move it to the \DestroyIt - Core\Resources\Material_Preload folder.
    12) Change the shader on UnitMaterial to DestroyIt/BumpedDiffuse. Assign a damage texture and bumpmap, and a damage mask. Tweak the image tiling to your preference. Set the DamageLevel to 0.
    (see completed UnitMaterial screenshot, below)

    13) Run the project. Once it says "Joined" in the top left corner, click on the ground to spawn cubes that are destructible. You will notice that when they hit the ground, they appear a little cracked from the falling damage they took. Click the boxes to do 20 points of damage each click. When destroyed, they will pop into a particle effect.

    Hope that helps anyone trying to get DestroyIt working with Photon!
     
    Last edited: Sep 18, 2017
    Weendie-Games likes this.
  40. Tyrone843

    Tyrone843

    Joined:
    Jul 16, 2014
    Posts:
    6
    Hello, this is an excellent tool. Do you have any plans to integrate it with ProBuilder? That would be quite awesome.
    Anyhow, great job.
    All the best.
     
  41. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    Thank you.

    DestroyIt already works with ProBuilder. We created a ProBuilder model and added the Destructible script to it and blew it up into the default particle effect. And if you export the mesh as an .obj (Tools --> ProBuilder Tools --> Actions --> Export as .obj), you can make a fancier destroyed version of the model in another 3D modeling program.

    Make sure the meshes you want destroyed are not static, so they don't get added to the Combined Mesh script at runtime.
     
  42. Tyrone843

    Tyrone843

    Joined:
    Jul 16, 2014
    Posts:
    6
    Thank you!
    All the best.
     
    DeadlyAccurate likes this.
  43. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    386
    Hello, I have bought this and think that this is really great and amazing and gives very good destruction, and seems to be very well done and I want to make some questions

    UPDATE TO BE ABLE TO BREAK FURTHERMORE ALREADY GENERATED BROKEN PARTS?

    From the demos shown, once the broken parts are generated, they can´t be broken again in smaller pieces, and I think that it would be really much more realistic, cool, awesome and great to be able to make them breakable too so continue breaking them if hit again, at least once or two times more.

    For example in the palm tree, when it falls down, you can not destroy it anymore.

    Please, would be possible to make this possible in a future update? Thanks

    HOW DOES THE IMPACT FORCE AFFECT THE BREAKING OF THE OBJECTS?


    As you have to have the object pre-factured before

    What happens when the same 3D object gets impacts with different forces from different objects?

    If you have to break the 3D object with this software previously before using it and considering and knowing that this 3D object could be broken by different impacting objects HOW does the breaking done? Because I think that the size of the broken parts would be the same

    So, How would the generated broken shards be need to be created so it would be bigger sizes with a low force and smaller with a higher powerful force?

    I mean that is not the same force applied to be hit by a bullet, from a car crashing to the object, or from a missile.
    Could the size of the broken part of the object be bigger according to the power of the impact? For example, would make a bigger hole in a wall.

    Would be possible to break the 3D objects in different way depending of the impact force?

    Thanks very much for your help

    I wish you the best and wish you sell a lot
     
    Last edited: Feb 24, 2015
  44. The_Least

    The_Least

    Joined:
    Jan 21, 2015
    Posts:
    27
    Hi, has this been tested with Unity 5? Does the damage shading work with the new Standard Shader?
     
  45. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    We haven't pre-ordered Unity 5, so we don't have access to the beta. We'll have to wait for release to test and update the package.

    We use our own Shaderforge shaders, so while I can't say for sure, it seems likely that they'd still work.
     
  46. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Hi SpaceRay,

    DestroyIt already has that feature. If you look at the demo scene there is a scenario that illustrates destructible debris - destroyed pieces that can be further destroyed.

    The way this is accomplished is you put the Destructible script on your debris pieces and save that as your destroyed prefab. And you can do this as many levels deep as you want.

    Just to be clear, DestroyIt doesn't fracture models. You would need to pre-fracture your models in a 3D modeling program or an asset designed to do it within Unity for you.

    But no, DestroyIt doesn't fracture a model in different ways depending on how much or what type of damage is taken. The code could be modified to support it, but the amount of modeling work required by game developers would be staggering. As in, take your destructible object workload and multiply it by every type and level of destruction you wanted to support.
     
    Last edited: Sep 18, 2017
  47. The_Least

    The_Least

    Joined:
    Jan 21, 2015
    Posts:
    27
    So it actually sounds like the answer is "No". Unity 5's "Standard Shader" is a new PBR shader with many optional channels, making it useful for 95% of materials. To use DestroyIt's damage shading, I'd have to use your custom shader *instead* of Unity 5's Standard Shader.
     
  48. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    In that case then, the answer is no. Once Unity 5 is released and Shaderforge's PBR shading is ready to go, we'll see what we need to do to get progressive damage working.
     
  49. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,110
    Hi, any plans to make this Unity 5 ready? Or will it work out of the box?
     
  50. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Yes, we're planning to update DestroyIt for Unity 5.

    Just now, I opened the current version of DestroyIt in Unity 5 to see how big of an effort we're looking at. I can report that it mostly works, but there are some aesthetic, physics, and particle effect issues we need to fix. Here's the issues I saw:

    * Colors are blown out scene-wide. This is because the Unity 4 shaders doubled light intake in order to appear normal, and that's no longer necessary. We'll need to update our shaders and the lighting of our demo scenes.
    * The Overcast skybox in the SUV Showcase scene looked weird and polarized. We'll have to look at that one to see what's causing it.
    * Lots of Hinge Physics warnings in the console ("HingeJoint, Motor and Spring support is mutual exclusive."). Plus, the wooden tower collapses when running the scene, probably because the hinge support points aren't working. Also the SUV's chassis seems floppy (it uses a hinge joint, too). So we'll need to do some work on the hinge joints. A quick read online, and I saw a lot of other people are reporting problems with hinge joints when upgrading to Unity 5.
    * Some particle effects, like the BulletStrikeWood and BulletStrikeConcrete ones have some of their smaller particles floating straight up in the air.

    So yeah, there's some stuff to fix. But overall, it didn't look too bad. The core components of DestroyIt (material transfer, object pooling, progressive damage, debris throttling, collision/splash/falling damage) all seemed to perform well in Unity 5. And we're hoping to get a nice performance boost in going from Physx 2 to Physx 3.3. :)
     
    julianr likes this.