Question

I've merged around 2500 meshes (each having their own set of color) but the FPS is lower than if I wouldn't merge.

According to THIS, merging is the way to go if you want to increase the FPS.

Am I missing something here?

var materials = new Array();
var new_geo = new THREE.Geometry();

for (var i = 0; i < AllMeshes.length; i++) {
    materials.push(AllMeshes.children[i].material);
    THREE.GeometryUtils.merge(new_geo, AllMeshes.children[i], i);
}

var mesh = new THREE.Mesh(new_geo, new THREE.MeshFaceMaterial(materials));
Was it helpful?

Solution

Under the hood, using MeshFaceMaterial splits the mesh into separate meshes for each material -- so if you have a separate material for each child mesh, Three.js has to split your combined mesh all the way apart again. As a result, your supposedly merged geometry doesn't actually get sent to the GPU in one batch.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top