Archives

Refract to the Future

Awesomeness

refract_to_the_future

This is a short tutorial on how to use my Refract to the Future script. it’s very easy to use and probably doesn’t require a tutorial at all, but here it is anyway.

This script is designed to use a Vray Normal map to create a refraction like effect. I’ve not tested it on other renderers (arnold, mental ray etc.) so I’m not sure if it will work with them, so lets just assume you’re using Vray.

Vray seemed to be the odd one out as I had to invert various channels and not others to get it to work.

refract_a

 

Download the gizmo from the scripts page on my site (here) and start nuke, when you load Refract_to_the_Future you will be have a few options:

Gain – affects the amount of distortion around the edges

Scale – affects the amount of distortion globally

Blur – adds blur to the edges of the normal map

Chromatic – adds chromatic aberration

Gamma – Translucency -Refraction Contrast Gain – Refraction Contrast Gamma – all these knobs control the ‘milkyness’ of the item being refracted to various degrees, play with them to see what they do!

refract_b

Simply plug in the normal map into an image and there you have it!

teapots_normals

bizaro+normals

bizaro_nuke

 

Note – ‘Bizaro’ model came from a free 3d model website and I dont have the artist name, sorry about that. Also, any similarities to Robert Zemeckis ‘Back to the Future’ films is purely conincidental..

Archives

Render multiple outputs with python switches

Awesomeness

In this tutorial I’m going to show you how to use a switch and pre render python script to drive multiple writes from the same script in Nuke.

The challenge I had was to produce multiple colour options for the same script and render them out through Deadline.

I simply couldn’t create a script for each colour option as the final results had to be identical (apart from the colour), and I was constantly updating the master script so I used expression switches to change the part of the of the comp that affected the diffuse layer.

A switch that goes between the constant colours is where the first important step happens, but instead of moving the slider in the switch, I created a NoOp node with a dropdown menu (right click, manage user knobs).  This had nice logical names relative to what was getting piped in, the switchorder starting at 0 and going up. In the example case 0 is Red, 1 is Yellow, 2 is White, 3 is Grey and so on.

Now to get this to drive the switch node, an expression needs to be added to the slider input on the switch node.

Great, so we change the colour drop down and the script changes to whatever colour we select. So how do get each one of the colour options to write out to a separate folder at the same time?

The concept is surprisingly simple. Before each render node is executed, a python script is triggered that changes the switch to our desired colour via the dropdown menu we created.

To do this, create a write node for each colour version (make sure the write image sequence names are unique to each node), to go to the python tab and enter the following code in the ‘before render’ input:

It’s that simple – basically before the write node is executed, Nuke looks for the node ‘Colour_Switch’, goes to the controller knob ‘colours’ and changes it to your selection.

Though ‘before each frame’ would seem to make more sense when rendering via Deadline over a renderfarm, it was ‘before render’ that worked.

Once the script is set up it was very easy to make global changes the common elements of the comp then send them to render, knowing that Nuke and Deadline would happily spit them all out into their rightful destinations.

The final comp incorporated multiple switch changes at render time, you can use as many as you like!

download script here