Nuke Tips – Procedural Film Scratch (Creating Gizmo) Part 3

The Last Part in the Trilogy of Procedural Film Scratch

Apology for the delay as I got busy prepping BG (Background ) assets for my Houdini reel for the past weeks.

Here’s the link to the first two parts of the tutorials.

Nuke Tips – Procedural Film Scratch (Creating Gizmo) Part 1

Nuke Tips – Procedural Film Scratch (Creating Gizmo) Part 2

The EXPR Dilemma

First of all, there is a particular issue that I missed out in Part 2 on the use of TCL expression in Nuke.

I’ll let the following screenshots explained the issues.

Just in case for users who relies on machine translation when reading this post, to use the value of a variable in another variable, we need to use expr for it to evaluate properly.

Slight Modification to Scratch

If you’re up to the challenge, you can give the user choices in selecting the look of the scratch. Problem is I’m lazy and decided to modify the look of the scratch directly in the RotoPaint node.

Here’s how the new curly scratch looks.

Adding Chromatic Aberration

There are a few Chromatic Aberration (CA) gizmo out there at Nukepedia but let’s create our own version here.

Ok maybe the node graph above is pretty complicated since it involves extra nodes as part of the gizmo.

The following node graph shows a simple construction to fake CA effect.

The idea here is to scale a particular channel (usually the Red channel) in a radial zoom which the GodRays node does. You can try scaling using the Transform node but it creates an unnatural looking CA but might be appropriate depending on the look you’re after.

The following BG render from my upcoming Houdini FX reel demonstrates the difference between both methods.

With that out of the way, let’s look at how to export our gizmo for others to use.

Exporting the Gizmo

Before that, we want to write a simple Help description whenever the user hovers over the question mark icon at the top right of the properties panel.

Just right click on an empty area at the gizmo properties and choose Edit help.

Well the help stuff are optional but it can be beneficial to write a short and critical information about the gizmo. You don’t want the user to be left in the dark!

Finally remember to set a default value for all the gizmo parameters before we export it.

Exporting the gizmo is as easy as going to the Node tab and choose export as gizmo…

So we have export the gizmo… now what we can do with it?

You can either place it in the .nuke folder in the Home directory (the path varies between OS) and go to Other -> All Plugins -> Update to access the gizmo through the Tab menu.

OR

Refer to the official documentation on how to access the custom gizmo:

https://help.thefoundry.co.uk/nuke/8.0/content/user_guide/configuring_nuke/custom_menus_toolbars.html

https://help.thefoundry.co.uk/nuke/8.0/content/user_guide/configuring_nuke/loading_gizmos_plugins_scripts.html#configuring_nuke_769985560_701388

The Finale of the Gizmo Trilogy

So we have reached the end of this three part tutorials and hopefully you have learned something useful from it.

One thing that I’ll love to add to the custom gizmo is an icon if you’re planning to access it from a custom menu and Dan Sturm wrote a good article on setting up a Nuke Gizmo icons.

As a reward, here’s how I abused the very gizmo that I created on a random train footage that I found on YouTube.

Still here?

You can download the tkk_FilmScratch gizmo by clicking this link and I’ll probably upload it over at Nukepedia in the near future after some minor modifications.

Happy Gizmo Nuking!

Nuke Tips – Procedural Film Scratch (Creating Gizmo) Part 2

Previously in Part 1 of Creating a Procedural Film Scratch Gizmo

In Part 1, we covered the process of creating a gizmo from scratch and ensuring the custom user knobs are working through the use of expression.

Albeit simple, the gizmo creation process is easy to learn but hard to master if we want to create a complex gizmo (take a look at some of the popular gizmo over at Nukepedia and study the node graph).

By the end of this tutorial, we’ll be able to generate this result using the gizmo:

What’s Covered in Part 2?

If you are looking for a complete walkthrough of creating this gizmo, I’m afraid to say that I’ll be covering the critical aspect of the gizmo creation only as it is better to get the hang of creating several basic gizmos before attempting this part.

As long you have the understanding of the following, you are good to go in troubleshooting the gizmo creation:

  1. TCL/Python Expression
  2. Using Variables in Nuke
  3. Google (or any major search engine)

Without further ado, let’s take a look at the node graph layout which can be further develop in the future.

Do not confuse this with an organisation chart–

Do take note that renaming nodes inside a gizmo are not necessary so you can leave the default name that Nuke generate like Reformat1, Transform3, Shuffle2 and so on.

Create scratch using RotoPaint

Just draw a line and you’re done!

Serious answer, it is better to setup a Reformat node with a low resolution (ideally lower than 512×512) since you don’t want Nuke to draw a high resolution scratch for faster calculation.

If you need higher res for a 4K Ultra HD output, feel free to bump it up according to your requirements.

Setting up Variables in Nuke

The best way to setting up variables in Nuke is to use a Text node and write it out in the Node tab instead of the Text tab.

To setup a variable in Nuke using TCL, use the following format:

[set variablename value]

[set variablename [value node.parameter] ]

Examples:

projwidth [set projwidth [value root.format.width]]

projheight [set projheight [value root.format.height]]

minX [set minX $projwidth/3]

maxX [set maxX $projwidth/5]

minY [set minY $projheight/4]

maxY [set maxY $projheight/4]

You’ll notice there is a variablename prefix before the square brackets in the example above. It is to help us identify the variable as Nuke will only return the value of the expression in the square brackets. Here is more random examples:

month [set month November] = month November

rainamount [set rainamount 1000] = rainamount 1000

petrolJellySmear [set petrolJellySmear [value Blur1.size]] = petrolJellySmear 80

So how do we use the variables? Just append it with a $ prefix like $month and $rainamount in your expression although we can use it anywhere within Nuke like in the following example:

Using expression on Transform node for animation

To procedurally generate the animation of the scratch, expression is the way to go as you’ll unlikely to keyframe every single frame manually!

As I’m not an expert in mathematics algebra, do visit the excellent Nuke Wave Expressions by Cameron Carson to get a good idea on generating the desire animation curves.

In the above screenshot, you can see the expressions with the variables that I set up earlier.

If you have the Transform node active, you can preview the animation curve of the expression through the Curve Editor tab and the animation path on the Viewer tab.

After playing around with the various parameters in the expression, it is time to duplicate the transform node to allow us to configure the amount of visible scratches on the gizmo using the switch node.

Duplicate and expression tweak for variation

Once you’re happy with a particular expression, it is time to duplicate it and slightly modify the expression to generate another variation.

In the above node graph, the setup allow us to use the Switch node to control the amount of scratches by using expression to link the number on the Switch node with a pulldown choice knob.

Create dust speckle using…

…Noise node?

Nothing much to see here. Just tweak to your heart content to get the appearance of a flickering dust speckle and don’t forget to link the useful parameters to the custom user knobs.

Setup User Knobs to Access Relevant Parameters

The usual stuff. Add or pick the knobs that you will be using for the gizmo.

Do note that you can use HTML tags to customise the appearance of the Text knob as shown above with the bold tag <b></b>.

The current user knob layout for this tutorial.

As not every film scratch needs to be white on black background, I added an invert checkbox (linked to an Invert node) to allow for black on white background.

Depending on the situation, it can be redundant since a user can manually add their own invert node after the gizmo node.

Still it is nice to have the option built into the gizmo to save the trouble for the users.

Next in Part 3, Chromatic Aberration and Exporting Gizmo

For Part 3, we’ll be adding a Chromatic Aberration toggle (heh) and wrap it up by exporting the gizmo.

Hopefully you find Part 2 useful in your quest to create a custom gizmo that will save the universe. Just kidding.

Here’s another version of the procedural film scratch just by adjusting a few parameters on the gizmo.

See you next time in Part 3!

Further Reading

https://docs.thefoundry.co.uk/nuke/63/pythondevguide/index.html

http://thoughtvfx.blogspot.my/2012/12/nuke-tcl-tips.html

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

Nuke Tips – Tweak HDRI Map

Tweak HDRI Map and Where to Find Them!

This Nuke/insertprogramthatcaneditHDRI Tips will be a rather short tutorial that focuses on how to tweak HDRI map in Nuke for use in rendering.

I’m using Vray but any renderer that supports IBL (image-based lighting) should work too like Octane, Corona, Arnold and etc.

No idea if UE4 (Unreal Engine 4) own IBL system behaves similarly but let me know in the comment (if I haven’t update this article in the near future)!

Last edited: Nov 2, 2017 @ 6:28 pm Added HDRI Haven link as another free HDRI resources.

Continue reading

Nuke Tips – Procedural Film Scratch (Creating Gizmo) Part 1

Procedural Film Scratch

One of the common (or cliche) effects in the post production phase to achieve the look of vintage film that are either worn out, exposed in a very dusty environment… or maybe for horror/spooky mood.

BUT for no actual reason (hehe), we will be creating a procedural system that can generate the scratches that has controllable parameters like translate, rotate, scale, animation speed, flickering and the amount of scratches!

This will be a three parts tutorials and for the first part, I’ll be covering the process of creating and testing a simple gizmo. Basic knowledge of Nuke are expected but not necessary although why are you visiting this website if not for the Nuke tutorials? ;D

What’s a Gizmo?

Gizmo in Nuke is a node or more accurately, a group that consists of a collection of nodes that are customised to serve a purpose in a pipeline.

Examples: Burn-in WIP dailies, glow effects from specific render matte passes, glitchy macro-blocking artifact effects and etc.

The advantage of gizmo is that the functionalities are self contained provided it is using the default nodes in Nuke so it can be reuse on other workstations provided it is compatible with the Nuke version (this is where the author need to ensure the gizmo are compatible by asking their colleagues or online samaritan for testing).

Here’s some useful links to get an idea about gizmo:

http://www.nukepedia.com/ (a great collection of gizmos although you need to register to download it)

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

http://www.cameroncarson.com/nuke-wave-expressions/

http://help.thefoundry.co.uk/nuke/8.0/content/user_guide/configuring_nuke/creating_sourcing_gizmos.html

http://www.digitalgypsy.com/vfxlog/archives/2007/10/tip-of-the-week-making-a-nuke.php (it’s over 10 years old(!) but a great tutorial which are applicable to the current Nuke release)

Creating the Gizmo Template

Throw in a bunch of nodes and CTRL+G to create the gizmo!

Ok technically it is correct but not the correct way to learn especially if you want to create a usable gizmo.

Steps by Steps

We’ll be creating a simple gizmo that fully desaturates the image and adds a vignette which are configurable.

The following steps will occasionally omits certain details like click this/that and screenshots since I find it redundant. Just pay attention when reading it again if you’re troubleshooting the steps!

  1. Add a Saturation and Vignette (which is a Gizmo itself!) node.
  2. Select both of them and CTRL+G to create the Gizmo. Rename it as tkk_ClassicProjectorLook (or whatever you like as tkk is a shortname for taukeke which act as a namespace for the gizmo in a typical studio pipeline).
  3. Rename Input1 as Source and Input2 as VignetteMask. This will update the label of the input arrows of the gizmo. Refer to the following screenshot to get an idea.
  4. Right-click on an empty space in the tkk_ClassicProjectorLook properties panel and choose Manage User Knobs.
  5. Depending on the situation, it might show up empty or it will have a User value in the list. For the sake of this tutorial, let’s proceed as though it is empty.
  6. Click Add and choose Group from the dropdown list.
  7. Rename both Name and Label as Settings.
  8. Uh oh, suddenly there is a User and endGroup in the list besides Settings. This is not desirable as seen in the Properties screenshot below so delete both Settings and endGroup.

  9. Select User and click on Edit. Rename it as Settings.
  10. Add a Check Box and fill in both Name and Label as Grayscale.
  11. Open the Saturation1 properties and make sure the saturation value is set to 0 (duh) to fully desaturate.
  12. Go to the Node tab of Saturation1 and right click on disable checkbox. Choose Add expression… from the dropdown list.
  13. You can use either !Grayscale or Grayscale == 0 in the Expression field.

    .
    Here’s how it works: Remember the Grayscale checkbox that we created earlier? Since a checkbox is a boolean aka true or false that returns 1 or 0 respectively, the expression is telling Nuke that if Grayscale == 0 (aka unchecked), the disable checkbox are enabled (true).
    .
    This means the Saturation1 node is disable. So if a user checked Grayscale which returns true, the Saturation1 node are no longer disabled since the Grayscale == 0 expression doesn’t match the new value. The !Grayscale is just another way of writing Grayscale == 0 to achieve the same result.
    .
  14. Instead of Add, we going to choose Pick… Pick the following knobs from the screenshot below.
  15. Add a Group and rename it as Vignette. Rearrange it to match the the screenshot below. Basically any knobs in between them belongs to the Vignette group that are collapsible in the Properties panel.
  16. Tada! We’re pretty much done so now we need to test the gizmo…

Testing the Gizmo

Use any valid image as the Source and a roto shape for the VignetteMask.

Proceed to fool around with the various settings that we setup for the gizmo to see if it works. All should be well and if it doesn’t work… back to troubleshooting the gizmo or redo the whole things from scratch!

Things to note:

  • Usually it is best to have both Name and Label to share the same naming. Remember only alphanumeric and underscore!
  • Don’t use spaces for the gizmo node name. Well Nuke will replace it as underscore but I usually prefer to use camelCase naming like NuclearGlow, RainingCatsDogs, InstantRich, etc.
  • To edit the gizmo, just click on the S button on the properties panel as highlighted in the screenshot below.

Next on Creating Gizmo Part 2…

Now that we manage to get a functioning gizmo that does absolutely nothing of value (heh), I’ll be covering the following topics in the next part:

  1. Drawing roto shapes for the scratch mark.
  2. Duplicate roto shapes using multiple transform expression and merge.
  3. Animating the roto shapes with expression.
  4. Using Noise to generate the dust speckles.

In conclusion, we learn the concept of creating a gizmo, adding custom user knobs and using expression to drive/link the knobs with the relevant parameters.

This will give you the foundation to iterate it to achieve the gizmo that are required by the production pipeline or accelerate tedious workflow that reuses dozens of nodes into a user friendly UI!

Nuke Tips – Matching Colour with Grade Node

NukeColourMatch_Header2

It don’t matter if you’re black or white~

So you have a live action plate and CG render and you wonder why it doesn’t mesh together?

Probably the “blackest” and “whitest” point doesn’t match for both elements. This applies to pretty much all elements during compositing of a photorealistic scene.

So for this example in celebration of “May the Fourth Be with You”, here’s a walkthrough of the process.

“You must unlearn, what you have learned”

NukeColourMatch01

1) The original live action plate and CG Stormtrooper.

NukeColourMatch02

2) Object ID pass since the texture on the original CG Stormtrooper doesn’t have consistent black level. This render element is also known as RGB Mask for precise selection during compositing.

NukeColourMatch03

3) The raw Beauty pass rendered using Octane Render for 3ds max.

NukeColourMatch04

4) The helmet with super subtle colour correction to match the body black levels.

NukeColourMatch05

5) The blaster (gun) after colour correction. I also tweaked the gamma so it has a more contrasty look.

NukeColourMatch06

6) After tweaking both the blaster and helmet, this is where I colour match the CG Stormtrooper with the live action plate.

NukeColourMatch07

7) Noticed the funky pixels halos around the CG Stormtrooper in the previous steps? This is where I premultiply it to get rid of the halos.

NukeColourMatch08

8) The colour-corrected CG Stormtrooper now sits nicely in the live action plate.

NukeColourMatch09a

9) This is where you apply your choice of colour grading either by yourself or by handing off to the colourist (read more on what does a colourist do over at No Film School).

The Holy Grade Node

NukeColourMatch10

Tip of the day: Hold down CTRL while click drag on the viewer to colour pick in Nuke.

The function that you’re looking for is the following four parameters:

  1. Blackpoint (Usually you don’t need to adjust this but this set the the colour that you chose as the “blackest” point)
  2. Whitepoint (Vice versa as Blackpoint description. The colour that you picked will be the “whitest” point)
  3. Lift (This is where you pick the “darkest” pixels on your live action plate (or selected part of your live action plate if there is various lighting condition))
  4. Gain (Same as Lift, pick the “brightest” pixels from the live action plate to match the

Once you set the colour of your choice, play around with Multiply and Gamma for the final fine-tuning.

NukeColourMatch11

Here’s the final render of the whole sequence (no sound). Enjoy!