I need to render big amount of simple static BoxGeometries, positions of geometries are parsed from local file, every line represents block area id(something like chunk id), position and scale (width, height, depth).
the problem is amount of data - some files are really huge, gigabytes of data(which is millions and tens millions of records).
I use InstancedMesh to render all this BoxGeometries in my scene, render on demand, also i “join” the BoxGeometries as different InstancedMeshes, so amount of instanced meshes is equal to amount of block areas (i do that because i assume that frustum culling doesnt work for individual geometries in instanced mesh, so at least i dont render some instanced mesh(block areas) outside of frustum), but still i believe there is room for performance optimisation.
i dont use any textures, just MeshBasicMaterial, also as i need to color different blocks based on some conditions. i do that with instanceColor and updating this attribute (which is better that using texture atlas with shaders, i tried).
The main issue is obviously performance and the questions i want to ask:
- is using BatchedMesh instead of Instanced can help?
- Is using bvh can help?
- is it possible to apply frustum culling for InstancedMesh so I render all the blocks as one InstancedMeh with only 1 draw call and dont render any instanced mesh geometries that are out of frustum? I believe i did see some examples utilizing bvh to sort geometries and set visibility to false for those that out of camera frustum but i couldnt make it work for my case.
- Is there occlusion culling for instanced mesh implementation example? Is it real to achieve?
- In my chrome dev tools rendering tab says that i use from 3 to 12 mb of gpu memory which is kinda weird, other three examples use more gpu memory. chrome hardware acceleration is on.when i disable hardware acceleration and things gets even worse, it takes like 10-15 seconds to apply any changes to the scene.is there any way of utilizing more gpu memory to increase performance? (my work station uses GeForce GT 710 with 16GB of RAM). i did test my app on other pc’s with more efficient cpu and performance is much better (~110 fps for 800k records in file, when i get 75 max with 100-200k records file)
- Is there any way of back face culling for this box geometries? Is it worth it?
- I’m looking into level of details, because i can not decrease amount of polygons of basic BoxGeometry(1, 1, 1) can i instead render some boxes as points/2d figures on distance?
- Is it possible to move some render tasks/computing to gpu with shaders and will it help with performance (im not familiar with shaders yet)
Any help/ideas/examples will be appreciated