Posts Tagged ‘Nuke’

Animate camera through Photoshop layers in Nuke

Posted on:

You can use camera-linked lens-in-focal, lens-in-aperture and z fields in a Card node in Nuke to easily line up and correctly scale layers from a 2D image. These fields are normally used to create a pan & tile dome.

Typically, this kind of motion graphic would be accomplished in Adobe After Effects, but after the switch to node based compositing, I find the layer based approach of AE less intuitive.

3D View

The camera’s horiz aperture and focal length constrain the layer’s dimensions.

Here are the Steps

  1. Get 2D elements
    1. In this case I’m using artwork by Nigel Quarless
    2. Export layers as tiff with transparency (if you are using a simple 8bit Photoshop file, Nuke can handle the file directly).
    3. Drag into Nuke DAG
    4. Order them from left to right, front to back
  2. 3d Setup
    1. Add a camera
      • The (horiz aperture / vert aperture) should equal your project settings’ full size format (w/h) ratio. I’m working in HD (1920/1080), my horiz aperture is 24, so my vert
        aperture
        = 24 * (1080/1920) = 13.5.
      • You can leave the focal length at the default 50 for now
    2. Add a Card node (Card1) to the first FG layer
      • lens-in-focal = parent.Camera1.focal (ctrl drag the focal value from camera1)
      • lens-in-aperture = parent.Camera1.haperture (tcrl drag the horiz aperture value from camera1)
      • z = 1
    3. Duplicate Card1 for each additional layer
      • z = (the previous Card’s z value) + .25
        For example Card2.z = parent.Card1.z+.25 and Card3.z = parent.Card2+.25
    4. Connect everything to a Scene node
  3. Animate Camera
    1. Duplicate Camera1 (Camera2)
    2. In the Viewer, lock to Camera2

      Viewer locked to Camera2

    3. Adjust the focal value of Camera1 so that you can see all the 2d layers.
      • in my case, I had to increase the focal value to 135.
    4. Animate the Camera2′s z value
      1. position playhead at the start of the animation
      2. set a key for z = -2.5 (this value will change based on how many layers you have)
      3. position playhead at the end of the animation
      4. set a key for z = 0
  4. Final steps
    1. Add some 3d motion blur if you want
    2. I wanted the last layer to fill the frame, so I added a transform geo node after the card (see the image below)
    3. reformat and write out.
dag

DAG setup

You can see the project for which this was completed on vimeo. Or see my previous post.

Send to FFmpeg from Nuke Update

Posted on: 1 Comment

Ubuntu 12.04 has moved to avconv from ffmpeg and my previous python script to execute a shell script on Nuke’s afterRender callback needed to be updated appropriately.

Additional changes:

  • The function now takes an arg ‘dnxhd’ to output a movie using the avid codec instead of the default x264.
  • the renderSlug configuration option has been added
    • when false: the movie start frame = the nuke project start frame*
    • when true: the movie start frame = 0

* Note: You always have to render from frame 0 out of Nuke regardless of the project start frame (avconv image sequences always start at 0).

 

Execute FFmpeg Command in Nuke AfterRender Callback

Posted on: 1 Comment

Update: there’s some new code to use avconv insead

Freelancing from home, I don’t have a dedicated render manager. Running Ubuntu 11.10, FFmpeg is the most convenient solution for rendering Quicktime movies for review.

With the help of NathanR and ivanbusquets over at the Nuke forums, I’ve got a working AfterRender callback that spawns a shell subprocess to automate the creation of .mov files from an image sequence rendered out of Nuke.

The Code

Installation

  1. Add the above code to the ~/.nuke/menu.py.
  2. Add sendToFFmpeg() to the afterrender field in the python tab of your write node.

The .mov file should be created one directory up from rendered image sequence.

Note: FFmpeg assumes the image sequence starts at frame 0. At some point I’ll have to add an offset to adjust for those that don’t.

Nuke Python Script setProjectFrameRange

Posted on:

Often we receive plates with frame ranges that don’t begin at frame 1. The plates have 48 frame handles but we only need to deliver 8 frame handles. This script will set the selected Read node to start at frame 1 and set the correct handle ranges based on user input.

Saves a few seconds of math.

As an example, the project settings first frame for the settings in the image on the right would be 1 + 48 – 8 (41) and the last frame would 1 + [selected read node's last frame ] - [selected read node's first frame ] - 48 + 8.

Installation

  1. Add setProjectFrameRange.py to your ~/.nuke folder
  2. In ~/.nuke/menu.py, import setProjectFrameRange
  3. Add the command to a menu

Configuration

You can set the project handle default frame counts (48 and 8 in the image above) in the first portion of the class.

Download from Nukepedia.

 

 

 

Toggle switch on user defined frame in Nuke

Posted on:

In this tutorial, we demonstrate how to let the user specify a frame that toggles a switch. I know – pretty dope.

We use “manage user knobs”, and a small expression to accomplish this.

If your name is James, you know I made this for you.

The video is more easily viewed in fullscreen – click the button in the bottom right of the player controls.

Toggle switch loop in Nuke

Posted on:

This screencast demonstrates how to create a squarewave in The Foundry’s Nuke. You’d want to use this if you ever have to toggle a switch on and off repeatedly at set intervals, for example.

We basically loop some key frames in the curve editor. The looping technique can be adjusted for many other applications.

If your brother’s name in Nick, I made this just for him.

The video is more easily viewed in fullscreen – click the button in the bottom right of the player controls.