Home DaVinci Resolve Combining Mattes in DaVinci Resolve, Part 2

Combining Mattes in DaVinci Resolve, Part 2

by alexis

Continuing where part I left off, it’s time to look at how we can combine the mattes that are output by several nodes using the Key Mixer node. It’s a long one.

A Key Mixer node combining multiple mattes generated by different nodes.

Before getting started, let’s get a bit of terminology out of the way, first. When I talk about a matte, what I’m referring to is a grayscale channel that’s used to define which areas get corrected, and which areas don’t. However, using the terminology of DaVinci Resolve’s UI, it’s more accurate to refer to this as the “key channel.”

Why is this important? Because the technique of combining mattes is accomplished using the Key Mixer node, which takes multiple key channels as its input, allowing you to combine them in various ways in order to output a single key channel, which you can then plug into any other node’s “key input” with which to define a secondary operation.

This isn’t a technique you’re going to use every day. However, the following example shows what I consider to be one of the Key Mixer node’s primary uses, which is to allow you to create mattes that combine multiple HSL-qualified keys for shots where you simply can’t get satisfactory results from a single HSL key.

But enough jibber jabber. Let’s check out an example.

The following shot (which happens to be available on the DVD-Rom that’s included on my new book), has a single primary correction to adjust contrast and color.

The initial correction node and its result.

However, the client wants to throw an orange-red wash into the room. Adding another node (to make it easier to back off this more stylistic correction in case the client changes his/her mind), we make the change.

Adding a second node with a stylistic correction.

Unfortunately, the amount of color the client wants gives the actors a sunburn, and changes the color of the man’s shirt from blue to a purple-pink that’s not quite what wardrobe had intended.

Now, one easy fix would be to apply the colored grade as a secondary operation, using HSL Qualification and Power Windows to isolate the skin tone of the faces, preventing the “accidental sunburn” look by limiting the correction to the outside of the secondary key.

Only keying the faces.

Unfortunately, this does nothing to preserve the color of the shirt and tie, and in fact trying to isolate the oranges, maroons, and blues of these features all in one operation would require an impracticably wide sample. This is a perfect instance when combining several discrete keys will give us a better result.

To do so, we need to do some rewiring of our node tree, but to understand how we need to take another look at how node connections work. The following illustration shows the two types of node connections that you can make.

The two types of node inputs and outputs in Resolve.

The circles at the top left and right are the targets used for routing RGB image data from one node to another, which is what we’ve been connecting nodes with so far. However, the triangles at the bottom right and left are the targets used for routing key channels from one node to another.

Connecting node 1’s key output to node 2’s key input lets you use the key from node 1 within node 2. However, this isn’t hugely interesting until we add another type of node to the mix.

Right-clicking within the Clip tab opens a shortcut menu, within which is a submenu you can use to create new, disconnected nodes. Within this list is a node called the Key Mixer.

Creating a Key Mixer node using the shortcut menu inside the Clip tab.

The Key Mixer node can take multiple Key channels from several nodes (as many as you’ll practically need), combining them into a single key that you can then feed into another node to use for secondary correction.

You can probably see where I’m going with this.

Let’s go ahead and wire up the node structure we’ll need. First, we’ll use that shortcut menu to create a Key Mixer node and three Corrector nodes (corrector nodes are the same type of nodes that are used when you add Serial or Parallel nodes); essentially we’re adding one Corrector node for each feature we want to independently isolate using HSL Qualification.

Once the nodes are created, we want to drag connection lines from the RGB output of our original primary correction node 1, and connect them to the RGB inputs of the three Corrector nodes we’ve created. Note that one RGB output can feed as many RGB inputs of different nodes as you like.

Next, we want to connect the triangular Key outputs of the first two corrector nodes to the triangular key inputs of the Key Mixer node. You’ll notice that the Key Mixer node only has two inputs; if we want more, we need to create them by right clicking on the Key Mixer node and choosing “Add One Input” from the shortcut menu. You can add as may inputs as you need, they’ll all get crowded into the space at the left of the node.

Adding a node input to a Key Mixer node.

With the extra Key input created, we can connect the last Corrector node’s Key output. Lastly, we want to connect the Key output of the Key Mixer node (which is outputting the sum of all keys that are input to it) to the Key input of the node that we had originally created to carry the “stylistic” color change. The result should look something like the following.

Connecting the third corrector node to the new node input.

You should note that, until all of the nodes are properly connected, their thumbnails won’t reflect the flow of image data, instead showing the generic node icon. This lets you know which nodes are connected and having an effect, and which nodes aren’t.

With the node tree wired up, now all we need to do is key each element we want to isolate as tightly as possible. Another advantage of this technique is that each individual node can use a combination of HSL qualification and Power Windows to create an aggressive and well-isolated key.

The three keys to be combined.

With the faces, tie, and shirt independently isolated, selecting the Key Mixer node and turning on the Highlight checkbox in the Qualifier tab now shows us the sum total of all three keys added together. By default, the Key Mixer is set to combine all input Keys in an additive way.

Examining the key created by the Key Mixer node with the "Mattes display high contrast black and white" option turned on in the Settings tab of the Config page.

Looking at the final result, we can see that while the stylized correction is still affecting the background, hair, and clothing of the actors, the areas we’ve keyed are now protected from this effect. This is exactly what we want, so we’re done.

However, that’s not the end of the story. Now, let’s take a look at how we can use the Key Mixer to subtract one node from another.

Using the image from Part I, we’ll recreate the same effect, this time subtracting an HSL-qualified key in node 3 from a Power Curve key in node 2, as set up in the following node tree.

Redoing the example in Part I using nodes, instead of internal window/HSL interactions.

When we first set this up, the two keys are automatically added together, just like in the previous example.

The initial, additive key combination that is the Key Mixer's default behavior.

However, what we really want to do is subtract the faces from the “headroom shadow” shape in order to preserve the highlights on the actors. To do this, we’ll select the Key Mixer node and use the controls found in the Key tab.

The Key tab contains additional parameters for altering the key data coming into a node, and the key data going out of the node.

The Key tab contains parameters that govern the keys that are connected to the Key Mixer node, specifically how they interact and whether or not they’re inverted. You’ll notice that there’s only one set of parameters even though there are two inputs coming into the node. This is because you need to select the connection line that corresponds to the node key you want to adjust in order to expose the parameters for that particular key.

Click a connection line to edit that key's parameters in the Key tab.

After selecting the connection line attached to the second input (selected lines are yellow), the Key tab shows the parameters for INPUT LINK 2.

These parameters are similar to those found in the Window tab. In particular, clicking Mask (subtract from), and then turning on the Invert checkbox sets this input up to subtract itself from the other key connected to input 1.

Setting one node's key to subtract from the others in the Key Mixer node's Key tab controls.

The result can be immediately seen if we turn the Highlight checkbox on in the Qualifier tab.

The key in node 3 is now subtracted from the key in node 2.

At this point, we’ve got the matte we need, and we can select node 4 and lower the midtones to darken the above area. Unfortunately, the result is that the black portion of the key has gone darker, instead of the white portion. What’s up?

You need to turn off the Invert parameter of the External key to get the effect you want.

If you open up the Key tab while node 4 is selected, you’ll see two sets of parameters. The External Key parameters govern the behavior of keys that are routed to that node via the Key Input connection.

By default, the External Key parameters of new correction nodes have the Invert checkbox turned on. Turning this off correctly sets the node to darken the top region, rather then the bottom.

Turning off Invert for the external key in node 4 to change which portion of the image we're grading.

The resulting node tree thumbnails show how all the keys are interacting as they’re fed from node to node to node.

The final node arrangement, with each node's thumbnail reflecting the current key settings.

The end result, while in need of refinement, shows the correct effect.

The final image, showing the result of all this fancy nodal footwork.

And that’s all there is to it. Good grading!

Special thanks to Director Bill Kirstein for clips from Osiris Ford.

You may also like


Jane Wyler December 5, 2010 - 3:57 pm

Alexis thank you for taking the time to expand on this theory. Between your site and the book we’re learning more about Resolve than from the ‘Manual’.

A question regarding the first example of the key mixer node:
How would one in this situation then be able to manipulate each of the individual items feeding the key mixer node. In other words in your example if you wanted to tweak just the tie or just the skin tone that have already been keyed?


Leo May 27, 2020 - 4:23 pm

Hey dude. Great stuff! Excellent detail. It’s al the small things that can drive one crazy in the resolve interface (or AE for that matter).
I have a big boring question: When grading limited 8bit 4:2:0 footage I often come upon the problem of being unable to properly qualify the skin (sp. when there’s bad light). Quite the challenge. Is it possible to make a qualifier key, say, using 3D or HSL, and then the part of the face that will not qualify (unless you destroy the key which defeats the purpose) in another node, with another key. So a key within a key, 2 keys adding into one of the same section. So not the face adding with the tie. But part of the face adding with another part of the face, so that between the 2 we can get a complete, solid key?

I often blur to max, make the key and only connect the alpha of these to the next node.

Thank in advance and top work!!

alexis June 11, 2020 - 11:53 am

You can absolutely do this, use two nodes, pull each half of the key in each node, and then use a Key Mixer node to combine both keys into a single key that you can connect to the KEY input of the node you want to make the adjustment in.

Rob Ruffo December 7, 2011 - 2:36 am

Jane, just select the node that contains the qualif. you want to tweak, and tweak away.

July: Color Correction July 23, 2012 - 12:26 am

[…] Combining Mattes In DaVinci Resolve Part 2 – Alexis Van Hurkman walks us through what I mentioned above, pulling an HSL on faces and using a custom shape to help isolate the qualification. Good stuff. […]

Dan Diaz February 7, 2013 - 4:36 pm

How do you do this in resolve 9?

Alexis February 7, 2013 - 5:26 pm

This works exactly the same in Resolve 9, except that the Key tab is replaced by the Key palette, and the mask/matte radio buttons are replaced by a single, toggling mask/matte button. If you search the Resolve 9 manual for “key mixer” you’ll find an explanation of the new UI. At some point, I’ll see about revisiting these older articles and updating them, but it won’t be happening any time soon.

Marco De Stefanis November 21, 2013 - 7:21 am

Hi Alexis,

I was wondering if there is a way to get a monochrome image created with the RGB mixer to work as luma matte. I found really useful to separate foregrounds from backgrounds or isolate skin tones by changing the RGB sliders in the RGB mixer set as monochrome. If only it would be a way to use this image as luma matte I would have a lot of control.

Alexis December 2, 2013 - 11:14 am

Right at the moment, there’s no way of using an RGB image as a KEY inside of Resolve. I wish there was, there are a lot of things that could be done using this technique.

Lewi Lewis March 26, 2015 - 2:09 pm

Alexis says:
December 2, 2013 at 11:14 am
Right at the moment, there’s no way of using an RGB image as a KEY inside of Resolve.

Is this doable in Resolve 11 yet ?

Alexis May 19, 2015 - 11:46 pm

You cannot connect the RGB output of one node to the KEY input of another in version 11. Happily, I’m able to report that you will be able to do this in the upcoming version 12, it was one of the new features announced at NAB.

Hans August 1, 2016 - 12:20 pm

Hi Alexis,
I’m looking for some way to combine two different White Balance settings in one shot. The effect I’m looking for is the most natural way to enhance color contrast. Imagine a sunrise scene where I would want to warm and exaggerate the warm tones of the sunlit parts but at the same time cool down the shadow parts. Is there a way to do this with white balance you think?
Best regards,

Alexis November 21, 2016 - 10:53 am

For this kind of grade, the easiest thing you can do is to just use a simple Luma key to isolate the highlights you want to grade with one color temp, and then use an Outside node to grade the remaining shadows with another color temp. There are lots of other ways to do this, but honestly, this is probably the fastest way to go.

Hans De Bok February 19, 2017 - 2:19 am

Thanks for your reply Alexis. That’s sounds like a good way to do it. Is there a way to use the raw Kelvin and Hue sliders for both grades (warm and cold)?
Best, Hans

alexis February 25, 2017 - 8:04 pm

If I’m understanding your question properly, not with the Raw controls, because they affect the source. However, if you use the Temp and Tint controls of the Color Wheels palette, you can make an adjustment to inside of the matte via one corrector node, then add an “outside” node and make an adjustment to the outside of the matte that way.

John Reed April 24, 2017 - 9:30 pm

I can’t get an external matte to work in resolve 12. I have watched a number of tutorials and followed them step by step still no success. The matte (if a animation) never plays. It’s as if the external matte is not connected to the footage node.
Also when I add the external matte to the node it is referenced as a timeline matte not a track matte like the tutorials say. Is this correct?

alexis May 7, 2017 - 11:19 am

If you need to connect an animated matte to a specific clip, then you need to follow the procedure on page 211 of the Resolve 12.5 manual, or page 182 of the Resolve 14 (beta) manual in order to “assign” a matte to a specific clip. Then you can use the procedures on page 1001 of the Resolve 12.5 manual, or page 904 of the Resolve 14 (beta) manual to use that matte.


Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More