Before anything 'Happy 4th of July' to our american readers!
In the documentation of MMeshIntersector::create(MObject &meshObject, const MMatrix &matrix), it says "This method creates the data required by the intersector. It is a heavy operation that should be called only when necessary."
Internally, that class will tessellate the mesh, if it hasn't already been, and will build an octree for its triangles, which is going to be at least as heavy as the mesh itself and probably heavier.
However there are three ways for doing mesh intersection in Maya:
- First, MFnMesh::intersect() which is not threaded and very slow. But it has no memory overhead.
- Second, MFnMesh:closestIntersection() which uses grid-based intersection and is super-fast with very little memory overhead. Not threaded either, but fast.
- Third, MMeshIntersector which is fast but uses an octree which consumes memory. Its main advantage is that its fully threaded.
From one of my colleague experience, the grid-based intersection works well, but it really depends on how often you plan to do an intersection test on the same object, how many polygons the object has, and whether you can take advantage of multi-threading.
If you want to limit memory overhead, I think the grid-based approach will be very svelte in terms of usage. I know that the octree can get big on larger geometries.
Comments