Extrude Question (polygon and shape)

ExtrudePolygon and ExtrudeShape,the light effect looks like not same,in extrudeshape, the normal of point in same side looks not same.but in extrudePolygon the points in same side has same normal.
you can visit to see https://playground.babylonjs.com/#STB1EK#2

but when i insert point in ExtrudeShape,it looks ok.

The algorithm to compute the normals is not the same because for extrude shape the caps are not taken into account whereas there’s no cap concept for the extrude polygon case.

If you want the same rendering, you should enable cap for extruded shapes and then call either forceSharedVertices() or convertToFlatShadedMesh on all meshes:


If you display the vertex normals in the inspector, you will see they are identical for all 3 meshes.

1 Like