Cutting holes in custom flat mesh

Hi all. I’m trying to figure out how to cut holes in a flat custom mesh. I have a function to create a flat mesh from a list of points and an origin point. The points are linked together in sequence and all points are linked to the origin point like spokes in a bicycle wheel. The function also calculates uvs so I can use image/bump texture materials on vertical meshes. The use case is for siding of buildings with different roof lines and this is what I came up with. I’m a newbie so maybe I missed something built in that would do this and handle vertical image textures.

I’ve found some examples using csg, but csg doesn’t seem to work with flat meshes. It cuts out the hole, but pushes the cutout through the flat mesh and connects it back to the flat mesh. Is there an alternate method of cutting holes in a flat mesh?

Thanks

Maybe this could help ? Polygon Mesh Builder | Babylon.js Documentation

1 Like

I saw the Polygon Mesh Builder, but it mentions that it doesn’t work with faceUVs. I’m assuming that means textures won’t map properly for a vertical mesh. I’ll give it a try and see if it works.
Thanks

Use Irregular Polygons | Babylon.js Documentation which adds extra features to polygon mesh builder.

For any flat shape faceUVs is not applicable. If you want different textures on the two sides use frontUV and backUVs

You will have to rotate the mesh from an horizontal to a vertical position.

If your mesh is not actually flat but has thickness use Irregular Polygon Extrusion | Babylon.js Documentation and you can uses faceUVs.

3 Likes

I think the irregular polygon is the way to go. But you have to abide by the rules of what constitutes a hole. The window in your example could use a hole, but the door would be just part of the irregular polygon.

Hello @katwork just checking in, was your question answered? :slight_smile:

Thanks everyone for the responses. Sorry I didn’t reply earlier, other projects took priority and I forgot to follow up. I messed around with one of the PolygonMeshBuilder PGs and was able to get it to do what I need at this point. If I end up with time to go back and give the walls a thickness, I’ll look at using extrusion to make the holes. Thanks.

1 Like