Update Jan. 2.
Xin pointed out that Blender has a built-in method that computes the face which is closest to a given point in space. Using this method to match vertices with faces results in a massive speed-up compared to doing the same thing using Numpy. To transfer one shapekey from the body to the top now takes 1.1 seconds, of which 0.3 seconds is spent on matching vertices and faces, compared to 74 seconds yesterday.
Since the Nearest-Face method is more or less equivalent to the old General method, only much faster, the General method has been renamed to Legacy. I will keep it if it turns out that the new method does not work in some cases.
Original Post
Some time ago we reported on Morph Transfer Progress. However, it turns out that the default Nearest-Vertex method has some problems. First, engetudouiti reported that the transfer tool may run out of memory. This happens because in order to find the nearest vertex, a numpy array was allocated with the distances between all vertex pairs. The size of this array is proportional to the product of the number of vertices in the source and target meshes, and if the meshes are sufficiently dense, the available memory may not suffice to allocate that array.
That problem was straight-forward to fix. Instead of allocating one huge numpy array, a python loop computes the nearest source vertex for each target vertex. The time to do this is still quadratic, but the memory needed is only linear, so there should not be any memory errors.
The pattern arises because the target mesh (the top) is denser than the source mesh (the body), and the size of the pattern is roughly the same as the resolution of the body mesh. The artifact is really inherit in the nearest-vertex method, which we can see as follows.
When we transfer the pJCMChestFwd_35 using the Nearest Face method, the result is very similar to the General method.
Unfortunately, the new method is more time-consuming for large meshes; to transfer one shapekey from the body to the top took 8 seconds with the old Nearest Vertex method, but 74 seconds with the Nearest Face method. Almost all the time is spent finding the closest triangle in the source mesh for each vertex in the target mesh. I hope to be able to find some way to reduce this time in the future.