Shake tip monday (it IS monday this time!) - Concatenation

This is the last one that I’m going to be able to drag over from VFXTalk, as I only ever did two extensive tips over there…. I’m going to have to come up with something original for next week!

Concatenation is one of those things that you either understand entirely, and use to your advantage all the time, or you haven’t got a clue what it does and end up with much slower scripts as a result…

In a nutshell, concatenation is when Shake looks at a group of consecutive nodes and realises that there is one equivalent node that could actually do it all in one go in a single node. To speed up rendering, it does this replacement internally, so reducing the amount of processing that needs doing.

There are two groups of nodes that can be concatenated: Colour (it’s my spelling and I’m sticking with it!) and Transform nodes. Most colour operations can be represented by a lookup curve, as most transforms can be represented by a 4×4 matrix. (as long as they don’t change the resolution

You can tell the concatenatable nodes by the little ‘C’ in the top left corner of the node icon in the toolbox. There are three groups of nodes that concatenate. There are the RGB colour nodes (in the Colour tab, with the yellow ‘C’), there are the HSV colour nodes (in the Colour tab, with the red ‘C’) and there are the transform nodes (in the Transform tab, with the yellow ‘C’)

The benefits of concatenation are obvious - you get a script that renders faster, and you’re not going to lose colour data. What do I mean by this? Well, imagine you’ve got an 8-bit image. You put an Add node after it, and set the R, G and B values to 1. Because it’s not a float image, you now have pure white. If you follow this by a Mult node set to 0.5, you will get your image back. Without concatenation, you’d get a mid-grey at this point, but, because the nodes have concatenated, it’s doing it all at once, and keeping the information. If you want to break concatenation for any reason, you just need to put another node in between - I usually use a Blur node with a blur value of 0.

When you’re using transform nodes, it’s always advisable to put them all together if you can - this is because a sub-pixel transform will soften your image very slightly - if you have this happening multiple times in your script, it will make a noticable difference.

So, what else should you be aware of?

Using a mask input breaks concatenation…. Take a look at the image below:

Concatenation example
The nodes on the left are a example of basic concatenation - Shake will see this as two nodes internally. However, the middle group of nodes will NOT concatenate. This is because Shake knows it only wants to apply each node to a certain area of the image, and it’s not clever enough to realise that the mask inputs are all coming from the same place.

So, if you are in a situation where you want to do the middle example, what you should be doing is the one on the right. This will concatenate the three colour nodes, and then put them back over the original image in the area that you want. This will give the same effect, much more economically…

If anyone has anything they’d like to know about, do let me know - I can’t promise I’ll be able to help, but I’ll do my best!

2 Responses to “Shake tip monday (it IS monday this time!) - Concatenation”

  1. UnFramed Visual Effects » Blog Archive » Shake tip monday - Cartoon ’shader’ in Shake Says:

    […] o quantize an image is to compress it down and the expand it back up again. As I mentioned last week, this will usually cause the nodes to concatenate (and therefore have no effect), so a […]

  2. UnFramed Visual Effects » Blog Archive » Shake tip monday - Cartoon ’shader’ in Shake Says:

    […] The best way I have found to quantize an image is to compress it down and the expand it back up again. As I mentioned last week, this will usually cause the nodes to concatenate (and therefore have no effect), so a Blur node (with a blur value of 0) is placed between them. […]

Leave a Reply

You must be logged in to post a comment.