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.
Asked
Active
Viewed 274 times
0
-
For your use case, you could use `InstancedBufferGeometry`. See http://threejs.org/examples/webgl_buffergeometry_instancing.html. Edit the example and redefine the variable `vertices` like so: `var vertices = ( new THREE.BoxBufferGeometry( 0.05, 0.05, 0.05 ).toNonIndexed() ).attributes.position;`. You will have to do some study to understand how it works. – WestLangley Dec 29 '16 at 20:15
-
I'll probably end up using this so thanks for the suggestion, but the question is why can't I get the same performance on new versions that I can on old versions with the same method? I'm looking into it and right now it looks like something happened between release 44 and release 45 can caused a huge jump in memory usage. I'm looking into it now and will post the results here. – dyarbrough Dec 29 '16 at 20:51
-
You could also just use `BufferGeometry`. See http://stackoverflow.com/questions/31399856/drawing-a-line-with-three-js-dynamically/31411794#31411794, if you want to increase the number of voxels dynamically. I would avoid regular `Geometry`. – WestLangley Dec 29 '16 at 21:09
1 Answers
0
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.

dyarbrough
- 771
- 2
- 8
- 14
-
hi can u post some kind of example of ur code somewhere< Im having similar issues nt sure how to fix, thanks – B''H Bi'ezras -- Boruch Hashem Dec 21 '21 at 00:31