Blending Between Cameras In Nuke

Mix between cameras or hand over from one camera to another by using a simple dissolve expression…

Blending Between Cameras In Nuke

Mix between cameras or hand over from one camera to another by using a simple dissolve expression…

💡
This article was born out of a discussion we had in the Companions group chat.

Blending between cameras in Nuke.

Dissolving Between Inputs

Let’s say that you have two different cameras in Nuke, Camera1 and Camera2, and you want to either stitch them together or blend between the two camera movements. 

Two cameras will typically not follow the exact same animation curve, and they may not line up perfectly on the specific frame(s) that you want to handover/blend between them. 

A useful way to line them up is by dissolving the animation curves between the two cameras. 

A full dissolve from one input to another works by starting out with only the values of the first input, and then gradually blending them towards the second input’s values, until at the end we’re left with only the second input’s values. 

So at the start, we want to have all of the first input’s values, and none of the second input’s values. And vice versa at the end. In between, we should have a mix between the two, with the second input's values gaining more and more influence depending on how far along we are in the dissolve.

To put this into mathematical terms, we can make a general dissolve expression: 

First input’s values * mix + Second input’s values * (1 - mix)

– Where mix is a value between 0 and 1. 

If we plug in 1 as the mix value in the expression above, we get only the first input’s values as the output. If we plug in 0 as the mix value, we get only the second input’s values. 

Should we put 0.5 as the mix value, we would get a half and half blend between the two inputs’ values. 

A mix value of 0.25 would get us 25% of the first input’s values and 75% of the second input’s values. And so on. 

We can use this approach to blend between cameras: 

Dissolving Between Cameras

Make a third camera, Camera3

This will become our blended camera. First, let’s add a control for the mix value. Right-click on Camera3’s properties and choose Manage User knobs… 

Then, click on the Add drop-down menu and select Floating Point Slider. Name it mix, label it Mix, and leave the Minimum value at 0 and Maximum value at 1. 

This will create a User tab in Camera3 with a slider which we can animate between 0 and 1 for our blending. 

Next, we just need to go into every animation knob of this Camera3 and add in the dissolve expression: 

Translate

(Camera1.translate * this.mix) + (Camera2.translate * (1 - this.mix))

Rotate

(Camera1.rotate * this.mix) + (Camera2.rotate * (1 - this.mix))

Scale

(Camera1.scaling * this.mix) + (Camera2.scaling * (1 - this.mix))

Uniform Scale

(Camera1.uniform_scale * this.mix) + (Camera2.uniform_scale * (1 - this.mix))

Skew

(Camera1.skew * this.mix) + (Camera2.skew * (1 - this.mix))

Pivot Translate

(Camera1.pivot * this.mix) + (Camera2.pivot * (1 - this.mix))

Pivot Rotate

(Camera1.pivot_rotate * this.mix) + (Camera2.pivot_rotate * (1 - this.mix))

Focal Length

(Camera1.focal * this.mix) + (Camera2.focal * (1 - this.mix))

Horizontal Aperture

(Camera1.haperture * this.mix) + (Camera2.haperture * (1 - this.mix))

Vertical Aperture

(Camera1.vaperture * this.mix) + (Camera2.vaperture * (1 - this.mix))

Near

(Camera1.near * this.mix) + (Camera2.near * (1 - this.mix))

Far

(Camera1.far * this.mix) + (Camera2.far * (1 - this.mix))

Window Translate

(Camera1.win_translate * this.mix) + (Camera2.win_translate * (1 - this.mix))

Window Scale

(Camera1.win_scale * this.mix) + (Camera2.win_scale * (1 - this.mix))

Window Roll

(Camera1.winroll * this.mix) + (Camera2.winroll * (1 - this.mix))

And that’s it – you can now animate the mix slider to steer Camera3 towards Camera1’s or Camera2’s animation curve. 

💡
Here is a tool which does the same thing that’s shown in the article: mixture_cam. Notice that it hasn’t got all of the expressions above – add in the missing ones you need as necessary. 

I hope you found this tutorial useful. For more Nuke tips & tricks, see Nuke.