Ben's Comp Newsletter: Issue 036


Hope you've had a productive week! This weeks' newsletter is packed with a bunch of handy utilities, and some insightful knowledge from one of the Nuke community's leaders.


ERWAN LEROY // Head of 2D

“I didn’t know the name at the time, but I always was a bit of a nerdy kid. I was into cartoons, video games, and fantastic worlds. I learned to use a computer and started playing with some graphics software before I learned to ride a bike. When I was 10, I wanted to become a “video game maker”, but didn’t quite know what it was. Grown-ups told me I could choose to learn programming or CG, so I started playing with both a little. Not knowing English at the time made it a bit trickier to pursue programming, so I went the CG route instead.

I started professionally as a compositor in 2008. Little by little I started including programming into my work day, and it now overtook the amount of compositing I do. I have been working for SPINVFX since late 2016, first as a lead compositor, then head of comp, and now head of 2D.”
Click here to read my interview with Erwan Leroy.

Quick Tip: Programmatically Dealing with Hex Colour in Nuke

Something I'm endlessly frustrated by is having to work around the way Nuke uses confusing hex colour values in Python to do things such as set a node's 'tile_color' knob. For example, how are we supposed to remember that 0xff000ff = green?

I wrote two simple functions to get around this, which I hope you can make use of too:
def hex_color_to_int(hexValue):
    return int(hexValue+'00', 16)
The hexValue argument still expects a hexadecimal colour value, although rather than an arbitrary string of characters, you can input a web-based colour which is easily found by Googling "hex colour picker".

For example, I can sample a gold colour as #ffd700 from Google, and then set the 'tile_color' knob on a selected node with the following:

Similarly, if you prefer to just use float values like in Nuke's RGB sliders, this works great:

def hex_color_to_rgb(red, green, blue):
return int('%02x%02x%02x%02x' % (red*255,green*255,blue*255,255),16)

...and then setting 'tile_color' with:


This one works by converting the strange hex colour to RGB values (0 to 255) and using our 3 arguments to multiply red, green and blue values in a way a Compositor would find more intuitive.

Regardless of your favourite method, either option is far simpler and more controllable!



It's funny how specific problems come up more than once within a short window of time. Recently, a handful of people have asked me a variation of the question, "how do I tell if my perspective / horizon / vanishing point is correct?"

I was sure someone had already solved this problem, and so I went on a search. What I found was a simple, but surprisingly useful utility gizmo for Nuke, created by Den Gheiko, that helps you with all of the above!

Click here to download dg_PerspLines from Nukepedia.

Python-based Machine Learning Frame Server for Nuke

Foundry quietly released this repository on their GitHub a couple weeks ago. It's a functional machine learning framework for Nuke, containing examples that:
  • Blurs your image
  • Detects objects (Mask-RCNN)
  • Maps "human pixels" into a 3D surface-based model (DensePose)

In Foundry's own words:

"This repository contains the client-server system enabling Machine Learning (ML) inference in Nuke. This work is split into two parts: a client Nuke plug-in Plugins/Client/ and the Python frame server Plugins/Server."

This is the beginning of something huge.
Click here to check this out this Repository on Foundry's GitHub.

Did you find this newsletter informative?

Have you created, or do you know of any outstanding Gizmos, Python Scripts or Tutorials that you would like to share with the global Compositing community? Please send me an email, and I will do my best to include it in a future issue of this newsletter.

If you find value in Ben's Comp Newsletter, please consider pledging a small amount on Patreon to help keep this project running! Contributions are always appreciated but not expected.
Support Ben's Comp Newsletter on Patreon
Click here to view previous issues