High memory usage with merged geometries in newer versions of THREEJS

301 Views Asked by At

I'm trying the create a voxel engine, and am merging geometries to improve performance. I'm using this demo as reference, which is able to generate around 120,000 using around 700mb of memory in chrome and running at 60+fps on my machine. This demo is using release 44 of threejs, which uses THREE.GeometryUtils.merge. My project is using the newest version of threejs (release 83), and when I attempt render around 50,000 voxels (merging using geometry.merge), I'm using over 1000mb of memory and performance is stuttering. I'm using practically the same method as the above demo. To confirm that threejs was the issue (and not something else with my code), I replaced the release 44 of threejs used in the demo with release 83 (and made some few minor compatibility adjustments) and experienced the same issues. Is this a known issue? I really don't want to revert to an older version of threejs for my project. The only real solutions I can see are switching to an older version, trying to integrate just the merge code from r44 into r83, or posting an issue on github and waiting for it to get solved, none of which are really desirable. Just wondering if anyone else has dealt with this.

1

There are 1 best solutions below

1
On

I managed to determine the issue is not with the merge function by replacing the release 45 Three.GeometryUtils.merge with the one from release 44. This gave the same issues with memory as before, so something else that was changed in release 45 is causing the issue. As suggested, I tested with BufferGeometries and was able to achieve the desired performance levels (< 500 mb memory usage with 120,000 voxels), so I'm ending my search for the source of the issue and switching to this method.