Tool Bench

Tool Bench

LightMixer - Dynamic adjustment & transfer of lighting changes from Nuke to Solaris in Houdini

 

Download here, on Nukepedia or on GitHub
(Houdini HDA only compatible with python 3.8 and up)

Over these past few months I've spent some time looking into and building a dynamic and pipeline agnostic solution for adjusting CG lighting renders for lighting slap comps in Nuke and painlessly transferring those changes over to Solaris in Houdini. This tool initially started as a fun test and python playground after developing a solution for a similar issue for the lighting team at work. However, as it always happens, I went down a bit of a rabbit hole which long story short, led to building this tool.

A quick note before breaking down the tool:
The LightMixer is not really supposed to be used by compositors or as part of a final comp script! Rather it was mainly created to be a handy workflow tool for anyone that deals with lighting/rendering & slapcomping. Because of this it includes a few non-linear functionalities to match the ones used in CG rather than in Compositing.

The tool consists of two parts: A Nuke Gizmo and an accompanying Houdini Solaris HDA. Both are packed with lots of nifty little features, so let’s go over all of them, starting with the Nuke Gizmo.

Nuke Gizmo

Basic workflow:

  1. Define a Filter so that when pressing “Populate” the gizmo only creates layers for the passes that include the filter.

  2. Define the “AOV Prefix” if your passes include additional characters other than the AOV name defined in Houdini (e.g. “C_lightname_LGT” or “RGBA_lightname). This is only important for the Houdini Copy functionality.

  3. Hit “Populate” and watch it create layers for all your passes.

  4. Make your adjustments to each layer and then at the end either press “Houdini Copy all Layers” to copy the changes from all layers or “Houdini Copy” on a single layer for a single layer copy.

Nuke Gizmo default UI

Additional functionalities:

  • Dynamic layer control:
    Apart from using the populate layers function you can also manually add a layer. All layers except from the first can be individually deleted as well.

  • Statistics Overlay:
    When you grade layers a text overlay is added containing which layers have been graded and what adjustments have been made to them (useful for dailies).

Statistics Overlay over Render showing adjustments made to the layers.

  • RGB & HSV colour mode:
    To mimic the controls of the light node in houdini you can switch between adjusting the colour in RGB and HSV. Any values entered will be converted back and forth.

  • Blackbody based Colour Temperature:
    Further mimicking the light node in Houdini you can adjust the colour temperature of the AOV. Default white is set at 6600k.

  • Overall Saturation:
    This was added based on feedback from lighting artists to give them some more control, however, be aware the saturation adjustments can’t be copied to Houdini!

  • Dynamic Mask Inputs:
    Each layer has the option to enable a mask input which will carry the name of the selected AOV.

Houdini HDA

Basic workflow:

1. Connect the Houdini LightMixer node to your node stream below your lightrig and select the correct render engine from the dropdown.

  • If your render engine isn’t listed set it to “custom” and manually enter the attribute name of the AOV tag.

Example of where the attribute name for the Karma AOV tag can be found.

2. Press “Import new Lights” on the Houdini node (make sure to have pressed “Houdini Copy” on your Nuke LightMixer) and it should create the same layers with the same adjustments as in Nuke and automatically find the correct prim path for each light (it will tell you if it didn’t).

  • Any colour temperature adjustments are included in the colour values. Overall Saturation is not copied across!

3. If no error warning was thrown up you should be able to just hit render and the new render will be identical to your adjusted Nuke one.

Houdini HDA Default UI

Additional functionalities:

  • Import comment:
    Whenever you import from Nuke, a comment with the date and the name of the Nuke script will be added to the node to keep it nice and organised.

 Custom Comment visible after Import

Houdini copy functionality breakdown

Here’s a quick breakdown of how the Houdini copy functionality works under the hood as it is really simple and could very easily be adapted to work for other programs like Katana or Maya as well.

When one of the “Houdini Copy” buttons are pressed all the necessary values and layers get assembled into a python dictionary. This dictionary is then copied into the clipboard using Qt and gets converted back into a usable dictionary in Houdini by using json.

The first entry in the dictionary is always the information used for adding the custom comment to the node in Houdini. The following entries are for the various light layers that get copied and are in the format:

”Light AOV name” : “Intensity Value”, “Exposure Value”, “Red Value”, “Green Value”, “Blue Value”]

Example of dictionary in clipboard

I originally wanted to take advantage Houdini's proprietary clipboard system which in contrast to Nuke doesn't simply store the copied data in the system clipboard but rather creates and uses .cpio archives in your houdini_temp directory ("/tmp/houdini_temp/") to handle the copying of nodes inside the program. Those files are context specific and follow the pattern "CONTEXT_copy.cpio" so for example "LOP_copy.cpio". However, as far as I’m aware you have to work with and adjust those files in binary and they work differently between the commercial and non-commercial version of Houdini. Because of that and for simplicity and future compatibility reasons I decided to go with the simple clipboard dictionary solution shown above.


Finally, a big big thank you to Ewan Palmer, Attila Gasparetz, Joao Calisto and Felix Lang for helping me with many aspects of this tool and giving me feedback along the way!

Annnnnnd that's it. Thanks for reading and I hope you will find it useful!

 
Guy Frutiger6 Comments