Open ivakam opened 2 years ago
It seems the crash was caused by the meshes generated by the importer being excessively large. A scene file holding just a VoxelObject of a voxel tree amounts around 50MB, 500k vertices. For comparison, a normal "low poly" tree of roughly the same size amounts to 13k vertices.
I otherwise really enjoy this plugin, and it's amazing how nice the tools are. Unless this is somehow resolved (I'd be delighted if it turns out I'm just doing something wrong or my artist is simply exporting badly from MagicaVoxel somehow) I'll unfortunately have to look for another solution :(
As discussed off thread, this is due to a limitation and strain on the system. You've mentioned that you've seen different results when importing as MeshOfVoxels than as VoxelObject. I think this has to do with that when importing as MeshOfVoxels you are only saving the resource as a static Mesh. As opposed to when importing as a VoxelObject, where it not only stores the Mesh, but also stores the entire voxel content. Taking a look at the voxel assets you've shared with me, they are what I would classify as high-density voxel content. One of the assets has a dimension of 73 x 75 x 126, which means that there could be at most 689,850 voxels. You can imagine how draining that amount of voxel content can be, especially when you want to create a "forest" of them where each instance would contain the Mesh and its own copy of the voxel content.
However, I was able to import and use the Vox assets you provided, both as MeshOfVoxels and VoxelObjects, without crashes or modifications, and was even able to modify the assets in the engine. Maybe a difference in hardware allow me to do so.
What I would recommend for this type of situation is a chunking system, you would basically split your scene/world into voxel chunks and only load the part that is active/seen by the player, take a look here for a simple example: https://github.com/ClarkThyLord/Voxel-Core/tree/master/examples/ProceduralWorld
Another recommendation is that when looking to work with high-density voxel content, it's best to work with them as static Meshes. And if you ever need to have dynamic voxel content, all you need to do is swap the static Meshes for VoxelObjects as needed and vice versa.
I get a full crash whenever I try using VoxelObjects in my main scene. I can't seem to find any error output, so unfortunately I haven't the slightest idea why it's crashing as VoxelMesh seems to be working just fine. I will provide any logs or such on request!