Nuke Tips – Clamp Node

Clamping the Clamp Node

Update 1st July 2018: Here’s the link to the cabin depth render for your exploration. Credits to http://www.3drender.com/challenges/ for the original model.

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).

Feel free to download the EXR (in ZIP format) for your testing.

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.