# How to optimise my voxel engine code

**URL:** <https://forum.babylonjs.com/t/how-to-optimise-my-voxel-engine-code/11002>\
**Category:** Questions\
**Created:** [May 20, 2020, 2:07pm UTC](https://forum.babylonjs.com/t/how-to-optimise-my-voxel-engine-code/11002 "2020-05-20T14:07:25Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [May 20, 2020, 5:20pm UTC](https://forum.babylonjs.com/t/how-to-optimise-my-voxel-engine-code/11002/6 "2020-05-20T17:20:57Z")

</div>

I think the SolidParticleSystem might be the answer to your troubles, in combination with some smart algorithms to re-use & only render visible boxes.

// 10k boxes  
[https://playground.babylonjs.com/#LXXL6Y#22](https://playground.babylonjs.com/#LXXL6Y#22)

// SPS docs  
[https://doc.babylonjs.com/how\_to/solid\_particles](https://doc.babylonjs.com/how_to/solid_particles)

- By re-use i mean that you shouldn’t need 65k boxes in your scene,  
superset a position array saying “at position x/y/z, a box is located with this uv(texture)”, then re-use geometry, move them around depending on your player’s position.

- Minimalize the original box if possible, remove any meshData you don’t need. (it’s replicated in the SPS mesh, bloating memory that isn’t used)

_Edit; wrong PG._

---

_[View the full topic](https://forum.babylonjs.com/t/how-to-optimise-my-voxel-engine-code/11002)._
