Advanced Calculations Using The Number Fields In Nuke

There is no need to break out your old TI-86, Nuke has got you covered…

Advanced Calculations Using The Number Fields In Nuke

You may already be aware that Nuke has a handy feature where you can use almost any number field in a node's properties as a calculator.

-

Take a Grade node, for example, and let us say that you want to find 25% of 3.88. You can multiply 3.88 by 0.25 in any of the number fields, for example in the gain field:

-
-

Then hit enter, and Nuke will calculate the result for you: 0.97.

-

💡 The number field that pops up when you click on a keyframe point in the Curve Editor and then double-click its values does not support performing calculations and may crash Nuke if you attempt it.

-
-

Having this built-in calculator can be useful for many things, for example when addressing client notes. For instance, if you get a note to reduce the highlights by 15%, you can then just multiply your value by 0.85.

-

💡 One caveat is that you should always double check that the visual change corresponds with your adjustment. Sometimes you will have to multiply by more or less than 0.85 to achieve a 15% visual difference. Especially if something is very bright or very dark.

-

The number fields in Nuke support all of the basic mathematical operations, so you can add, subtract, divide, and multiply to your heart's content. – You may very well already be doing so.

-

Advanced Functions

However, did you know that you can use the same number fields to calculate advanced functions? There are a ton of options, ranging from simple to complex. Below are a few examples:

Finding the square root of a number:

sqrt (x)

where x is the number.

-

Converting degrees to radians, or vice versa:

degrees (x)
or
radians (x)

where x is the angle in radians or degrees, respectively.

-

Rounding a number to the nearest integer:

rint (x)

where x is the number.

-

For a list of all the supported functions, see The Foundry’s website Adding Mathematical Functions to Expressions.

-

These functions can be typed directly into the number fields to be calculated instantly, they can be used in expressions, and they can be interwoven with each other to make more powerful functions. And they can be applied to any animation you have already made.

-

For example, if you have an animation curve and you want to round every value on the curve to the nearest whole number, you can right-click on the animation, select Add expression and type in rint (curve). This is essentially what happens in a Kronos or OFlow node when you select Frame as the Method.

-

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

-
-