1. Home
  2. Docs
  3. Noises
  4. Modifiers
  5. Clamp

Clamp

Clamps the output value of an input module.

In mathematics, clamp is a function that constrains a real number to an interval [a,b]: clamp(x) = max(a,min(x,b)).

If the output value from the source module is less than the lower bound of the clamping range, this noise module clamps that value to the lower bound. If the output value from the source module is greater than the upper bound of the clamping range, this noise module clamps that value to the upper bound.

This module will output values only between lower and upper bounds parameters.

 

Node inputs/outputs

The module’s constructor needs:

  • Input module : the Generation Module modified by this modifier
  • Lower bound : the lower bound of the clamping range
  • Upper bound : the upper bound of the clamping range (Upper bound > Lower bound)

The output value is a Generation Module

 

Examples

Clamp a sine between -1 and 0

Clamp a sine between -0.5 and 0.5

Clamp a perlin between -1 and -0.5

 

Was this article helpful to you? Yes No

How can we help?