Polygon Mesh Builder Shallow Holes

Hello everyone. I have a need to create meshes for the woodworking industry. The meshes I need to create require grooves, and holes that do not go all the way through. I am looking into this Mesh Builder. Currently I have the vertices for the shape of the part and was extruding it the thickness of the material. Which works fine as long as there is not any perforations or grooves. Anyone know of a way to accomplish this? I looked into using CSG to do this. Which works, but i believe i need to do it more procedurally. Below is an example

This is an other way to create meshes with holes:

csg | Babylon.js Playground (babylonjs-playground.com)


I’m not sure how to say this properly. For any shape that is not going thru the mesh (lets call this “Panel”), why can’t we just have a transparent mesh to mimick the subtracted geometry.

For example, the vertical groove that you see in the picture above. I can have a child object that has 3 planar meshes for the Left, Right, and Rear faces of the groove. The front planar mesh causes the affected area of the “Panel” to become transparent and exposes the child meshes.

Is this possible? Does this process have a name?

That way, if I move the child object (ie: the groove or the holes) the inner meshes and transparencies move with them.

Hopefully, that makes sense

EDIT: This is an example of how the subobjects would look

I ask chatGPT, too, if I am looking for a better description of something rotating in my mind… :slight_smile:

That code did not look appropriate since it is giving transparency to the child objects. Can shader material act as subtraction material?

Hmmm that might be a very naive way of doing that, but my initial idea would be to “split” the mesh into two parts: one where the holes go all the way through (which can be created by the Mesh Builder), and a simple box mesh with no holes:

then use CSG to “glue” these two together


CutOut | Clipping Example

BingBot says:
Yes, it is possible to use a shader material as a subtraction material in Babylon.js. According to the Babylon.js documentation, the ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh. This returned material effects how the mesh will look based on the code in the shaders. You can learn more about shaders and shader development in Babylon.js from here.