Maya plugin for processing meshes, similar to Wrap3
Ability to specify correspondence points, achieved with C++ by defining a new object type with a render override.
Interface written with Python PyQT5/pySide for Maya
Nodebased interface, similar to Wrap3, which allows application scalability by adding new nodes which will provide new functionality in the future
Processing is computed using Maya`s C++ API for faster speeds, python would be too slow
Similar workflow to Wrap3 since it`s already established and would cut down on the learning time for users that have had previous experience
In order to jumpstart the nodebased system I used a free library which I enhanced to fit my needs ( OpenGl Acceleration, Custom DataStructures and Interaction, Custom Icons, Custom Reactions, etc.)
They also hold the extra information coming from Maya or getting passed to the custom c++ commands that actually do processing
Each node type creates a class instance container which is used to store scene related information like correspondence points, vertex numbers, settings etc
Selecting a node builds a widget which can be used to change or update the information stored in the classes mentioned earlier
Obviously there is way more stuff happening under the hood when it comes to the UI, but that is the basic way I handle data structures within this plugin.
Since both the wrapping process and the custom alignment node need the user to define relationships between the two surfaces, I created a custom object using the C++ API which always renders on top of the other objects and maintains the same size
After creating the object type that exhibits the required behaviour, I had to find a way to provide the user with a way to place the points directly on the surfaces of the meshes. In other words I had to find a way to get the screen space position of a mouse click or drag, convert that into worldspace, and raycast to the mesh surface in order to detect collisions. This method also allows me to limit the placement only on the meshes connected to the Correspondance Node.
Mesh processing nodes ( Math, math, and then some more math )
When it comes to mesh processing python can prove to be quite slow so I had to use C++. An alternate scenario would have been to install Numpy and SciPy but that would have meant that any user that wants to use the plugin needs to go through the tedious process of installing them, and support is a bit sketchy for the Python version that Maya uses.
All the processing nodes are built under the same C++ project and registered as different commands Maya can execute
Correspodence based alignment
After some R&D I managed to find a really awesome paper that handles this process amazingly: Least-Squares Rigid Motion Using SVD by Olga Sorkine-Hornung and Michael Rabinovich, and using Eigen i wrote the C++ version.
Probably the hardest part was figuring out how to use the Levenberg Marquardt algorithm non-linear optimization module, which looking back now seems easy but back then I couldn`t find a proper implementation even after a couple of days of constant searching. In Mathlab a similar result can be achieved using “lsqnonlin” and in scipy “scipy.optimize.leastsq”, both of which are far more accessible and come with an abundance of examples. Regardless eventually I managed to figure it out without examples :).
Results and Tests
I could go on with more code or problem-solving examples, but I believe this is sufficient to paint a picture of my current level. As always there is way more out there to learn, and the more I do, the less I feel I actually know :). I`ve also built shaders, c# unity scripts, Unreal Blueprints, MaxScripts, ZBrush Scripts and I`m willing to extend my skill set and I’m eager to learn more. I`m gonna close this by showing some working examples of the plugin.