Add edge on a face of mesh

Hello there,

I am creating a 3d modeling editor, and I need pointers on how to draw edge on a selected face of a geometry. This splits the face into sub facets like this

You will need to handle this “by hand” by creating a line mesh from the two vertices of the edge. I don’t think there’s any other solution.

1 Like

I am thinking of de-constructing the increaseVertices algorithm and see what i can come up with

so I was able to achieve this by creating a new face on the mid of the edges related to the face Index

https://www.babylonjs-playground.com/#W6P8SX#8

I am able to delete 2 faces, except for this one

Your mesh is not built as you think it is, notably there is a face that corresponds to the upper part of the quad, meaning the union of the 2 faces you want to remove.

The list of indices of your mesh is: 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5, 0, 5, 6

You should use splitFace.setIndices([x,y,z]) for each triplet of this list to visualize each face separately.

1 Like

finally got it working thanks!

https://www.babylonjs-playground.com/#W6P8SX#19