Saturday, April 27, 2013

Export Nuke's retime information

Export Nuke's retime information To 3D packages:

This is happen while working with production. In most cases retiming is done beforehand or at the end of a comp. Some time shots getting retimed after Match-move is done. By that time Nuke's retime data (curve) will help to match the tracked camera to new retimed plate.

Here is the trick to export nuke's retime date (curve) to 3D packages such as maya, max, Houdini etc. Here im explaining how to export nuke's retime curve to maya.

Constant re-speed.

I want to retime my input by 200%.

Add a retime node and change the speed to 2. Don't forget to change the filter option to None.


Retime node doesn't generate retime curve at all. So note down the output range. It changed from original range 1001 - 1042 to 1001 - 1021. Which means our input ended with 1021.

Add a TimeWarp node and set keyFrames based on our retime output result. Set a key frame at 1001 as 1001 in input frame knob. Goto frame 1021 and add a key-frame with 1042 on input frame knob. Don't forget to change the filter option to None.




Your timeWarp give the same result as retime node dose.


Export the retime data to Maya as Text file.

Goto TimeWarp node, add a user knob by right mouse click select manage user knobs, Add a integer knob and name it (here i using time). Then hit ok. Nuke will add a integer knob in-to TimeWarp node.


Now right click and select add expression on that custom integer knob. On expression tab add t and hit ok.


Goto curve editor select lookup and time. Right click ---> file ---> export ascii and select it. It will pop-up a window for exporting retime curve as ascii file (text file).


Select file path, name and hit ok by default. Nuke save a text file on your path. open it with text editor and look at it.


Nuke saves retime information on first column and time information on second column. But MAYA using it in reverse order. To import this into maya u need to mirror this information. How to do that.

Simple, Goto export ascii window and change the column for lookup to 2, and column for time to 1. Now nuke will store the informations how MAYA expect.



Import retime curve into MAYA and enjoy.

Re-time a Match-moved camera:

Now we are going to do above method in reverse order. We are going to retime the Match-moved camera inside nuke, instead of exporting retime curve to Maya from Nuke.

Import your Match-moved camera or generate camera using Nukes 'Camera_Tracker'.  Make a copy of it ( for safe).

Goto Translate knob, right click and select Edit expression. Add (farme * 2) at end on x,y and z column.

like below image:


If expression knob have 'curve' add like curve(frame * 2). Don't forget to add same expression to rotate knob's too.

After speed-up Camera (wireFrame cam).







For slow down use (frame / 2). Don't forget to add same expression to rotate knob's too.


After slowDowned Camera (wireFrame cam).




Here i used *2 for 200% speed up and slow downed. You have feed the values as per your shot.

Hope this will help you friends. Enjoy........  keep Nuking......




Sunday, April 21, 2013

flop flip in nuke

flopFlip.py

Nuke doesn't have this small and very handy utility built-in. For doing this function in nuke we need to use "VIEWER_INPUT" method (or) add mirror node and connect it with a (any) node, then constantly check and un-check the Horizontal or vertical knob. Finally you have to delete the mirror node.

flopFlip script dosen't need above step 's. Just press ctrl+F for flop, ctrl+shift+F for flip.

Before:



 After:




flopFlip will help you to flop & flip your current viewer result. I use to do this for checking my final comps and review my shots. Playback software's like RV, frame-cycler and other tools have this handy function.

flopFlip:



Hope this will help you friends.

download: flopFlip.py

nukepedia:  nukepedia

'''
Created on 21-apr-2013
@author: satheesh-R
mail - satheesrev@gmail.com
http://satheeshnuketutorials.blogspot.in/

Add following lines to your menu.py:

import flopflip

menuBar.addCommand('Edit/Node/flop', 'flopflip.flop()', 'ctrl+f')
menuBar.addCommand('Edit/Node/flip', 'flopflip.flip()', 'ctrl+shift+f')

'''

import nuke
import nukescripts

def flop():
    for i in nuke.selectedNodes() :
        nuke.selectedNode().setSelected(False)
    curViewer = nuke.activeViewer()
    curNode = curViewer.node()
    acticeVinput = curViewer.activeInput()
    curN = curNode.input(acticeVinput)
    name = curN.name()
    curN.setSelected(True)
  
    if name == 'flopFootageSatheeshR' :
        nukescripts.node_delete(popupOnError=True)
        nuke.selectedNode().setSelected(False)
    else:
        flop = nuke.createNode('Mirror', inpanel=False)
        flop.setName('flopFootageSatheeshR')
        flop['Horizontal'].setValue(True)


def flip():
    for i in nuke.selectedNodes() :
        nuke.selectedNode().setSelected(False)
    curViewer = nuke.activeViewer()
    curNode = curViewer.node()
    acticeVinput = curViewer.activeInput()
    curN = curNode.input(acticeVinput)
    name = curN.name()
    curN.setSelected(True)

    if name == 'flipFootageSatheeshR' :
        nukescripts.node_delete(popupOnError=True)
        nuke.selectedNode().setSelected(False)
    else:
        flip = nuke.createNode('Mirror', inpanel=False)
        flip.setName('flipFootageSatheeshR')
        flip['Vertical'].setValue(True)
Add following lines to your menu.py:

import flopflip

menuBar.addCommand('Edit/Node/flop', 'flopflip.flop()', 'ctrl+f')
menuBar.addCommand('Edit/Node/flip', 'flopflip.flip()', 'ctrl+shift+f')

Wednesday, April 3, 2013

Magic_CornerPin2D

Magic_CornerPin2D gizmo make your life easier to place your pin's on right place by single mouse click.




Added extra function called 'set To bbox' in From tab. Load Magic_CornerPin2D and goto From tab and click 'set To bbox' button..... pins are automatically placed based on input bounding box.


After click 'set To bbox'....


 Hope this will help you guys.

Download: from sky drive

sample script:

set cut_paste_input [stack 0]
version 6.3 v4CheckerBoard2 {
 inputs 0
 name CheckerBoard1
 selected true
 xpos -40
 ypos -267
}
Crop {
 box {275 380 1480 1015}
 name Crop1
 selected true
 xpos -40
 ypos -182
}
Magic_CornerPin2D {
 name Magic_CornerPin2D1
 selected true
 xpos -40
 ypos -105
 disable true
 "extra matrix" 0
 from1 {274 379}
 from2 {1481 379}
 from3 {1481 1016}
 from4 {274 1016}
}


scale up and down cornerpin node

global scale up and down cornerpin This script help you to global scale up or down the selected cornerpin. Recently i had situation to ...