Anybody know how to remove this artefact? I mean the sphere, it shouldn’t be there after this operation. But it is. Sometimes it works fine, especially for simple models, but on complex models it causes such effect.
const group = new THREE.Group();
const sphere = createSphere(80);
const glb = await loadModel('models/out.glb');
const object3D = glb.children[0];
setSize(object3D);
const resultObject3D = subtractObject(object3D, sphere);
group.add(resultObject3D);
return group;
I use this approach from CSGMesh.js lib to cut models:
const subtractAFromB = (meshA, meshB) => {
const csgA = CSG.fromMesh(meshA);
const csgB = CSG.fromMesh(meshB);
const resultCSG = csgA.subtract(csgB);
return CSG.toMesh(resultCSG, meshA.matrix);
};