How to separate each face of a mesh, (explode mesh)

If i have a mesh, lets say A cube, is it possible to separate each face of the cube?
Sort of like exploding the cube into its faces?

image
Like this? is it possible?

or even separate each face into its own mesh?

Im thinking manipulating the triangles, each mesh has triangles. And each side has a combination of triangles. So combining the triangles to get one side(or face) can get me the face. But I am unsure how to do it. does any one have an idea?

You could hack something based on the centerpoints of the triangles, or the direction that the normals of the triangles point toward… to classify triangles into which cube face they belong.

The more robust solutions use something called a DCEL (doubly connected edge list) to let your walk across the model and isolate/process connected pieces of it.

If I was doing it, I would just make the mesh in a 3d modelling app, like blender, and separate the faces into separate meshes, then export as gltf and load it in three.

Three works only with triangles - so you can’t really merge them into any more complex polygons. If all you’d need is to explode the mesh (regardless of the complexity of faces) - just mesh.geometry.toNonIndexed (this separates vertices in a way that triangles stop sharing vertices and every triangle can be moved independently), then apply .displacementMap + .displacementScale to the mesh material.

1 Like

You can assemble the desired geometry from the individual parts and position them as required.

In this definition, the individual parts can be recognized very well and can be separated and defined as separate geometries.

RoundEdgedBoxFlat


From an addon:

Magic Sphere example 4

Magic Box example 9, 11, 12

see GitHub - hofk/THREEg.js: three.js addon to create special or extended geometries. The addon generates indexed or non indexed BufferGeometries.

Just injecting a small clarification: triangles, segments and points. The last time I’ve seen native quadruples and polygons in Khronos bloodline was in OpenGL 1.x (that was some 20+ years ago).

2 Likes