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. Dismiss Notice

[RELEASED] OpenFracture - Fracture and slice meshes during runtime (open source!)

Discussion in 'Assets and Asset Store' started by dgreenheck, Jan 5, 2022.

  1. dgreenheck

    dgreenheck

    Joined:
    May 19, 2018
    Posts:
    21
    Link to code on GitHub

    OpenFracture GitHub Header.gif

    Overview
    OpenFracture is an open source Unity package for fracturing & slicing meshes. This package supports both convex and non-convex meshes as well as meshes with holes. This means any arbitrary geometry can be fractured/sliced (as long as the geometry is closed and non-intersecting).

    The package includes three samples (featured in the video), one for each of the main scripts
    • FractureDemo - Runtime fracturing
    • PrefractureDemo - Mesh pre-fractured in the editor
    • SliceDemo - Runtime slicing
    I initially planned on releasing this as a paid asset on the Unity Asset Store. However, I realized near the end of development that I'm somewhat burnt out on this project and don't have an interest in supporting it commercially. I decided to release it as open-source because I put a lot of work into this and want others to enjoy it and use it in their games! I have released it under the MIT license, so you can basically do with it as you please. Enjoy!

    Features
    Fracturing
    • Runtime and Editor Support - Fracture meshes either run-time or pre-fracture in the editor for optimal performance.
    • Arbitary Mesh Geometry - Support for convex and non-convex meshes as well as meshes with multiple holes. Note: Meshes must be closed and cannot have self-intersecting geometry.
    • 2D/3D Fracturing - Ability to specify which planes the mesh will be fractured in. This is useful when a mesh is effectively 2D (e.g. glass) and only needs to be fractured on two planes.
    • UV Remapping - Texture coordinates are preserved along edges where mesh is fractured/sliced.
    • Custom Inside Material - Use custom material for inside faces. Supports textures with options for UV scaling & offset.
    • Recursive Fracturing - Fragments can be broken down into smaller fragments.
    • Multiple Trigger Types - Trigger fractures using triggers, collisions or pressing a key. Additional trigger types can be added easily.
    • Tunable Fragment Count - Directly specify the number of fragments to easily tune performance for different platforms.
    • Asynchronous - Support for asynchronous runtime fracturing (single-threaded)
    • Detect Floating Fragments - Detects if multiple, isolated fragments are created when fracturing non-convex meshes and treats each fragment as a separate mesh.
    • OnCompletion Callback - Trigger any behavior after the fracturing is complete, such as playing an AudioSource or executing other in-game logic.
    Slicing
    • Runtime Slicing - Slice objects at runtime
    • Recursive Slicing - Slice objects multiple times and slice the fragments into smaller pieces
    • Detect Floating Fragments - Detects if multiple, isolated fragments are created when slicing non-convex meshes and treats each fragment as a separate mesh.
    • UV Remapping - Texture coordinates are preserved along edges where mesh is fractured/sliced.
    • Custom Inside Material - Use custom material for inside faces. Supports textures with options for UV scaling & offset.
    • OnCompletion Callback - Trigger any behavior after the slicing is complete, such as playing an AudioSource or executing other in-game logic.

    Link to code on GitHub
     
  2. paralolol

    paralolol

    Joined:
    May 24, 2020
    Posts:
    1
    This looks awesome! Thank you for sharing and making this open source, some people will definitely learn a lot by looking at the code (specially beginners like me)
    Cheers!
     
  3. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    168
    Saw it on Instagram I believe. Thanks for sharing!
     
  4. cjbruce

    cjbruce

    Joined:
    Jun 26, 2017
    Posts:
    12
    Wonderful! Amazing job! By any chance is there a way to only split concave pieces? Basically by finding the edges that make the pieces concave and perform a plane cut from that edge?
     
  5. LeifStro

    LeifStro

    Joined:
    Mar 23, 2015
    Posts:
    27
    Amazing work man! Can't believe this is getting such little attention. All the other free implementations I've looked at are major buggy.