I got a first glimpse at the upcoming Beta 3 build of Genome (coming soon) which has the promised refactoring of the mesh lookup methods acceleration.
In short, if a geometry object is moving in space but not deforming, it won’t require an update of the acceleration structures. For example, if you are selecting the vertices of an object with a moving / rotating / scaling mesh that has no animated deformation modifiers on the stack, the kd-tree will be updated once and then the NearestPoint/IntersectRay/InVolume will run faster than in Beta 2.
Here are some benchmarking results I wanted to share.
CASE:
A 64 segments Teapot’s vertices are being selected by a 64 segments Geosphere. Both objects have animated transforms, moving relatively to each-other.
TIMING:
Measuring the playback of 100 frames in maximized viewport mode, Nitrous drivers in Max 2012.
RESULTS:
*3ds Max Volume Select: 733.990 seconds
*Genome Beta 2 InVolume operator: 434.016 seconds
*Genome Beta 3 InVolume operator: 330.164 seconds
*Genome Beta 2 IntersectRay Distance < 0 Test : 122.083 seconds
*Genome Beta 3 IntersectRay Distance < 0 Test : 34.650 seconds
NOTES:
*Using the InVolume approach produces much more precise results with complex meshes, but is significantly slower. In this case, Beta 3 is 2.22311x faster than Volume Select. Beta 2 was 1.69116x faster.
*Using IntersectRay along the vertex normal and checking the Distance value’s sign (negative means backface was hit) works best with convex meshes, but it is also very fast. The Beta 2 build was 6.01222x faster than Volume Select, Beta 3 is now 3.52332x faster than Beta 2 due to the reduced updates, and 21.183x times faster than Volume Select. Here we go, an order of magnitude!
CASE:
The Conform example from the website. Projecting the vertices of a plane onto the faces of another plane. Both planes moving.
TIMING:
Measuring the playback of 100 frames in maximized viewport mode, Nitrous drivers in Max 2012.
RESULTS:
*Genome Beta 2 1M verts against 1M faces: 743.089 seconds
*Genome Beta 3 1M verts against 1M faces: 171.011 seconds
*Max Conform 10,000x less data (10,000 verts against 10,000 faces): 663.168 seconds
*Max Conform 10,000x less data (100,000 vetrs against 1,000 faces): 626.090 seconds
*Max Conform 100,000x less data (1,000 verts against 10,000 faces): 71.921 seconds
*Max Conform 100,000x less data (10,000 verts against 1,000 faces): 63.810 seconds
NOTES:
*Beta 3 is 4.34527x faster than Beta 2 in this particular case.
*It was not realistic to actually test the Max Conform Space Warp with 1M verts and 1M faces. Assuming a linear performance behavior (10x more vertices or faces, 10x more time), doing so would require around 60,000 seconds per frame, which is 1,000 minutes or 16.6 HOURS/FRAME! This is about 35,000x slower. In other words, to play back an animation that Genome handles at nearly 0.6 FPS would take 1,660 hours, or OVER TWO MONTHS!
RESULTS 2:
To avoid the extrapolation, let’s compare the Beta 2 and Beta 3 builds using the SAME counts as Max Conform:
*Beta 2 10,000 verts against 10,000 faces : 8.634 seconds
*Beta 3 10,000 verts against 10,000 faces : 2.319 seconds
*Max Conform 10,000 verts against 10,000 faces : 663.168 seconds
*Beta 2 100,000 verts against 1,000 faces : 17.390 seconds
*Beta 3 100,000 verts against 1,000 faces : 15.655 seconds
*Max Conform 100,000 verts against 1,000 faces : 626.090 seconds
NOTES 2:
*With 10,000 faces in the kd-tree, Beta 3 is 3.72316x faster than Beta 2, and 285.972x faster than Max Conform.
*With only 1,000 faces to hit, Beta 3 is only marginally faster (1.11083x), but still 39.993x faster than Max Conform.
*In other words, the more polygons you throw at the ray intersection test, the better Genome Beta 3 will perform against both Beta 2 and the native Max solution.
FINAL NOTE: If the mesh is deforming or changing topology, Beta 3 will perform about the same as Beta 2 since it will have to rebuild the kd-tree on each frame. Dropping an animated Noise on the target plane and performing the 10,000 vs. 10,000 test again caused Beta 3 to finish in 13.744 seconds vs. 12.150 for Beta 2. These nunbers are higher than the 8.634 seconds measured above because the animated Noise added to the 10K plane also needed time to deform its vertices…