TransformInterpolate

Interpolate between transforms of two node inputs, works with all transform based nodes and their combinations.

Updated: 13 November 2020

Author: hendrik

Compatible Nuke versions: 11.3 or later

Compatibility: Linux 64, Windows 64

What it does

TransformInterpolate takes two inputs, B and A and linearly interpolates between their concatenated transforms based on factor value. If inputs are not derived from Transform op, their incoming matrix will be identity matrix (has no effect). This property can be used for easily interpolating between transformed image and original by simply leaving A input disconnected.

Plugin has working motion blur, including blurring the result of animating just the factor value when both input transforms are static. There is a specific problem in some cases as discussed below.

TransformInterpolate v1.1 example

How to use

Connect image input to B, this is where the transformed image data comes from, and optionally connect some other transform based node to input A. Input A does not have to be connected to any image, because transform does not rely on having any image data. Plugin can handle mixed inputs, meaning transforming from cornerpin to transform and vice versa and also multiple transforms in a row.

TransformInterpolate combinations

 

Node has two simple controls, interpolaton factor (0.0 is B input, 1.0 is A input) and checkbox to trigger between interpolation based on decomposed transform components or interpolation based on moving corner points. Motion blur knobs and their behavior is identical to other transform ops. Version 1.1 has added extra slider CP compensation  to force corner points based compensation on top of default transform. Since it can give strange results, it is off by default. It can be useful if one wants to preserve the rotation and scale of decomposition but also use cornerpin based inputs.

TransformInterpolate v1.1 knobs

 

How does it work

Interpolation uses 4x4 transform matrices internally, which means that it does not interpolate the translation, rotation, scale etc values as seen in Transform node. This has both its upsides and also downs. Upside is that it can interpolate between a cornerpin (which contains perspective transform) and basic transforms (affine, with no perspective component). Downside is that there is no right way to interpolate matrices so that it produces a visually meaningful result. Decomposition to original transform components is nontrivial and can produce weird values. Thus, interpolating over these decomposed components is also problematic in some cases.

Regarding motion blur, there is a small problem with UI freesing for a few seconds that shows up in some cases, usually when switching between nodes and when properties panel is open. Not sure what the reason is, I suspect something related to context switching which is necessary for proper motion blur. Does not happen when motion blur is not enabled, so workaround is to enable motion blur only for rendering.

Installing

Copy the /hpTools folder to your Nuke plugin directory (~/.nuke etc) and add lines from init.py and menu.py to your respective files. Plugin is compiled for Nuke 11.3, 12.0, 12.1 and 12.2 versions and python code makes sure proper library is loaded.

Version 1.3

Nuke 12.2 binaries added for Win and Linux. Please update your init.py and menu.py files for Nuke 12.2 use!

Version 1.2

Enhanced motion blur. Transform matrices are now correctly calculated when motion blur is enabled and interpolation is between static and animated input transforms.

Version 1.1

Modified default interpolation, it tries to interpolate in a way that image center moves in straight line. New parameter was added that allows forcing cornerpin based compensation mechanism on top of default decomposition interpolation to handle cornerpins better.

Version 1.0

First working functional version but some things can be improved. Interpolation gives funky results when difference between input transforms is bigger, and motion blur doesn't work as expected when one input is animated and another is static.

Sign in or register to download or rate.