• menu tutorialsRandom Tip:
    page up and page down keys cycle through your available layers in the viewer

  • menu tutorialsRandom Tip:
    Bit depth is only relavent as it relates to gamut and needed gradation with in that gamut
  • menu tutorialsRandom Tip:
    Alt+up/down arrow will change version numbers in Read and Write nodes' file paths
  • menu tutorialsRandom Tip:
    Many text-related knobs will accept basic HTML, e.g. in a node's label knob: <b>bold text</b> <i>italics</i>
  • menu tutorialsRandom Tip:
    Ctrl+Click (LMB) on a tab will detach it from a panel​​​​​

  • menu tutorialsRandom Tip:
    There's a Nuke IRC chat room on foonetic.com , the channel is #nuke

  • menu tutorialsRandom Tip:
    When working with the Properties Bin you can use Ctrl+Double Click on a node to open it as a float window
  • menu tutorialsRandom Tip:
    Not all exr files are equal in nuke. Try to insure scanline exrs for best results
  • menu tutorialsRandom Tip:
    holding shift while click+dragging a connected arrow head or tail will copy the respective pipe to create another connection

  • menu tutorialsRandom Tip:
    hover the mouse pointer over any knob to see it's tooltip help

  • menu tutorialsRandom Tip:
    You can use Ctrl+T to cycle between panels of a pane
  • menu tutorialsRandom Tip:
    holding ctrl and click+dragging to the left of a digit in a number field will turn on the virtual slider for that decimal position 

  • menu tutorialsRandom Tip:
    "/"-key on the numberpad lets you search for nodes in the DAG by name
  • menu tutorialsRandom Tip:
    Use Alt+W to draw a ROI in the viewer

  • menu tutorialsRandom Tip:
    Quick tap the space bar to maximize a pane and hold it a bit longer to open the right-click menu

  • menu tutorialsRandom Tip:
    Ctrl + click & drag a node to select and move its upstream tree along with it

  • menu tutorialsRandom Tip:
    Middle clicking a menu item from the toolbar recalls the last node/tool used from that menu

  • menu tutorialsRandom Tip:
    holding ctrl/cmd+shift when dropping a node on top of another will swap their positions and connections in the tree

  • menu tutorialsRandom Tip:
    Use MMB+Drag in the Viewer's timeline to zoom a region, Alt+LMB+Drag to pan it and MMB+Click to zoom-to-fit
  • menu tutorialsRandom Tip:
    When working with floating viewers use Ctrl+R or Command+R to have the viewer window resized to fit it's contents

  • menu tutorialsRandom Tip:
    You can scroll the Properties Bin by Alt+Clicking & dragging labels of nodes
  • menu tutorialsRandom Tip:
    sign up to the official mailing lists through Nuke's help menu

  • menu tutorialsRandom Tip:
    You can toggle full screen for most floating panels in Nuke by using Alt+S
  • menu tutorialsRandom Tip:
    shift+number key on a selected node loads the respective buffer into wipe mode

  • menu tutorialsRandom Tip:
    Use J to select a backdrop and jump to it in the DAG
  • menu tutorialsRandom Tip:
    "$gui" in expressions will return 1 in the UI and 0 at render time. Great for enabling nodes only on the render farm.

  • menu tutorialsRandom Tip:
    Use Shift+{ and Shift+} to hide/show the top and bottom toolbars of a Viewer
  • menu tutorialsRandom Tip:
    Shift + escape closes the current group tab in the DAG (alt + escape on OSX)

  • menu tutorialsRandom Tip:
    use the number pad to nudge any selected OSC (on screen control). The modifier keys effect the increments

Use of expressions to modify animation curves

Written by Ivan Busquets on .


Timing changes can be quite a headache in most compositing packages.
Here's a few cases where the use of expressions can be of great help when dealing with time modifiers (frame holds, time offsets, time warps…)

1- Freezing an animation to a certain frame (FrameHold)

The syntax curve(frame) is one of the simplest and yet most useful ways to handle time within an expression. It means "take the value of this animation (curve), at this frame".
This can be used on any animated knob, but it's most useful on 3d operators, since one cannot simply attach a FrameHold node to them (yet).

Here's a very common scenario: you have a plate and a matchmoved camera and want to set up a projection based on a still frame from the plate. You can either make a copy of your camera and delete its animation to make it static at the frame of your choice, or use an expression to dynamically freeze the camera's animation based on a separate FrameHold, which you can later change if you wish to choose a different frame for your projection.



frameHold_expThe above setup can be easily accomplished by using the following expression in any animated knob in the projection camera:




The same expression can be used in the label of the projection camera to show the frame being used at all times. Like this:




- Offseting an animation in time (TimeOffset)

This works almost identically to the previous case.
Let's say you have a camera that matches your plate. Now, in your comp, you're offsetting that plate in time.
You can still dynamically reference the animation of the camera by using a curve(frame+offset) expression.

Like this:




- Retiming an animation (TimeWarp, OFlow, F_Kronos)

Again, using the same expression syntax, a retime curve can also be referenced so your animation is retimed the same way your footage is.

Here's an example using the retime data from a Timewarp node to retime the animation of a Transform node:


If you're using a OFlow or F_Kronos, you'll have to reference the "timingFrame" and "frame" knobs respectively, instead of the lookup knob.

Additionally, OFlow and F_Kronos can use two different methods to describe a retime: a lookup curve (source frame) or an overall speed.

If you want your expression to work correctly regardless of the method used, you could include a condition so it handles both methods. This way you can work on your OFlow or F_Kronos as you like, and make sure your animation curves carry those changes live.

Here's how the expressions would look like for all three kind of nodes:



- Inverting a retime curve (undoing a retime using the "inverse" expression)

Say you have a retime curve you need to get the inverse of. For example, you animated (or tracked) something to an already retimed plate, and now that retime has changed. Ideally, you'd want to un-apply the first retime from your curve, and then apply the new one.

There's at least 2 ways in which you could approach this:

  1. Take the old retime curve, and invert it in the Curve Editor by doing Edit->Move… and then switch the x and y values of the curve. From here, you can apply this "inverted" curve to your animation curve as described in "Retiming an animation"
  2. Use the built in "inverse" expression method. This is ideal if you're still making changes to the original curve. However, keep in mind the "inverse" method will only work on curves that have a positive derivative everywhere. In other words, it only works with curves/retimes where the frame number only increases (ie., no backwards retime, ping-pongs, or anything where the frame number decreases with time)


To use the inverse method, just use curve.inverse, or nodename.knobname.inverse, where nodename.knobname contains an animation curve. Like this:




- Finding the slope/speed of a curve at a certain point (derivative expression)

The derivative expression can be very handy for motion graphics, or in any scenario where you'd like to animate something depending on the "speed" of an animated curve.

Imagine you have a retime curve and you want to do some creative grading as your clip slows down/speeds up. Or, you have tracked an object (a magic wand, for example), and want it to get brighter the faster it moves. Or, you're animating a wheel, and want it to rotate faster the faster it moves across the screen. You get the picture. In all of these cases, the derivative expression can be of great help.

How to use it:

The syntax is curve.derivative, and it will return the first derivative of that curve at the current frame. That is, how much do the values in the current curve change between the current frame and the next. This illustration explains it better:


So, by using the expression curve.derivative on the above curve, you get 1 for frames 1 to 9, 0 on frame 10, -2 on frames 11 to 14, and then 0 again on frame 15.

It is then up to you to use those values on any other knob, and modify them as needed (normalize them, scale them...) so they're suited for your purpose (rotation, color correction,...).

The derivative expression can take 2 optional values, with the one of the following syntaxes:

  • curve.derivative(frame)
  • curve.derivative(n, frame)

- frame is the frame we're calculating the derivative for. Default is the current frame. You could use something like curve.derivative(1,frame-5) to get the first derivative of this curve with a delay of 5 frames, for example.

- n represents the nth derivative. The default is one (for first derivative), but you can set it to 2 to return the second derivative. The second derivative can be described as the derivative of the first derivative. A good analogy of what that means is: on a moving car, the first derivative would be its change in position along time (=speed), and the second derivative would be the change in speed along time (=acceleration). So, if you want to animate something to the acceleration of an object instead of its speed, try the second derivative.


- Finding the average of a curve (integrate expression)

The integrate of a curve between points A and B is usually described as the area below that curve for that slice (A to B). Integration is also often used to find the average value of a function (curve) between two points. This can come in quite handy for complex curves, so let's see how we can use it in Nuke to get the average value of a curve between two frames:

Say you have a curve that produces a flickering effect. Something like this:


Now you want to know the average value of that curve between frames 0 and 100. You can do so using an expression with the following syntax:

curve.integrate(first frame, last frame)/(number of frames)

This would calculate the integrate of a curve between 'first frame' and 'last frame'. The result would be the aggregate of values between the 2 specified frames, or the area below that slice of the curve. So, dividing that by the total number of frames, we get the average value. Using the above curve as an example, the expression field would look like this:



+1 # behram patel 2010-10-09 03:49
the most simplest & practical explanation of a derivative in any CG related material i have ever read.
Huge thanks to you Ivan


0 # Aled Rhys Jones 2011-03-23 11:02
Although I now know derivatives, how do I apply it? my example is a 1pt track and I want the x value to affect the rotation of the object I'm attaching to it.
How would I write the expression into the Rotation given that my input would be "Tracker1.track1.x"?

Just a little note that I haven't yet learned expressions with Nuke, though I did use them quite a bit with After Effects.
0 # behram patel 2011-03-25 00:33
Hey Aled,

0 # Marko Zaric 2012-01-03 11:41
Hi Ivan.

Great explanations!

but I have a question.

Is there a way to connect time offset and switch?

I have time offset node at frame 35 and i want my switch to be 0 until then, and to 1 at frame 36
Is this even possible?

thanks in advance
0 # Ivan Busquets 2012-01-03 15:06
Hi Marko,

I'm not sure I understand the question, but here's a couple of tips that might be what you're after:
To have your Switch node switch from 0 to 1 at frame 35, you could use an expression like:


If, instead of frame 35, you want to use the frame value of your TimeOffset node, then you could do (assuming your TimeOffset node is called "TimeOffset1"):


Is that what you were looking for?

0 # Marko Zaric 2012-01-03 23:31
Hi Ivan.

Thanks for fast answer!
Yes that it exactly what i was looking for. It works like i need it.

Once again thank You very much.


0 # sridharan Kay 2012-04-10 02:03
Hy Ivan... thnx for ur valuable information...

I hav a question.... I tracked the plate of 100 frames... Now they want the ping pong of the shot with 200 frames... i achieved the result for my scans... how to do ping pong for my tracking information... is there any expression for that.. plz do needful...
0 # Ivan Busquets 2012-04-11 12:05
Hi sridharan,

There's a couple of things you could do:
You can create a TimeWarp node that matches your ping-pong retime. You would just need a keyframe on the first frame, another one on frame 100, and one last one on frame 199, mapped to your first frame again. Then, in your tracker, you would just use one of the example expressions above (look under "Retiming an animation" to see how you can use a TimeWarp node for that)

Alternatively, if you want to manually set up your expression, it should read something like this:

0 # Ivan Busquets 2012-04-11 12:08
Ooops, the last comment got cut short...

The expression to set it up manually would read like this for your case:

0 # Ivan Busquets 2012-04-11 12:13
Ok, so something is weird with the comments system, where typing certain characters cuts the message at that point.

I'll try again, without using those symbols :-)

curve(frame LESS_THAN_OR_EQ UAL_TO 100 ? frame : 200 - frame)

Replace LESS_THAN_OR_EQ UAL_TO with the appropriate characters :-)

Hope that helps
0 # Chetal Gazdar 2014-06-30 07:25
is there any way to find first and last keyframe number ??
0 # zaf er 2014-12-15 16:00
Hi, i m a total expression noob , can anyone please guide me where i should start to learn nuke expressions. Thanks.

You have no rights to post comments

We have 110 guests and 3 members online