I'm working on a semi-voxel game, and I already optimized the voxel structures' meshes by combining and chunking them.

When I destroy a voxel, I spawn a low poly voxel fragment, with a rigidbody and a collider. And then I add an explosion force.

Even if I turn off rigidbodies when they stop moving, or disable overall physics, the amount of separate meshes to render causes a huge fps loss after a few destroyed voxels.

How could I achieve permanent rubbles?

enter image description here

  • \$\begingroup\$ Is each piece of rubble a different shape, or do they share a mesh that could be batched or instanced? \$\endgroup\$ – Ed Marty Jun 8 at 15:58
  • \$\begingroup\$ Back in the day they were different, now I use the same, and on their materials I enabled GPU instancing. \$\endgroup\$ – Tudvari Jun 8 at 16:22
  • \$\begingroup\$ Have you used the frame debugger at all to see if they are actually being instanced and share draw calls? \$\endgroup\$ – Ed Marty Jun 8 at 21:19
  • \$\begingroup\$ In UpdateDepthTexture there are 313 entries and there are some fragments, and they are instanced. But in UpdateDepthNormalsTexture there are 3134 entries, lots of fragments and none of them are instanced. In Drawing there are 3500 entires, lots of fragments and only a few are instanced. Why? \$\endgroup\$ – Tudvari Jun 9 at 5:49
  • 1
    \$\begingroup\$ The frame debugger can answer that question for you quite directly, depending on the version of Unity you are using. For more information here docs.unity3d.com/Manual/GPUInstancing.html and here docs.unity3d.com/Manual/DrawCallBatching.html \$\endgroup\$ – Ed Marty Jun 9 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.