Concatenation of transforms in Nuke
A fairly common question among Nuke users is whether transformation nodes concatenate in Nuke, which nodes do and don't, and how can one tell.
The subject can be particularly confusing for artists who had used Shake before and liked the way it gave a visual clue of nodes that were concatenating.
So, hopefully, the following guide will shed some light on how concatenation is handled in Nuke, from the very basic concept to some not-so-obvious cases, and help people come up with the best strategy to apply multiple transformations to an image.
1. FREQUENT QUESTIONS
Q. Basics first, please. What is a concatenated transformation, and why should I care about it?
Concatenation is the ability of a transformation node to ask whether its input is also performing a transformation and, if so, combine all the transforms together in order to produce a single filtering operation. Technically, transform nodes produce their own transformation matrix, and ask their input whether they're also producing a transformation matrix.
Usually you'll want to preserve that ability, and avoid breaking concatenation wherever possible, in order to get the best quality and performance out of the transformations you apply to an image.
Here's a very basic example of a concatenated versus non-concatenated stack of transforms:
Q. Ok, so do all transformation nodes concatenate? How can I tell?
Most of them do, but not all of them. Since Nuke provides no visual aid to help us what nodes are concatenating, the best, fail-proof way to check if something is concatenating is to try breaking it (by adding any non-concatenating node between the others) and checking the results :)
However, it is useful to know which ones do and don't, and under what circumstances.
If we look at all the nodes from the "Transform" tab in the nodes toolbar, we can divide them into 3 categories:
C. Nodes that DON'T concatenate, even if they're in the "Transform" menu.
Q. How do I know which node belongs to each of those groups?
There's a list of nodes for each category further down in this document, but generally you can use this rule of thumb, which will make it a lot easier than having to remember what's the behaviour of each node.
- If a node has a "filter" knob, showing the list of standard filters for transformations, the node is most likely certain to concatenate, at least UPSTREAM.
- If, besides a filter knob, the node also has motionblur knobs, then the node can concatenate its transformation both upstream and propagate it downstream.
There's 2 notable exceptions to this rule:
- the Reformat node belongs to this group (concatenates both up and downstream), but doesn't have any motionblur knobs because it doesn't have any animatable parameters.
- the TransformMasked node ONLY concatenates upstream, even if it does have motionblur knobs.
- If a node doesn't have filtering or motionblur knobs, then it's very likely that it will NOT concatenate with other transforms.
Q. What happens when I have multiple transform nodes with different filter settings?
If you have a set of nodes that concatenate together, the last node is the one that sets the filter that will be applied to the whole transformation.
Also worth mentioning, if your last node has motionblur turned on, then none of the filtering options have any effect, since motionblur will force the transforms to use a special algorithm/filter for motionblur.
Q. Is there anything else that will prevent nodes from concatenating?
Yes. Even with nodes that normally concatenate, certain combinations of motionblur settings can break concatenation.
There's 2 basic rules for this behavior:
- In a stack of transforms, when there's a change from motionblur turned OFF to motionblur turned ON, concatenation will stop at that point... UNLESS all the following transforms also have motionblur turned ON.
- When the change is from motionblur ON to motionblur OFF, then those 2 nodes can't concatenate together.
This is probably easier to see with a visual example of the different combinations:
2. CONCATENATION BETWEEN 2D AND 3D TRANSFORMS
One really cool feature that's worth highlighting is the ability of geometry to look up its texture while preserving concatenation with 2D transforms connected immediately above it. (Thanks to Frank Rueter for opening my eyes to this a long time ago!)
This means that, on a standard 3D setup as the one below, you could be scaling down your texture using 2D transforms, and then get really close to the textured object again through the render camera, and it would all happen within a single filtering hit.
This is a feature that doesn't get a lot of press, but is indeed very powerful. This ability to concatenate with input transforms is even preserved through Shaders, which means it'll still work if you're texturing your object using a projection, for example...
... or even for more than one input through a MergeMaterial node!
3. THE LIST
For reference, here's a list of the different nodes that appear under the "Transform" menu on a standard Nuke install, based on their ability to concatenate transformations with other nodes.
Nodes that concatenate both
UPSTREAM and DOWNSTREAM
Nodes that concatenateUPSTREAM only
Nodes that DON'T concatenate
*Dot, NoOp, Switch
might be worth noting that a switch node do not break concatenation either as far as my testing goes.
Yes, you're right. Switch nodes don't break concatenation either. I just edited the final list for the sake of completeness. Thanks for pointing it out.
Also Groups are not breaking concatenation. That is good news because I am pretty sure it wasn't the case in earlier versions. The same with gizmos.
However, I still don't understand why a simple merge node breaks a concatination of 2D transforms...
When you want to apply a matchmove (with a tracker node for example) to several elements moving thanks to a set of transform nodes and you want all this to concatinate, you've got to place a tracker after each set of transform instead of a single one after a merge of all this.
It's a great feature but at first use it's almost impossible to layout a collage using it, as there is no quick and easy way to view the resulting 'merge'.
Is there a better way than connecting the MergeMat to a card, moving the card back in space and using vals:Card2.z and panning/viewing through a locked default camera?
I know what you mean. It is unfortunate that MergeMat doesn't have a way to toggle between "shader mode" and "regular image merge mode", as it would make situations like that much easier.
Plugging into a card that's locked to a camera view is one way to view the result of MergeMat, but you can also keep a separate stream using regular merges, where you lay out, transform, etc. all your textures as you would in 2D. Then simply replace any Merges with MergeMats.
Hope that helps.
"but there's one side effect to be aware of: when concatenating with nodes that have motionblur ON"
... yes? What happens in that case?
Thanks a lot
Hope this makes sense.
What I discover that new version Nuke has two versions of Mirror node, the new Mirror node can be concatenation up and down stream! great update!