Go to: Related nodes. Attributes.

Clamp is a utility node that can be used to keep a color value within a specified range. Input values outside the range are "clamped" to the allowed range.

For example, if you set MinR to 0.3 and MaxR to 0.6, here are the outputs you would get for various inputs:

 InputR:    0.1   0.2   0.3   0.4   0.5   0.6   0.7   0.8   0.9
 OutputR:   0.3   0.3   0.3   0.4   0.5   0.6   0.6   0.6   0.6
 

You can also use this node to clamp individual values (not just colors) to a specified range. To do this, just attach the value to one of the R, G, or B channels of the input (e.g. Input R or Input G).

In the table below, important attributes have their names listed in bold in the description column.

This node is MP safe

Node nameParentsClassificationMFn typeCompatible function sets
clampdependNodeutility/colorkClampColorkBase
kNamedObject
kDependencyNode
kClampColor

Related nodes

blendColors, lightInfo, gammaCorrect, surfaceLuminance, contrast, luminance, rgbToHsv, hsvToRgb, samplerInfo, setRange, resolution, renderQuality, renderGlobals, renderGlobalsList, baseShadingSwitch, singleShadingSwitch, doubleShadingSwitch, tripleShadingSwitch

Attributes (16)

input, inputB, inputG, inputR, max, maxB, maxG, maxR, min, minB, minG, minR, output, outputB, outputG, outputR

Long name (short name)TypeDefaultFlags
min (mn) float30.0, 0.0, 0.0outputinputconnectablestorable
Min is the minimum values for the color channels that will be allowed in the output.
minR (mnr) float0.0outputinputconnectablestorablekeyable
Red component of Min
minG (mng) float0.0outputinputconnectablestorablekeyable
Green component of Min
minB (mnb) float0.0outputinputconnectablestorablekeyable
Blue component of Min
max (mx) float30.0, 0.0, 0.0outputinputconnectablestorable
Max is the maximum values for the color channels that will be allowed in the output.
maxR (mxr) float0.0outputinputconnectablestorablekeyable
Red component of Max
maxG (mxg) float0.0outputinputconnectablestorablekeyable
Green component of Max
maxB (mxb) float0.0outputinputconnectablestorablekeyable
Blue component of Max
input (ip) float30.0, 0.0, 0.0outputinputconnectablestorable
Input is the input color or texture that will be clamped by this node.
inputR (ipr) float0.0outputinputconnectablestorablekeyable
Red component of Input
inputG (ipg) float0.0outputinputconnectablestorablekeyable
Green component of Input
inputB (ipb) float0.0outputinputconnectablestorablekeyable
Blue component of Input
output (op) float30.0, 0.0, 0.0outputconnectable
Ouput is the final clamped value. It is calculated by taking Input, and clamping all the values that go outside the range defined by Min and Max for each channel.
outputR (opr) float0.0outputconnectable
Red component of Output
outputG (opg) float0.0outputconnectable
Green component of Output
outputB (opb) float0.0outputconnectable
Blue component of Output