Voxel Destruction Pro

Try it yourself: https://atan-games.itch.io/voxel-destruction-pro


🔷 Directly load from MagicaVoxels vox files

This Package allows you to model anything in the free Voxel Modeling Software "MagicaVoxel" and then save it in the StreamingAssets folder and directly load them in Unity. Additionally you could also procedually generate the voxeldata, the package makes it easy to add your own functionalities.


🔷 Compatibility

Windows: ✔️

Linux: ✔️

Android: ✔️

WebGL: ✔️

VR: ✔️ Tested on Oculus quest 3

MacOS and IOS: ❔ Not tested, but should work fine


The package should also work with HDRP, but there is no default shader or HDRP demo scene included.


🔷 Fully multithreaded

This Package takes heavy use of the Unity job system, in order to put the load onto the other cores instead of the main thread. There of the jobs are:


Greedy Meshing: Generates the Mesh using a greedy meshing algorithm that minimizes the triangle count

Mesh creation: Creates the Meshdata directly from the NativeArrays returned by the Greedy Mesher. This saves performance since you don't have to copy the data to the main thread. The bounds of the mesh will also be calculated inside this job

Collider backing: Whenever you set the Mesh of a Meshcollider, it will bake this collider. This takes up a lot of performance especially for complex meshes. We allocate this onto another thread which ensures that the main thread performance is not effected

Voxel search: Whenever a destruction occurs this job searchs the voxels that are effected by it, using distance calculations

Connected component search: If a voxelobjects contains floating fragments that are not connected to the main mesh, we need to seperate those. This can be done using the Connnected component search algorithm

Fragmenter: This jobs creates the fragments from the removed voxels


Most of these jobs use simple interfaces, which allows you to add your own implementations. Future updates may also introduce new implementations for some of these jobs.


🔷 Full package remake

This package is a complete remake of the Voxel Destruction package, compared to the previous package it has a lot of improvements:


Better performance: The new package is much faster, there are many performance improvements. You can now fluently destroy models that were barely able to load in the old version of the package. The fragments now also get created in real time, which allows you to further personalize the destruction.

Higher usability: The functionallities are now split into multiple scripts, that allow you to only use the features you need. There also is the option to create personalized Voxel object that load data procedually. I also tried to improve the documentation and there are more comments in the code, it now contains more details on how to use the package.

More features: You can now use new features like custom origin points, customized realtime fragments, different destruction types and more

Less loading time: There are now smarter caching functionalities that will ensure that the vox files are only read once and then cached


🔷 Credits

Outline shader used in the screenshots: https://github.com/Robinseibold/Unity-URP-Outlines

This package uses:

- BetterStreamingAssets: https://github.com/gwiazdorrr/BetterStreamingAssets

- VoxReader: https://github.com/sandrofigo/VoxReader