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 name Parents Classification MFn type Compatible function sets
clamp dependNode utility/color kClampColor kBase
kNamedObject
kDependencyNode
kClampColor

Related nodes

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

Attributes (17)

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

Long name (short name) Type Default Flags
min (mn) float3 0.0, 0.0, 0.0 outputinputconnectablestorable
Min is the minimum values for the color channels that will be allowed in the output.
minR (mnr) float 0.0 outputinputconnectablestorablekeyable
Red component of Min
minG (mng) float 0.0 outputinputconnectablestorablekeyable
Green component of Min
minB (mnb) float 0.0 outputinputconnectablestorablekeyable
Blue component of Min
max (mx) float3 0.0, 0.0, 0.0 outputinputconnectablestorable
Max is the maximum values for the color channels that will be allowed in the output.
maxR (mxr) float 0.0 outputinputconnectablestorablekeyable
Red component of Max
maxG (mxg) float 0.0 outputinputconnectablestorablekeyable
Green component of Max
maxB (mxb) float 0.0 outputinputconnectablestorablekeyable
Blue component of Max
input (ip) float3 0.0, 0.0, 0.0 outputinputconnectablestorable
Input is the input color or texture that will be clamped by this node.
inputR (ipr) float 0.0 outputinputconnectablestorablekeyable
Red component of Input
inputG (ipg) float 0.0 outputinputconnectablestorablekeyable
Green component of Input
inputB (ipb) float 0.0 outputinputconnectablestorablekeyable
Blue component of Input
renderPassMode (arp) enum 1 outputinputconnectablestorablekeyable
renderPassMode controls how the node affects material render passes.
output (op) float3 0.0, 0.0, 0.0 outputconnectable
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) float 0.0 outputconnectable
Red component of Output
outputG (opg) float 0.0 outputconnectable
Green component of Output
outputB (opb) float 0.0 outputconnectable
Blue component of Output