Lesson #03 Homemade Despill
This lesson is about how to build your own Despiller. So with Lesson #02 you have now the possibility to decide what´s your favorite way to despill a image. You will learn a bit about how to build a SpillMap and a little bit about mathematics.
Again first load a Reader with our Ape Plate (Download your exr here) and rename .jpg into.exr
First we are going to build a Spill Map. This means this is a Mask where we can locate our Blue Spill within our image. Spilllight is the coloured light that gets bounced from our bluescreen and illuminates our foreground object and changes therefore it´s colour. As we get our Foreground objects keyed and replace the bluescreen with our background the blue spill light will be wrong on will destroy the illusion. Imagine our ape is within a green jungle and not in front of a bluescreen. You should expect in a jungle more of a green spill light.
Infact this is not a bluescreen it´s a blue linen I had at home, but works great for this tutorial.
Ok but how can we mathematically or in NUKE Language define what is Spill. Spill is where the blue channel values are higher than the red or green values.
For this reason we will split our three Colour Channels. Use a Shuffle node and generate a greyscale image of RED, GREEN and BLUE.
this would be the Shuffle for RED, do the same for GREEN and BLUE
If Spill is BLUE higher than RED and GREEN this would look like this in our Comp.
Do a Max Operater Merge (you can try also an Average) on RED and GREEN and Minus this with BLUE.
This will give you your Spill Map because everywhere where BLUE exceeds you will get the difference between BLUE and your RED/GREEN. The higher the Spill the higher the difference, so in this case the higher your grey value. In parts where RED/GREEN is higher than BLUE you will get a negative value, black = no spill. We will clamp away the negative values a little bit later.
Do you see the blue spill light on the face of our Ape and in some parts of his hair.
Ok so how do we use this SpillMap. First create a Constant Colour of our BlueScreen. Then we are going to multiply this with our Spill Map. In this way you will get the coloured Spill on your ape. So now comes the basics of mathematics. If you multiply something with zero it stays zero. If you multiply something with 1 it stays the same value. Everything between it will get lowered by percent. Afterwards we will do a Clamp as there are going to be some Negative Values where RED/GREEN was higher than BLUE.
This Coloured Spill Map we are going to subtract from our Plate, so we are going to take away our Spill Color.
But we actually want to replace our spilllight with the colour of the light from our new Background, imagine here the green jungle.
So we copy create a new Constant multiply it with our grayscale SpillMap, clamp it and plus it on our Spillremoved image. We adjust the Color optically by setting the values as we see how the image changes.
And this is how our despilled image looks like.