I’m having a hard time getting BufferGeometryUtils.mergeBufferGeometries() to work. I isolated the error to the following example. When I try to merge 3 simple geometries, like a torus, box and sphere, the method works as expected. However, when I substitute the sphere with an icosahedron, the method returns null.
const geom1 = new THREE.TorusBufferGeometry( 3, 1, 16, 100 );
const geom2 = new THREE.BoxBufferGeometry(5, 5, 5);
const geom3 = new THREE.SphereBufferGeometry(3, 32, 32);
const geom4 = new THREE.IcosahedronBufferGeometry(7, 0);
const geomA = THREE.BufferGeometryUtils.mergeBufferGeometries([geom1, geom2, geom3], false);
const geomB = THREE.BufferGeometryUtils.mergeBufferGeometries([geom1, geom2, geom4], false);
console.log("geomA: ", geomA); // <- this logs the merged geometry
console.log("geomB: ", geomB); // <- this logs null
Why is geomB null? I thought that as long as all 3 attributes matched (position, uv, & normal), it should work.
Here’s a live example, you can see in the console it logs null for the second one. What can I do to solve this? This is just a simplified demo, but I’m getting the same behavior with more complex imported geometry as well.