AnimationMaker 1.2

The new version of my animation tool for Nuke is now available! Please feel free to download and replace the old one. It’s a simple python script that you drop into your .nuke or plugins folder, then add one line to your menu.py (“import AnimationMaker”).

Download here

See the previous version for more information, but here’s what’s new:

  1. New blue colour scheme and better layout.
  2. Presets system added, so you can save frequently used setups eg: “Fast noise”, “Random blinking”. These are saved in an xml file in the same location as AnimationMaker.py.Screen Shot 2016-12-10 at 00.26.37.png
  3. Turbulence and fBm waves added, for more interesting noise patterns.Screen Shot 2016-12-10 at 00.29.46.pngScreen Shot 2016-12-10 at 00.31.17.png
  4. Use arrow keys to increment/decrement values on the main interface.
  5. Remove the generated tab, baking the current values into a single expression for the knob.
  6. Remove the generated tab and restore the original value/curve.
  7. Mix the expression back to a given value/curve. As you can animate this mix value, it means you can turn the wave on and off over time. You can also choose to mix it back to the original value/curve, so you can now generate/remove multiple times on the same knob to create really complex patterns.Screen Shot 2016-12-08 at 23.53.11.png
  8. Add the expression to the original value/curve. For example: create a curve in nuke with keyframes, then run AnimationMaker on that knob with a fast noise pattern from -0.1 to 0.1. Choose Add and it will give you the original curve with noise added.Screen Shot 2016-12-09 at 00.04.29.pngScreen Shot 2016-12-09 at 00.05.10.png

Tested on Nuke 10 on Linux and Mac, so if you have any issues on Windows let me know.

Nuke: batch convert images

Convert a folder of images from one format to another using Nuke

NukeConvert

I made a python script that will take a folder of images and convert them to your format of choice using Nuke in command line mode. It can also iterate through all the subfolders and rebuild the tree in the destination, converting any images it finds. Handy for converting a bunch of dpx files to jpg for a website, or converting a whole tree of CG passes from one format to another. It goes through Nuke so default colourspaces for each format are applied. The script sets jpgs to 100% quality and sets exrs to the format that is most efficient for Nuke. So if your CG passes are in the wrong exr format, you could run them through this to speed up your comp.

Runs in a linux terminal. Look in the .py file for examples of how to call it.

Friendly version

Some users are not keen on typing long commands into the terminal so I have also made a GUI interface which you can run directly from a Nuke menu. Just add the menu item, using the example menu.py line included, and when you run the tool in Nuke it will bring up a friendly dialog asking for the source and destination directories and other options. When you press OK, it loads a terminal and runs the above script using the options you gave. Though I could run it completely invisibly, I chose to run it in a terminal so you could see its progress and estimated time left. So even though you are launching it from within Nuke, it’s running a separate background instance of Nuke to do the converting. You can carry on comping.

In a good pipeline you shouldn’t have to do conversions like this but there’s always some unusual circumstance where a bunch of files need to be converted for one reason or another. A handy tool to have in those situations, or if in a more ad-hoc environment.

Download here

Animation Maker

Ease curves in Nuke, with just a right-click.

menu

I have made a little extension to Nuke that when right-clicking any animatable value on any node you can choose ‘Animation Maker…‘ from the pop up menu and a whole suite of customisable animation curves can be chosen. When you’re happy, it generates the expression to form that curve and puts it into the knob in question. It also adds a user tab to the node with sliders so you can refine it on the fly. No extra nodes or expression lines in your script and it’s available everywhere.

It does all the maths for you.

Contains ease curves such as Quad, Exponential, Bounce and Elastic. Wave curves such as Sine, Random, Noise, Triangle and Sawtooth. Options to combine a wave with an ease curve, turn a wave into a ‘square’ version or create a sequence of blips at certain intervals.

All contained in one .py file. No gizmos required. Just put the file in your .nuke directory (or wherever your plugins directory is located), then add two lines to your menu.py.

Download here

This supersedes my previous WaveMaker tool, so no need to have both installed.

AnimMaker

Pop up dialogue in Ease mode, showing the motion with a growing circle, a moving circle and a circle fading from black to white.

AnimMaker2

Pop up dialogue in Wave mode showing an example noise wave.

tab

When CREATE is pressed, a new tab like this will appear on the node.

expression

An expression will be put into the chosen knob which is linked to the new tab’s controls.

easeout

An example Expo Ease Out curve

ease

An example Expo Ease In curve

easeinandout

An example Expo Ease In & Out curve

bounce

An example Bounce curve

elastic

An example Elastic curve

noise

An example Noise wave

waveEase

An example Sine wave combined with a Linear ease in.

blip

An example Blip animation made from a Sine wave.

Nuke: Normalizing animation curves

I have written a little tool to help turn animation curves into more useable numbers. I’ve called it CurveConverter and it’s just a node that takes an input curve and generates an output curve. Copy any animation into the input, then control other animations in your comp by linking them to the output.

Image

Why is this useful?

Any time you have an animated value in your script that you wish to use to drive other animations, you will most likely have to multiply it by another value to get it into a useable range or scale it by hand in the curve editor. You might have to fiddle a while to get the peak and trough values to be where you want them. With this tool you don’t need to do any maths or manual scaling, just copy the curve across and enter your minimum and maximum values. It will scale the curve so that the highest peak is your maximum value and the lowest trough is your minimum value.

Image

Practical example:

You have a plate with flickering fire light and you need to create a patch or CG character with flickering lighting to match. You might use a CurveTool node to analyze the average intensity of the plate (giving values perhaps between 0.028 and 1.124). Normally you might then link a grade node to that animation curve and work out what value you need to multiply by to get a good result.

Instead, go to a dark frame and adjust your grade node so your patch matches (perhaps using the multiply or gain), copy that value into the ‘New min value’ of a CurveConverter node. Then go to a bright frame, adjust to match then copy the value into the ‘New max value’. The patch should now animate between those two settings.

Alternatively, use a CurveConverter tool to convert that curve into values between 0 and 1. Then connect the result to a Dissolve node to switch between a dark grade setup and a bright grade setup. This way would allow you to do more complex grade adjustments in the two lighting states.

Another application would be matching animation to an audio curve.

FrameHold default to current frame

Quick one this:

Framehold

Bearing in mind that 99% of the time when we create a FrameHold node we want to hold the current frame, usually as part of a frozen camera projection. Yet FrameHold defaults to frame 0. Yes, it only takes a second to peer down at the timeline and write in the frame you want, but your time is precious so why put up with that?

You can always write the word ‘frame’ into any value and it will turn into the current frame number, but that’s still 5 key taps that you, a person with your talents, shouldn’t have to be making.

If you have access to your menu.py, simply add this line to make every FrameHold you make automatically use the current frame when it’s created (should be all one line):

nuke.menu(‘Nodes’).addCommand( “Time/FrameHold”, “nuke.createNode(‘FrameHold’)[‘first_frame’].setValue( nuke.frame() )”, icon=’FrameHold.png’)

It’s nothing complicated, just overrides the normal FrameHold menu item, creates a FrameHold in the same way, but uses the nuke.frame() function to grab the current frame number at the time of creation.

Mocha ASCII Importer

MochaImport

Just made a python script to help quickly import Mocha tracker data into Nuke 7’s wonderful new tracker. Of course, you can export a Nuke CornerPin from Mocha, but having the four tracks inside a tracker node allows you to create cornerpins, transforms, average tracks, add other tracks etc.

The easy answer is to create a tracker with four tracks and manually copy the animation from the cornerpin or load the four ascii files one by one into each tracker.

If you use Mocha a lot, this can be laborious. So this script asks you to locate one of the four Nuke ASCII files you exported from Mocha, then burps out a tracker node with all the tracks inside. Anything to shave off precious seconds I say.

Download the python script here

Nuke: blip expressions to copy and paste

Using waves to drive animation in Nuke – part 2

In my previous article on this subject I gave some examples of expressions that you can just copy and paste into any value in Nuke to quickly create an infinitely repeating animating pattern. I was asked in the comments how to do a ‘blink expression every x frames’. I answered with ‘just use the square wave example’, but I realised that’s not what he was after. In this article I’ll give you some expressions that can be used for such a blink or ‘blip’ animation curve.

I have also made a new version of my gizmo WaveMaker that incorporates all of this, so you can download that if you’d prefer. It’s now in .nk format rather than .gizmo so it’s easier to share.

Square on/off blip every n frames

(((((sin(((frame*(pi*2/(freq/2))/2)+offset))+1)/2)) > cutoff ? 1 : 0) * (maxVal-minVal) ) + minVal

(Where ‘freq’ is the number of frames between blips, ‘offset’ is the time offset, ‘cutoff’ is a value between 0 and 1 which controls the width of each blip, ‘minVal’ is the lower value, ‘maxVal’ is the upper value. As in the previous article, either replace these variable names with your values, or better still, create a NoOp node, add some user knobs with those names and you’ll be able to adjust it on the fly)

Simpler version: ((( sin( ( ( frame * ( pi * 2 / ( 5 / 2 ) ) / 2 ) + 0.5 ) ) + 1 ) / 2 ) ) > 0.95 ? 1 : 0

(Blip pattern between 0 and 1, replace the ‘5’ to adjust amount of frames between blips, adjust the ‘0.5’ to move the whole thing back and forth in time, and adjust the ‘0.95’ to adjust the width of the blips)

So what’s it doing?

It’s really just a simple sine wave with another expression applied to see when that sine wave goes above the cutoff point. If so, set the value to 1, if not, set it to zero. If a high enough cutoff point is given (like 0.95) most of the time the sine wave will be below that value and only at the very tip of the peak go above it. The lower the cutoff, the longer the peak rises above the cutoff point and so the blip gets wider.

But if you need something a bit smoother than a simple on/off, I’ve also made this version:

Smooth pulse-like blip every n frames

(min((max((((((sin(((frame*(pi*2/(freq/2))/2)+offset))+1)/2)) > cutoff ? (((sin(((frame*(pi*2/(freq/2))/2)+offset))+1)/2)) : 0)) – cutoff,0) * (1/(1-cutoff)) * 1.001),1) * (maxVal-minVal) ) + minVal

Slightly simpler version: (min( (max( ((((( sin( (( frame*( pi * 2 / ( 10 / 2 ) ) / 2 ) + 1.55 )) + 1 ) / 2 )) > 0.7 ? (((sin( ( (frame * ( pi * 2 / ( 10 / 2 ) ) / 2 ) + 1.55 ) ) + 1 ) / 2 )) : 0 )) – 0.7 , 0 ) * ( 1 / ( 1 – 0.7 )) * 1.001) , 1 ))

(Smooth blip pattern between 0 and 1, replace the ’10’s to adjust amount of frames between blips, adjust the ‘1.55’s to move the whole thing back and forth in time, and adjust the ‘0.7’s to adjust the width of the blips)

Multiple blips

To make a complex repeating pattern of blips, create several user knobs using the above expressions, set to different values, then in another user knob max them all together:

max( max( blip1, blip2 ) , blip3 )

Manual looping

Remember, if you just need a quick repeating pattern for one thing in one shot, then building all these expressions is probably overkill because you can just draw a pattern in the curve editor, then tell Nuke to loop that pattern. This is more for the cases where you may have several things blinking on and off at different rates (perhaps a HUD, graphics display or warning lights on buildings), and you may need to go and adjust them all later. I personally wouldn’t go to the trouble of building all the knobs each time, that’s why I built BlipMaker into my WaveMaker gizmo so it’s available whenever I need it. My article where I took all my expressions from WaveMaker and made them available for quick copying and pasting has proved rather popular though so I thought I’d do the same for BlipMaker.