Subdivide a THREE.Mesh into multiple meshes

Hello everyone,
I am working on a project using r105. I am looking for a way to split an instance of THREE.Mesh (with BufferGeometry) into multiple Mesh ( N parts horizontally M parts vertically) while preserving all the transformations of the starting mesh… I thank you in advance for any help.

  1. Split the main geometry into N and M parts
  2. Create a new Mesh for each part, set each Mesh with its respective geometry part (you can use the same material, or not)
  3. Position them accordingly
  4. Add everything to a new THREE.Group/THREE.Object3D, set the Group transformation to control the hole set.

You can split the main geometry using a 3D software (like blender), or this three-bvh-csg library.

1 Like

hi @Fennec thanks for your response… Unfortunately I need to do it run-time, and three-bvh-csg seems not to support three r105… my problem would be 1) actually

1 Like

If you want to actually split the triangles, you’re going to want some kind of bvh style thing.

Why is r105 a requirement? That’s a pretty old version.

If you only need to sorting triangles into a grid based on their centroid, that’s a bit easier and can be done with a couple for loops…

I’m not actually sure how much bvh helps here. You want to slice it with a plane? Do you want to fill the caps/contours? Rather than constructing the bvh you can just iterate through faces and slice them if they intersect. What i found more helpful here were half edges and polygons, so i don’t increase the triangle count much with each slice.

This will not solve your problem, but I had fun making this with Three.js r105:

https://codepen.io/boytchev/full/mdNEyQz

image

2 Likes

Thanks, everyone!
Yes, the r105 constraint is a bit of a hassle, but it’s an angular project with a few years of work and doing upgrades of three involves different tasks in multiple parts. What I’m trying to achieve is shown in @PavelBoytchev codepen, i think the “slicing” approach might be better. i’d like to make each part to be interactive on click,maybe using a raycaster approach

I am working on an example codepen where I cut a cube into N vertical parts, but I am having some difficulty in placing meshes