Nuke Tips – Clamp Node

Clamping the Clamp Node

The Clamp node is something that you either use a lot or rarely touch it.

If you’re a seasoned compositor, I guess this post will be a nice refresher but if you’re still wondering what it does and how it fits into a typical production comp, read on!

Do not get confused with the famous mangaka group known as CLAMP!

Let’s Clap Together I mean Clamp Together

Ok the Clamp node does like it namesake says.

To clamp the value of the pixels be it in a range or either the min or max value.

  • Channels: Default is “all” channels but preferably select the channels that you want to clamp (e,g, RGBA)
  • Minimum: The min value for the clamped value. Self explanatory.
  • Maximum: The max value for the clamped value. Again self explanatory.

I never use MinClampTo and MaxClampTo but the help file describes it as a way to clamp low/high illegal values. Well you can always abuse use it to create solarized photography look!

There is nodes that has clamp function built-in like the Grade node (as shown in the above screenshot) so there is no need to put additional Clamp node if you desire so.

Although I’ve a habit of putting a Clamp node explicitly so I can identify it on the Node Graph at a glance.

Clamp Node Does What?

What the Clamp node does is to limit the maximum or minimum value. In other words, the blackest black and the whitest white. Or the legal values for the intended display.

So in what scenario does clamping values helps in a typical production shot?

  1. You’re using Plus etc operation that keeps adding to the pixel values (obvious culprit is the Alpha channel) and need to clamp it to 0-1 range for predictable alpha manipulation.
  2. Limit the range of depth from a Z-Depth output pass that uses distance from camera to represent depth value (e.g. Houdini’s Mantra).
  3. To prevent negative value pixels from whatever funky merge operation or channel manipulation. Remember negative values can be hazardous in your compositing process unless you have a good reason for using it!
  4. Extreme colour correction to achieve the desire matte which requires 0-1 clamping for proper premultiplication… refer back to point 1.

Example 1: Unpredictable Results when using Filter Nodes

Usually any values higher than 1.0 can be problematic for most filter operations that are not designed to handle the very high values as shown in the above GIF.

Example 2: Limiting the Min/Max of Depth Pass

Setting the min/max limit of a Depth pass… using the Grade node is preferable when remapping the value.

For this sample scene, the max depth (pixel) value is 99.0625 so it is redundant if the Max Clamp value are set to a higher value. The depth pass (or AOV) are rendered from Mantra (Houdini’s powerful renderer).

Example 3: Clamping the Final Output into “Legal Values”

Limiting the range of values into “legal values” for external applications. Never did this before but I think it has something to do with broadcasting standard?

You can read more about it in the following links:

https://larryjordan.com/articles/broadcast-safe-keep-video-levels-legal/

http://community.foundry.com/discuss/topic/100258/legal-video-colors

Clam Claims There is Other Ways to Clamp

Ignoring my lame attempt of “She sells seashells by the seashore”, there is the Expression node if you prefer to write… expression instead of using the Clamp node.

As mentioned before, the Grade node has a built-in Clamp function although with a catch. It is intended to prevent the min/max value from exceeding their limit set in Whitepoint/Blackpoint.

Further Reading

https://learn.foundry.com/nuke/content/comp_environment/color_correction/clamping_channel_values.html

https://learn.foundry.com/nuke/8.0/content/user_guide/expressions/adding_math_functions.html

https://learn.foundry.com/nuke/9.0/Default.html#cshid=Clamp

Nuke Tips – Bookmarking Nodes

Bookmarking Nodes for Quality of Life Improvement

This will be a short Nuke Tips as the other articles I’m drafting are longer than the usual length.

If you ever wonder if there is a way to quickly jump to a node in a large script, the Bookmark feature comes in handy.

Just check the Bookmark checkbox at the appropriate nodes (the Backdrop nodes are enabled by default). Also remember to label the node with a nice name. Preferably something that doesn’t replace the original name (e.g. Write1 as Write_LowResPreview).

There are two ways to quickly jump to a bookmark.

  1. Go to Edit > Bookmark > Jump to Bookmarked Node OR…
  2. Press J to pull up a dropdown list of the bookmarked nodes ala Tab Menu

So… Is It Useful or Not?

Depends.

If you have less than 30 nodes…  bookmarking nodes does feel like a chore but it is nice to have that flexibility in case we need it!

Plus the Backdrop nodes are already bookmarked automatically upon creation so it is a nice way to quickly jump to a particular backdrop section.

Reference:

https://learn.foundry.com/nuke/8.0/content/getting_started/using_interface/bookmarking_nodes.html

 

Learning Houdini for Project DQ

Learning Houdini for Project DQ!

In this post, I’ll be covering the overall goal of Project DQ that is as a learning platform for using Houdini for all FX tasks.

As the demand of Houdini skills for FX shots risen for the past several years, I realise it is time to pick it up or get left behind.

While I do not have exposure to Houdini in actual production at my prior workplace, I tried to adapt what I’ve learn in Maya, 3ds Max and RealFlow into Houdini… should be a frictionless learning curve right?

The Uncanny Valley in Learning New Software

3ds Max 5 Screenshot. Not my screenshot but look at that glorious Windows XP theme… and ICQ, Photoshop 7, Outlook Express, IE6 etc running in the background.

Back in 2003, I started playing around with 3ds Max 5 as my very first 3D Digital Content Creation (DCC) to create prefabs for Max Payne 2 mods (that didn’t really see the light of the internet–). 3ds Max became my main 3D package (excluding my short lived period with ZBrush and Sketchup) until 2011 where I need to use Maya 2012 for university’s assignment… which took me longer to accomplish something than what I can do in Max.

So there goes my half-hearted attempt in learning Maya and ended up using Max for majority of my assignments including final year project… at least creating a cube is straightforward in both software.

Well that all changes when I start working at my ex-workplace where Maya is the main DCC for majority of the work. I remember spending more time asking my colleagues, referring to the docs and googling for solution on navigating Maya UI for the first two months! That was really not a productive moment for me but as I become accustomed to Maya workflow, I can see why it is the still the primary backbone DCC for most studios.

Still I’m more of a Max person but I recognise the strength of Maya and the transition is not that bad actually since it is quite similar in both the UI and UX!

Now back on topic, what about Houdini?

Hmm looks familiar but different.

I have a Network within a Network within a Network

The initial “culture shock” for me when using Houdini for the first time is the concept of navigating the networks.

A typical Nuke node graph

The Relationship Editor in RealFlow

As you can see in the screenshot above for both Nuke and RealFlow, majority of the nodes are layout as it (with the few exception like Gizmo, Group and Precomp in Nuke).

Now let’s take a look at Houdini 16 Network Editor (there are minor changes in the UI for older version).

The obj Network View in Houdini 16

Not every node can be simply place anywhere. If you observed the dropdown at the top left of the screenshot, we have

  • ch (CHOPs aka Channel Operators)
  • img (Compositing)
  • mat (Materials)
  • obj (Objects)
  • out (Outputs)
  • shop (Shader Operations)
  • vex (VEX Expressions)

Depending on the type of nodes, you’ll be managing a minimum of one (obj) and up to seven major networks! Well excluding the possible dozens of subnetworks-

While most networks will be created manually, some like the popsolver are actually pre-made network

More info about the network types can be found here: http://www.sidefx.com/docs/houdini/network/flags.html

Just remember that there are nodes that can be created at any networks while some are restricted to specific level.

Contrast this with… 3ds Max and Maya.

You don’t get to see what’s going on as most of the operations are hidden from you and with that in mind, destructive while it is near non-destructive in Houdini. Note the “near non-destructive” instead of “non-destructive” as not everything are fully revertible unless you progressively version your scene file!

Maya Node Editor

Maya Hypergraph (Connections)

Maya do have a similar feature like the Network Editor aka Node Editor, Hypergraph and Hypershade although each has their own specific UI and not unified like Houdini’s Network Editor.

Slate Material Editor was introduced since 3ds Max 2011

The nearest equivalent for 3ds Max is the Slate Material Editor and Particle Flow although there is the new Max Creation Graph introduced in Max 2016 onwards that has a similar layout like VOP.

Variables and Relationships is the Spice of Houdini Life!

If you have played around with programming languages like JavaScript or Python, variables and relationships are the backbone for majority of your workflow in Houdini! If you have no idea what it is about… you’ll have a steeper mountain to climb troubleshooting stuff in Houdini.

The following are samples of global and user created variables:

Snippet of HScript Global Variables from Houdini Online Docs

An example of user-made variables in VEX (Attribute Wrangle)

3ds Max and Maya users might recognise some of the variables’ naming and usage but in reality, rarely use it in their daily works as majority of the tools are already written to use such variables without any inputs by the artists (unless you’re writing scripts).

In Houdini, you can easily manipulate a parameter using both variables and relationships! Relationships are super useful if you need to reference any valid parameters! The following screenshot shows the relationships of the different parameters through expression.

A typical Relationships in Houdini

The same are not easily replicated in Max… although Maya does have similar feature albeit limited.

Here’s the list of pages that you will be visiting often when you start dipping your toes into writing expressions/scripts in Houdini:

http://www.sidefx.com/docs/houdini/network/expressions.html

http://www.sidefx.com/docs/houdini/expressions/index.html

http://www.sidefx.com/docs/houdini/hom/index.html

http://www.sidefx.com/docs/houdini/vex/index.html

Easily Identify Data

By MMB a node, you’ll get an informative popup window about the various data that’s happening in that node

This is something I wish Nuke has so you can just middle-click (the default Houdini shortcut) on a node and identify the channels/layers on a particular downstream. Houdini is something like your best buddy that are transparent to you on what they are holding (if they are not your slave labour-).

Unlike a certain kleptomaniac ex-leader, being informed of the data that are being processed is very helpful and a must have in a node-based workflow. At least Nuke does let you know what’s going in a node stream through a subtle colour label on the nodes.

Time to put that Lotus 1-2-3 skill into use! Except you can only edit the attributes value (no formulas are allowed)

You can view Points, Vertices, Primitives and Detail attributes using the Geometry Spreadsheet. Shown here is the Detail attributes of the Whitewater sim cache.

Enter the Geometry Spreadsheet is a handy feature that display the values for the various attributes (points, vertices, primitives and detail) of a specific node. While it is not possible to write formulas/expressions ala traditional spreadsheet software like Excel, you can directly edit the value of the attributes (that are valid of course).

Max/Maya users? You either write your own scripts to identify the data belonging to an object or use third party solutions as far as I know.

Mingling Python and the Holy Scripting

Bridgekeeper: WHAT is the airspeed velocity of an unladen swallow?

King Arthur: What do you mean? African or European swallow?

WRONG PYTHON

Back on topic, Houdini has great Python integration and that means if you have silly or crazy ideas, you can write you own Python scripts to boost your productivity! Even the Shelf tools are secretly a handy one/two clicks Python script.

The Explosion Shelf Tool are nothing more than a four-lines Python script

If you don’t know Python, you can easily torment learn it or harass ask politely for help from someone that knows Python!

But if you have basic Python knowledge, you can write the following “Search and Replace” script…

Well you might wonder why I don’t simply save the scene file as a text file (think Maya ASCII format) and do the search and replace in a text editor? Consider the possible situation where I might accidentally replace an innocent word/number that I didn’t intended and screw up the whole work?

Not to forget that Python allows you to write multiple conditions that when couple together with the built-in Python functions in Houdini, it can be really powerful!

Or maybe I just need to level up my Notepad++ skill…

Maya Script Editor Listener GIF

The Script Editor in Maya will print out most parameters command that you can use for scripting

The only thing that I missed out a lot from Max/Maya is the listener which is a great tool if you’re starting out scripting as it prints out the command for majority of the actions that you performed. I briefly covered on using listener in a prior article: Coding in VFX and Animation

Basically prepare to dig through the Python docs for Houdini to get the desire functions that you need to use!

List of Python functions usable in Houdini

Or ask the friendly community over at the official Houdini forum or Odforce!

Just be prepared for the lack of responses if your question sounds like a FAQ or at the very least, attach an example file/video/pics/GIF for others to inspect.

Chanting the Mantra

Mantra is easily one of the best built-in renderer in a 3D package although the latest Maya and Max has Arnold Renderer bundled together (although Arnold are also available for Houdini).

Easily the greatest part of Houdini is the ability to manage dozens if not hundreds of render nodes

Presumably you can manage multiple renderers available for Houdini like Renderman, Redshift, and Arnold without switching to other renderer first like in Maya/Max. This is very useful in scenario where you need to output render elements with different renderers depending on the project requirements.

…I can’t think of an equivalent for Maya/Max. There is Render Layer Editor in Maya (which has been replaced with Render Setup from Maya 2017 onwards) which act like Photoshop Group Layers as you add objects onto a layer with optional render overrides but still at the mercy of the current renderer while for Max… I don’t think there is anyway to achieve similar functionality natively. The Scene States in Max doesn’t really work for me (simply due to the not user-friendly interface) and it is better to save several different Max scene files that can be Xref when outputting render elements for compositing.

Actually Mantra has a lot of parameters to fool around! Not every settings are shown in this GIF.

While my only production experience are Vray (both in Max and Maya), Mantra has similar workflow so the learning curve is not that steep. The overall render quality settings are similar to Arnold unlike Vray. Generally I find this approach to be more accessible when you have less parameters to play around to achieve the final look.

So far I’ve yet to render scenes that requires large amount of geometry/textures/particles/etc so I can’t say about the overall performance of Mantra against other renderers but I can vouch that it is very stable and rarely crashes on me (excluding some silly setup that chokes Mantra while I’m exploring Houdini…).

The Extra Image Planes setup can be intimidating for newcomer

I’ll have to say though that the Extra Image Planes setups are not user-friendly unlike in Maya/Max. There are many times where I accidentally included or excluded passes because the checkbox are not that obvious due to the UI design.

Probably I need to write a custom Python panel to simply the process.

You’re a Wizard, Houdini!

Not the type of wizard I’m referring to. If only using high-end 3D software are as easy as using a software wizard!

Again, my only experience with Houdini is mainly replicating what I’ve known in other 3D package and I’ve yet to scratch the surface of what it truly can do! While I’m not trying to paint a rosy picture on using Houdini, there is still area where I wish it is more accessible (like modelling and shaders creation).

To wrap things up, Houdini is already becoming a must-have skill for any FX artists in the VFX and gaming industry.

As someone who never have any actual production experience with Houdini and managed to pick it up (after destroying thousands if not millions of neurons) to generate FX works that I previously do in other 3D package, remember that there is no harm in learning a new skill to broaden your skill sets!

Nuke Tips – Kronos, MotionBlur, Oflow, or VectorBlur?

The last draft for this article dated back to Jan 25, 2016… time to revive it!

Kronos, MotionBlur, Oflow, or Vector Blur? I’m blur…

The great thing with Nuke is that we have many ways to skin a cat problem.

I’ll be focusing on adding motion blur to CGI FX elements like fire, blood and debris. Yes you can abuse I mean use Kronos and Oflow for adding motion blur instead of slowing down footage!

Time to explore the various methods and see which one make or break depending on the situation.

Do not get confused with MotionBlur2D and MotionBlur3D which are not designed to generate motion blur by analysing the image sequences. MotionBlur2D uses the Transform animation while MotionBlur3D uses the camera animation to generate motion blur.

Continue reading

Houdini Tips – Matching Mantra Motion Blur with Vray Motion Blur (3ds Max)

Matching Mantra Motion Blur with Vray Motion Blur? That’s wicked!

So I’ve been working across two 3D package for my upcoming demoreel and one of the issue is to find the right settings for Mantra to match as closely as possible with the motion blur from Vray in 3ds Max.

Since I’m doing all my FX works in Houdini, I did impose a rule to not transfer any of the FX caches from Houdini into Max for the final render.

Actually that is a lie as I did render one FX shot (fracture) as I need to reuse the Vray material in 3ds Max. The rest though are rendered using Mantra and composited over the Vray renders in Nuke.

What’s the magic chant to match the motion blur?

If the camera and Vray motion blur in Max are at default value, proceed as usual.

If not… maybe look at the following steps and see if you can figure out the right value to use for Mantra.

First, make sure the imported Alembic from Max are unpacked.

Don’t forget to put a Trail SOP set to Compute Velocity and also enabling Compute Angular Velocity like in the screenshot above.

This assume you import the camera from Max (and the Alembic geometry and camera are correctly scaled as covered in my prior Houdini Tips)!

Configure Mantra Renderer with the following settings:

  • Allow Motion Blur: On
  • Geo Time Samples: 2
  • Shutter Offset: -2

As usual, do a test render and compare with the Vray render!

The following animated GIFs are self-explanatory.

OK it is not exactly 100% match. Maybe 97-99%?

The rest can be fix in compositing stage if required.

Any reasons for doing this thingamajig instead of round tripping from Houdini to Max?

Basically if I were to render in Max using Vray, I need to match the look of the Pyro FX shader aka spending a long time tweaking the Vray VolumeGrid shader…

Unless you already prepared presets for both Pyro FX and Vray VolumeGrid shader that achieved the same look, I say working directly in Houdini and adjusting in compositing stage is faster and flexible.

Exception for situation that requires interaction with elements in Max only (like Fume FX or BiFrost) but a workaround for it is to convert the caches to VDB and use your preferred renderer.

So it is up to you (or your team) to figure out the best solution to a problem!

Further Reading

Matching Mantra motion blur with Vray motion blur ? – https://www.sidefx.com/forum/topic/34051/

http://www.sidefx.com/docs/houdini/render/blur.html

https://docs.chaosgroup.com/display/VRAY3MAX/Volumetric+Grid+%7C+VRayVolumeGrid