I have a pattern in SVG format and a model imported from a GLTF file. I want to carve the model using the shape of the SVG pattern, creating a perforated cut. I tried using ExtrudeGeometry
to create a 3D model from the SVG image, then subtracting it from the GLTF model with three-csg-ts
. However, it didn’t work correctly because both are Group
objects, and CSG only works on Mesh
objects. Can I still use CSG, or are there other solutions? Are there any optical tricks that could solve this? Please help!
1 Like
You can use CSG, you just have to find/merge the meshes involved.
something like:
let meshes=gltf.scene.getObjectsByProperty('isMesh',true);
meshes.forEach(m=>scene.attach(m));
let geometries = meshes.map(m=>m.geometry.clone().applyMatrix(m.matrixWorld))
let mergedGeometry = BufferGeometryUtils.mergeGeometries(geometries);
let mergedMesh = new THREE.Mesh(mergedGeometry, meshes[0],material);
1 Like
You may use bump maps or normal maps to imitate carving. Here is how a bump map looks like:
1 Like
thank you for your suggestion!