Almost 2 years ago, Mathieu Goulet-Aubin released a set of tools to work with vectors and matrices in nuke on Nukepedia. Having my own set of tools for that as well (here, for which I wrote a couple of tutorials: part 1, part 2), I couldn’t wait to test them. Mathieu’s toolset had some tools I didn’t have, and mine had some tools he didn’t have. We decided to unite forces and develop a join toolset. We now have a release candidate available for testing and would love feedback on the toolset (Get it on GitHub).

We both worked on it on our free time, which is probably why it took so long to get anywhere, but I am quite happy with what we have achieved so far. Mathieu did a lot of the early work on the matrix nodes, and I sort of took it over afterwards to package everything up. It’s still a beta version and hasn’t had much testing in production. As it’s open source, feel free to test, collaborate, modify, submit pull requests, etc..

Compared to the initial toolsets, we’ve become stricter on the naming conventions, with each node now stating clearly what it acts on (Vector2, Vector3, Matrix4). We decided to omit the Matrix2 and Matrix3 tools that weren’t particularly useful. All these tools are math tools, and are meant to be used as building blocks for more complex effects. I will talk more about these tools further down, but first I’d like to show a cool little utility that could be useful even for the less technical artists out there.

Transform Utils (matrix_utils.py)

Since this was meant as a unified toolset for vector and matrix operations, I also added a small python library which contains a few useful matrix functions. It may sound scary for people who don’t like math, but really all that means is that it’s tools to deal with transforms. This is actually an evolution of my merge_transforms_v2 package. There used to be a function in there to convert a transform or a cornerpin to a matrix (stored in a cornerpin node). It was useful to me but not very user friendly for other people. I started modifying this function to convert the transforms to different type of nodes, notably roto and rotopaint directly. I then tested that tool at Spin VFX, where artists requested being able to convert Cards and cameras to cornerpins and rotos, etc..
Sadly I left Spin shortly after I had done the initial release of the tool, and there was one part not fully functional (when converting from cards). However they have allowed me to take back my code and open source it, so I have now been able to fix it up, and offer it as part of this release, so I would like to thank Spin for that!
Enough storytelling, let’s watch a video overview of the Transform Utils.

Converting from card to 2d matrix could still be improved, as things can go wrong when the card is behind the camera. I haven’t found the best way to fix that yet, so if anyone has a suggestion I’d be happy to hear it. I would also like to thank Jed Smith for his planar projection tool which I used for some inspiration.

Tools

Axis Tools

The axis tools are the most beta and untested tools, and seem to work on and off for me.

InvertAxis is supposed to generate an inversed matrix of whichever axis is connected to it on the fly, resetting the world matrix to an identity matrix. The callback on it seems to be a bit on and off, and I’m not sure about the use cases. This one is on the chopping block for the actual release, please let me know if it needs to be saved. The idea is that you can use its matrix knob somewhere where you need an inverted matrix.

ZeroAxis (which may not be named the best way) inverts the world matrix at a specified frame. This is much more useful, as it allows to re-center an axis on a specific frame while keeping the overall animation.

Matrix4 Tools

Mathieu in his original toolset had come up with a way to store matrices per-pixel, by using 16 channels corresponding to a 4×4 matrix. For this new toolset we kept the same format, and included tools to manipulate these matrices. Invert, Transpose, Multiply, Rotate, Translate, Scale, etc.. What tools you can come up with these is up to you, but it can have some cool applications for things like PointRender or manipulating diverse AOV passes.

Vector Tools

The vector tools are somewhat similar to what I had in my previous toolset, but now with most proper math operations, and supporting 2D and 3D vectors. We have dot product, cross product, normalize, rotate, magnitude, as well as a way to use our matrix tools to transform our vectors.