ExtrudeShape Used to subtract from another part leaves particles

I am creating door rails using the subtract method. To create the door detail I am using the ExtrudeShape method. It works fine creating the shape but I noticed if I cap the ends it leaves some black triangles on the ends. Regardless of adding the caps or not, when I subtract the extruded shape from my extruded polygon it has some leftover particles.
https://playground.babylonjs.com/#VYZEEQ#183
This playground shows the detail shape being extruded and you can uncomment the lower section to see the cutout and the leftover particles.

Could anyone point me in the right direction?
Thank you in advance!

@Evgeni_Popov has already been an hero solving similar cases so let me add him into the thread :slight_smile:

The problem comes from the invalid geometry that occurs because of the extrusion. We can see that their are interpenetrating faces in the center of the model:

For demonstration purpose, I modified the PG to generate the path with a simple gaussian, so that I can easily change the number of points of the path:

Once black faces appear in the model, the CSG operation generates artifacts.

You should try to modify the number of points of the path and/or the profile itself to try to get rid of the artifacts.

1 Like

Do you know of a better way to accomplish a similar shape?

Maybe a DCC tool like Blender (if this is an option for you)? I suppose there must be high-level tools for generating these kinds of shapes.

I do have other tools that are available to make the shape but none that are a web API like babylon. I was just wondering if there was a different way to do it in babylon. Either way, thank you for the response and taking the time to answer.

To be clear, I can make the shape with other programs. However I want an API that can create the part dynamic for door rails.
Door Builder

This will give you an idea if what I have done with my square doors and what I am trying to accomplish with an arched door type.