Extrude 2D Mesh containing merged polygons

I’ve been experimenting with optimizing a dynamic mesh. Essentially it’s a bunch of polygons that I create with BABYLON.MeshBuilder.ExtrudePolygon. These are all static, and all extruded with the exact same value and I merge them together for added performance. Works great, once it’s finished.

The time to merge them is very slow. Much slower than merging the same polygons, not extruded built with BABYLON.MeshBuilder.CreatePolygon. I feel it would be much faster if I could extrude the merged 2D polygons. Does anyone know of anything that could accomplish that? (other than me writing my own custom extrusion function).

Without a PG its difficult to tell whether there is a different way of tackling the problem. When merging extruded polygons then they all have facet triangles around each edge, so more to merge. Presume your polygons overlap. Do your original polygons form a single area when placed? If so work out the polygon it forms and extrude that.

Hi @JohnK I’ve put together a playground here:

The playground has 300 extruded and 300 not extruded polygons. I run merge meshes on each and time it. It’s about 4-6 times slower to merge the 3D polygons than the 2D. The polygons shouldn’t overlap. Unlike the playground I built above they will be difference sizes/shapes, and may have holes.

I was thinking that it would be more efficient to merge them when they’re 2D first, then just add the additional data points to extrude it later. I was thinking maybe there would be something like this built in, but I’m not seeing it. Also wondering if there’s a better way to accomplish this end goal.