CSG: face count increase greatly after subtractInPlace

Ver: 7.6.1 (latest now)
Env: Any browser
Playground:

Desc:
face count increase greatly after using subtractInPlace of CSG, in the example above, it shows

faces before csg 3876
faces after csg 29698

Why faces became ~10x more with subtractInPlace? Any way to optimize it?

CSG can create a lot of faces indeed, there’s not much that can be done about it…

You can try to simplify the mesh afterwards:

https://doc.babylonjs.com/features/featuresDeepDive/mesh/simplifyingMeshes

1 Like

Have tried with simplify with meshoptimizer, but it does not help much, playground:

faces before csg 3904
faces after csg 18335

Does the buildin algorithm of babylon.js performs better than meshoptimizer, in quality or performance?

I would guess it isn’t. It uses quadratic mesh simplification, a pure js implementation. You can try it out (@Evgeni_Popov has provided you with a link for the docs), but if you already have meshoptimizer integrated (which i find impressive :slight_smile: ) I am pretty sure you are well optimized.

1 Like