Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Shatter Toolkit

Discussion in 'Assets and Asset Store' started by gustavolsson, Jul 8, 2011.

  1. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I was wondering if there was a way to make a small chunk get chopped out of a mesh. For example when an axe hit a tree how would I take a chunk out where the axe hit and then have the rest of the tree still standing?
     
  2. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    Not out of the box but it can absolutely be done: Let your tree have a kinematic rigidbody, mesh collider and shatter tool components (with corresponding uv and color mappers). You can use a custom script to call the ShatterTool.Split(planes) method on the ShatterTool component of the tree game object. As parameter, supply 2 planes that that together creates 4 pieces of the tree at the location of the axe hit. Then, define a PostSplit(GameObject[] pieces) function (and check the checkbox on the ShatterTool) in the script that examines which piece is closest to the axe (for example) and makes that rigidbody non-kinematic. You can also add a small force to that piece so that it flies out by itself. This will create 3 kinematic pieces of the tree still standing so it's not optimal, but it works.

    Hope this helps and sorry for the late reply :)
     
  3. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I have a mesh with 4 materials on it and after I split it I can only use 1 of the materials as it seems to lose some of the data. I'm wondering if there's a way to fix this issue so I can split speed tree game objects.
     
  4. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I need to preserve the 4 submeshes I think but I'm not really sure.
     
  5. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    The toolkit only supports one material per game object in its current state. Multiple material splitting is a feature planned for version 2 of the toolkit. Please see the roadmap here: http://gustavolsson.com/roadmap.

    Sorry for the extremely late reply! I've been out travelling throughout the past month and haven't had access to my computer.
     
  6. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Thanks gustavolsson, is there any timeline on that feature?
     
  7. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    As soon as I have some free time hopefully. It is currently my last year at university. I should not say any time frame but my goal is to work one day a week on the toolkit(s) this semester. I will let you know here how it goes!
     
  8. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Looking forward to updates. Shatter has been a nice additional to my platformer prototype.
     
  9. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Any chance you've added the multiple material splitting feature?
     
  10. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    Good to hear that you found the toolkit useful! I haven't had the time to work on version 2 during the last semester but now that I'm finishing up school I've started laying the groundwork for the update. I'm still committed to it.

    It's on the list of planned features for version 2 (see http://gustavolsson.com/roadmap). It's not in the current version. Stay tuned :)
     
  11. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    TwiiK likes this.
  12. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    All of my toolkits are 30% off in the May Madness Sale, please check them out here!

    I would also like to announce that I've quit my day job to focus on my own company full time, so expect more frequent updates to the toolkits in the coming months :)
     
  13. Marsunpaisti

    Marsunpaisti

    Joined:
    May 3, 2018
    Posts:
    22
    Hi!
    Is it possible to split characters limbs off with this yet? If not, do you think it would be difficult to implement myself?

    Someone expanded this script years ago to do this but I'm wondering if it has been implemented into this since then. Here's a video:

     
  14. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    Oh, I hadn't seen that video. I decided early on not to support this and I do not plan to add it in the future either, as I do not like the use case myself. That said, you can probably extend the toolkit to do this yourself if you really want to, but I don't know how difficult it would be (though the most difficult part of the job, the splitting, is already done after all).

    I'm currently working on implementing a splitting algorithm with better performance after multiple splits and adding support for Voronoi patterns. I'm finally able to work part-time on this :)
     
  15. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    That's awesome to hear.

    I recently got back into Unity again after a long hiatus and I just opened an old project where I was hoping on using the Shatter toolkit I bought ages ago, but it's a bit too bare bones at the moment. Voronoi splitting would be awesome. Spider web splitting or whatever you'd call it for glass etc. would be awesome as well, and the ability to make the splitting only occur in a single plane so that if you split a window all the pieces are the same thickness. I commented saying I wished for such a feature as well as a few others the last time I was using this asset (previous page in this thread).

    I'm also thinking that real-time splitting may be a bit too expensive for a lot of cases so the ability to split an object at editor time and save it as a pre-fractured prefab would be awesome as well.

    I realize a lot of these features can be added/extended by the user, but I feel the core feature set is a bit basic at the moment.
     
  16. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    Thanks for taking the time to write here :)

    I'm planning to add all of the above in version 2!

    Precisely, editor tools will be a big part of the next update. However, I'm also working hard to make the splitting even faster than before. For splitting, I'm aiming for ~0.5 milliseconds execution time for advanced models and a lot less for simple ones. I want to support real-time voronoi shattering for simpler models as well, but we'll see how realistic that is. (For example shattering glass in a spider web pattern around an impact location)

    This is something I've come to realise as well. When I released the toolkit I thought of it as a minimalistic tool that could be used in larger systems. Version 2 will be much more of a fully featured solution. If you're interested and your project allows it, I could let you alpha/beta test version 2 once it's in a usable state (DM me!). It could take some time considering the amount of features I've planned though.
     
  17. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    That sounds fun, but only if I won't have to be dependable. :p Unity is only a pastime for me and the interest and passion for it, not to mention the spare time for it comes and goes seemingly at will so I can't promise anything. If I have time and interest I'll be happy to experiment with the new version and give you my feedback. Destruction/fracturing is something I want in a lot of my projects, which is the primary reason why I bought this asset in the first place. :)

    Yeah, the asset being lean was one of the reasons I bought it in the first place, but since I prefer focusing on game design I appreciate all the help I can get with other systems. :)
     
  18. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    Of course, no pressure, I will send you an message once its ready for testing and you can decide if you have the time to provide any feedback before release :)
     
  19. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Gotten any further with this? :)

    I'm back in Unity again working on a project where I'm using Shatter toolkit in a very basic capacity at the moment and it would be really cool to be able to experiment with some new features.
     
  20. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    I re-wrote a lot of the internals of the Shatter Toolkit over the summer and ultimately made the decision to move the gut of the code into a native library to make the most out of the hardware. The down-side of this decision is that I now have to re-implement the new algorithm once again. I've started work on it but I've down-prioritized it in favor for more interesting projects that came up this fall. My plan is to pick it up again in the beginning of 2019 if all goes well!

    What feature(s) would you like to have in an update? What is the most troublesome part of the toolkit at the moment?
     
  21. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Ait, that's cool.

    As for what feature(s) I'd like to have in an update I mentioned this in previous replies here:
    https://forum.unity.com/threads/shatter-toolkit.95979/page-4#post-2275762
    https://forum.unity.com/threads/shatter-toolkit.95979/page-5#post-3504562

    I like this asset because there isn't a lot of code and because what is there is tight and focused and I was able to add my single plane pizza slice glass shattering fairly easily, but to be perfectly frank I feel like the core feature set is too basic and only includes a form of splitting that is too unpredictable and hard to use for anything other than prototyping and messing around with.

    My top 2 features I would like to see for this asset are features I feel like I would have to implement myself if I were to actually use this asset for more than just prototyping and messing around with:
    1. Voronoi or similarly "chunky" splitting that gives even and fairly predictable chunks.
    2. Editor time splitting because runtime splitting is too unpredictable and probably also too expensive for most games. The unpredictability, especially with the current splitting method, is the biggest issue. You often get very thin or glitchy chunks which cause issues or don't fit with your intended effect.
    Additional features that would be cool:
    • Spider web splitting for things like glass.
    • Single plane splitting, a requirement for the above.
    • The "digging" ability I mentioned in the first previous reply enabling you to dig through geometry like in the first Red Faction game.
    • Actual bullet holes like in Rainbow Six Siege.
    • Wood fracturing. Thin, jagged pieces more or less along a single axis.
    These are more specialized features that are probably more suited to be implemented by the end user, but some of them are fairly complex and it would be cool if the asset at least did what it could to facilitate them. It would obviously also be cool if the asset included them either natively or as part of experimental example scenes. :)

    Edit: When I worked with 3ds Max I used RayFire for this sort of stuff: https://www.youtube.com/user/MirVadim/videos I obviously don't expect the same feature set from an asset like this, but maybe it could serve as a source of inspiration.
     
    Last edited: Nov 22, 2018
    gustavolsson likes this.
  22. emongev

    emongev

    Joined:
    Jul 5, 2012
    Posts:
    36
    Did the submeshes problem ever got worked on? Im having the exact same issue as someone before, where i have a mesh with multiple materials
     
  23. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    I don't remember now, but I think I never got around to it. It should not be too difficult to support however, and I might find some time for it if you need it.
     
  24. emongev

    emongev

    Joined:
    Jul 5, 2012
    Posts:
    36
    That would be great, because otherwise it would require us to remake a bunch of 3D objects and that would take the team a long time, and if you say its easy to support that would be great!
     
    Last edited: Apr 20, 2023
  25. gustavolsson

    gustavolsson

    Joined:
    Jan 14, 2011
    Posts:
    339
    Hi there. Unfortunately I cannot justify working on the toolkit at this time as I only do this work in my spare time and the shatter toolkit rarely sells any copies nowadays. Best of luck to your project!