What "clamp" checkbox mean in shader nodes?


thin green line is input. thick green is what clamp does? right? what I see in material preview mode is red? sort of “auto level” is it right ?

Does anyone have any examples of what clamp does for input with bigger than 0-1 range?
I use material preview mode to evaluate what my math nodes do and sometimes I am totally confused?

Normalize is the word you are looking for. Meaning adjust to, or cut off at, the 0 to 1 range.

2 Likes

So I see normalized result in material preview ? When connect to output node? How can I recreate “normalize” in between min and max values in the shader nodes themselves?

There are going to be plenty of math videos teaching normalization.
Sorry - I dont have access to my bookmarks at the moment. So I cannot easily point at a good video to watch.

isn’t map range doing something like this? Or it doesn’t really ? I am interested in something real time working. So something simple is preferable .

Yes, clamp just clips off values above and below the clamp points, just like you’ve drawn. Your drawing right there shows exactly what happens with inputs outside of the 0-1 range: they’re clamped, same as anything else.

Plugging a value directly into the output will give you exactly that: the value. No extra curving. Any curve you think you’re seeing in Material Preview could be from the view transform (Filmic, AgX, etc), but that doesn’t affect the underlying values, just how they’re mapped to your display: the value inside the render is exactly what you plugged into it.

Mapping values to a new min and max is what the Map Range node is for: mapping 0-2 to 0-1, for example, will mean the values that were 1 become 0.5, 1.5 becomes 0.75, etc. Mapping 0.5-1 to 0-2 means 0.5 will become 0, 0.75 will become 1, 0.25 will become -1, 0 will become -2. And so on. (Assuming the interpolation is set to linear. Map Range also offers curved interpolation options.)

1 Like

Thankscarterbk I totally forgot about view transform . You finally made it clear for me.