Jump to content

"Merging" meshes with code


photo

Recommended Posts

Hello,

Is it possible to "merge" (simple addition, not an actual CSG operation!) two ObjectMeshDynamic in code. The source meshes are generated from code but with different transform. The merge would "add" object2(with transform M2) into object1 (with transform M1). They have a single material and surface. This would be a one-time operation at run-time, so performance is not an issue.

Rationale: I'm generating tens of thousands of small meshes, very close to each other, all different (so a Cluster is not an option), and I feel they would benefit from being merged in small groups. Or should I not be concerned?

Thanks!

Link to comment

Hello,

I tried to combine 40,000 objects into one mesh. The resulting object contains 40,000 surfaces, each containing vertices and indices from separate objects. After that, performance improved from 42ms to 15ms. A separate material can be set for each surface. You can see the result here. An example is in the attached files.

AppWorldLogic.cpp AppWorldLogic.h

  • Like 3
Link to comment
×
×
  • Create New...