Normal discontinuity in extrusions

Hi all,

I just discovered an issue which is very annoying in my project.

When creating an extrusion using “MeshBuilder.ExtrudeShape”, the ‘shape’ input cannot be closed. As consequences of this, when the first and the last coordinates of the ‘shape’ parameter are equal, the normals are not smooth causing an ugly light discontinuity, and the first and last vertices are duplicated.

I think a parameter like ‘close=false’ is missing.

I reproduced the issue here:
Please, check the top of the resulted pipe.

Maybe I missed a workaround? I tried several things, for example to remove duplicate vertices (“mesh.forceSharedVertices()”) but then the caps normals are broken.

Thank you in advance!

Adding @JohnK who is amazing with maths :slight_smile:

On mobile currently so cannot check things out fully. Does using Creating Tubes | Babylon.js Documentation give you the same seam problem.

An alternative might be to use Creating Ribbons | Babylon.js Documentation directly which is the basis for the extruded shape


Hi JohnK,

I confirm CreateTubes is working as-is as I expect, i.e. without the discontinuity. This is definitively a perfect workaround for my issue, I will go forward with this solution.

It’s certainly possible to achieve the same result using ribbons too. The closeArray/Path parameters is exactly what I would wait in the extrusion primitive. I didn’t test them because reproducing the same shape would be time consuming because of the underlying trigonometry.

Thank you a lot, these 2 workarounds are exactly what I was looking for.
I still think a closeShape flag is missing in the extrusion primitive, but it’s much less important to me now :wink:



If you use ExtrudeShapeCustom there is an equivalent option to closeShape as can be seen in

Will have a look at submitting a PR to add it to ExtrudeShape;


Thank you, this is an even better solution!