Tuesday, February 26, 2019

connectCamera script for nuke

connectCamera python script for nuke

connectCamera script helps users to connect with any camera from anywhere in their nuke script. When you run this script it will find all the Camera's from the script, pops a window to choose the desired "Camera" from the list.



When you hit connect this script it will create a "Dot" node and connect with the selected camera. Also, add the selected camera name to the Dot.

Example video:


Download the script:


Raw code:

### connect camera v1.0
### connects user selected camera using a Dot node anywhere from the script
### for bugs and reports satheesrev@gmail.com
### thanks to Wouter Gilsing for helping out to make this happen

import nuke

def connectCamera():
    ###getting list of camera's available in the script
    cameraNames = ' '.join([n.name() for n in nuke.allNodes('Camera2')])
    if cameraNames:
        ###Creating nuke panel and storing informations
        panel = nuke.Panel("connectCamera", 100)
        panel.addEnumerationPulldown('selectCamera', cameraNames)
        panel.addButton("cancel")
        panel.addButton("connect")
        result = panel.show()
        selCamera = panel.value("selectCamera")

        ### return function when user hit cancel
        if result == 0:
            return
        else:
            ### creating DOt node and connect with selected camera
            dot = nuke.createNode("Dot", inpanel=False)
            dot.setInput(0, nuke.toNode(selCamera))
            dot['label'].setValue(' \n'+selCamera)
            dot['note_font_size'].setValue(20)
            dot['note_font'].setValue('Bitstream Vera Sans Bold')
            dot['hide_input'].setValue(True)

    else:
        nuke.message('No Camera Found\nimport some camera to connect')





Tuesday, November 20, 2018

Nuke Viewer Interactive Bounding Box Warning message

Viewer Interactive Bounding Box Warning message.


Bounding box management is essential in compositing. This applies for all the compositing application. Compositor should have good knowledge in managing bbox in their workflow. Your script became more efficient and manageable by maintaining bbox as original format. Also, this help nuke to render your script much faster.

All the big studios teaching artists, how to manage bbox in their script. Even-though, Experienced artists fails to maintain their bbox when it comes deadline. Every compositor knows how an artist works a deadline’s. This is a common issue across the studio.

Came up with this small idea to warn the artist when their bbox goes beyond twice as original format. Bundled this tool with viewer LUT. When the bbox became 2times bigger than original format, Viewer pops warning message interactively. Warning message goes away once the bbox became normal.


          default sRGB LUT                                             sRGB bundled with bbox warning

Breakdown steps:

Creating a banner on top of the viewer:

"expression" node with basic math will create a red banner on top of the canvas. You can change the size of the banner as per your taste.

http://www.nukepedia.com/written-tutorials/expressions-101




Created banner using an expression node. Now we need to add warning text on top of the banner.

Interactive warning "text" node:

Create a Text node with the desired warning message. Keep the text in center aligned and justified.



Now, the issue is when the canvas (project) size change. Text node alignment will change! of course. How do we fix this!



Hers is the way, parent the text bbox to project width*height.


Now alignment fixed. But there is one more issue! When the project size goes even smaller?


Not cool right! There is a fix to overcome this issue.

Parent text size with format width will help us.



Now, this is cool :).


How do we make this work in the usual way? Switch node will do the magic here.

Take a separate branch from your main tree, merge the banner as 'A' input. Add a switch node on the main spine, connect bbox warning setup in '1' input. Now add below expression to 'which' knob on the switch node.

Expression math for switch node:

2*(width*height)>(bbox.w*bbox.h)?0:1

This expression tells to switch node, when the bbox size 2 times greater then the original format, switch to input 1.


Here is the result:



Convert this setup as Group and connect anywhere in your script to make it work.









Can be used as VIEWER_INPUT.


How do we bundle this with Viewer LUT ?

Import your LUT from the colour grading department. Add bbox warning setup like Below image. Export it as Group node. Import the Group as Viewer LUT while nuke starts-up. Bingo.... 





Example script: download

Suggestions and feedbacks are welcome. Hope this will help you !!



Wednesday, June 20, 2018

simple clean screen using IBK colour with un-premult

simple clean screen using IBK colour with un-premult

Many of us using stack of IBK colour node with incremental of values to get clean Blue or Green screen.

Example below image:

Most cases 1 IBK color node will give good result. But in some shots we ended up stacking multiple IBK color node to get the clean screen(plate).

When use multiple IBK color node the script became slow, Each node takes more time to produce the result. How do we overcome this slowness ?!

Here is the alternate way:



I used blur and un-premult nodes to get the similar result. This is much faster then IBK color stacking.

Comparison of both method result:



Result looks similar. Some shots this method produced better result compare to IBK color stacking.


Final result comparison:



Here is the steps:

1. Denoise your plate.
2. Create a IBK colour node. Choose your screen type. Play with the values to get the fine result.
3. Add a premult after IBK colour.
4. Create a Blur node. Change channels to rgba. Enable mask to rgba and check invert. Check below image.

5. Add un-premult after the Blur node.
6. Add some value to the Blur size. Magic, all the blacks will start filling with your screen colour.

Hope this will help you compers. Comment your thoughts and ideas below.



Tuesday, June 5, 2018

S_Despill

S_Despill Nuke Gizmo

There are tons of despill gizmos and templates available in internet and nukepedia for nuke. Many compositors having their own set of gizmos and technic to do despill.

Here is one of my all time fav despill gizmo i have created. Used in many instances over couple of years. S_Despill gives me lot of control in terms of edge management and retaining plate color.



This gizmo gives much more control to user
1. User can visualise the the amount of spill removed from the plate.
2. Make your screen to middle gray after removing spill by adjust the multiply.
3. Red Contribution controlling the red amount of de-spill. Mask option give user to apply the red contribution on selected areas. (good for control the skin tone edges)

Here is the video demo:


Download: http://www.nukepedia.com/gizmos/channel/s_despill

Friday, February 2, 2018

DeepEdgeSmoother

DeepEdgeSmoother

Deep compositing became day to day work in many compositing studios around the world. Nuke having couple of Deep nodes to do Deep compositings. But Nuke still lagging Deep edge manipulating  nodes like edgeBlur, erode etc.

I have faced many issues with blending edges while merging Deep inputs with 2D plates. Edge looks too sharp in many cases even there is Deep holdout. DeepEdgeSmoother is applying softness on both end of Deep layer (Deep front and Deep back).

Before:


After:



This gizmo add smoothness on both end of deep data to blend the edges more naturally. I hope this will help you guys.

Download here: DeepEdgeSmoother


Saturday, April 2, 2016

roto shape life time settings

roto shape life time based on keyframes

This is long time request. I haven't got time to look into this after joined in MPC. Got some time yesterday. Thought to update my blog with new tool. Here is the simple tool but much needed one ( i hope).

One of my friend requested to automate roto shapes lifetime based on the key frame. We use multiple way to set roto shapes lifetime. Some artists uses lifetime tab in roto node, Some simply move the roto shape out of the working resolution. Some guys are using 'multiply' node to achieve this. Some artists animating 'visible' knob in roto node. The way of doing this will differ from artist to artist. How to make this organised ?.

Here is the idea: lifetimeRoto.py

Most of us using nuke roto node lifetime tab set the lifetime based on the frame range.



Some artists using mouse click option in curve window in roto node.


In both way we need to feed the frame range either we need to choose to-end or to start. Doing this is not time consuming task for compers. But for roto & clean-up artist ?

lifetimeRoto.py automatically sets the selected rotoshapes lifetime based on the shapes key frame's. This code get the selected shapes keyframe value ( example: 10, 20, 30) and apply min and max to lifetime start and end respectively.  After i run this code my roto shape lifetime set to 10 - 30 automatically by single click or short-key.

I have assigned 'shift+L' as short-cut. Select your roto shape and make sure you have selected the roto node. Run this shortcut, Boooommmm. Your roto shape lifetime sets based on the keyframe.

I hope this will helpful. Feature request and bug reports are welcome.

Download: lifetimeroto.py

menu.py lines:

import lifetimeRoto

menuBar = nuke.menu("Nuke")
menuBar.addCommand('Edit/Node/lifetimeRoto', 'lifetimeRoto.setRotoLifeTime()', 'shift+l')

Full code:

'''
Created on 07-april-2016
@author: satheesh-R
mail - satheesrev@gmail.com
'''
### to set selected roto shapes lifetime based on the min max keyframes value.

import nuke

def setRotoLifeTime():

### get selected node
    selNode = None
    try:
        selNode = nuke.selectedNode()
    except ValueError: # no node selected
        pass
    if selNode == None:
        nuke.message('make sure your roto node selected')
        return
    ### find selected roto shapes keyframes
    if selNode.Class() == 'Roto':
        for selShape in selNode['curves'].getSelected():
            keyFrame = selShape[0].center.getControlPointKeyTimes()
            keyFrames = [int(i) for i in keyFrame]
            low = (min(keyFrames))
            high = (max(keyFrames))
            ### applying min max keyframe to per shape lifetime
            selNode['lifetime_type'].setValue(4)
            selNode['lifetime_start'].setValue(low)
            selNode['lifetime_end'].setValue(high)


Friday, May 22, 2015

lockNode for nuke

lockNode.py

Locking the nodes knobs (sliders) inside nuke very long waited future. It is requested many time with foundry but i don't think they going to add this unique future. So i have decided to create a python code for this function. Her is the solution.

This code allow user to lock the nodes knob. Once you lock the knobs, then you cant modify any sliders until you un-lock the knobs. This will save you from any accident changes. Hope this will help you guys.

Latest version support to write the info to your nuke script. So it will always locked if you close your nuke script and re-open it. I have used some cheat method to keep the node locked while user save their nuke script. I have tested many times and haven't faced any issues. Let me know if you faced any issues.




steps:

right mouse click on node property panel. You will get options 'lock_knobs' and 'unlock_knobs'.



Select 'lock_knobs'. This code will lock will the knobs and put Node_Locked text into node label. So user can easily identify the locked knob in UI.



If user selects 'unlock_knob'. This code will return knobs to active and remove the Node_Locked text from label.

Save your nuke script with nodes locked. Close nuke and re-open the script. You can find the locked node still locked.

mail to satheesrev@gmail.com for any bugs & reports.


copy paste below lines into your menu.py.

import lockNode

propertiesmenu = nuke.menu("Properties")
propertiesmenu.addSeparator()
propertiesmenu.addCommand('lock_knobs', "lockNode.lock_knobs()")
propertiesmenu.addCommand('unlock_knobs', "lockNode.unLoc k_knobs()")

def oc():
nodes = nuke.allNodes()
for selNode in nodes:
allknobs=selNode.allKnobs()
label = selNode['label'].getValue()
if 'Node_Locked' in label:
for knob in allknobs:
knob.setEnabled(False)

for a in nuke.allNodes('Group'):
for node in a.nodes():
allknobs=node.allKnobs()
label = node['label' ].getValue()
if 'Node_Locked' in label:
for knob in allknobs:
knob.setEnabled(False)  

nuke.addOnScriptLoad(oc)
nuke.addOnCreate(oc)

Here is the python code:

download lockNode.py

connectCamera script for nuke

connectCamera python script for nuke connectCamera script helps users to connect with any camera from anywhere in their nuke script. W...