Studio Yotsuba
Back to Node List

Clamp

clamp

Clamps a number between minimum and maximum

Reviewed
Guide available

Input Ports

NameTypeDescription
Input
input
Number
Required
Value to clamp

Output Ports

NameTypeDescription
Value
value
Number
Clamped value

Parameters

NameTypeDefaultRangeDescription / Options
Range Preset
range_preset
Enum
Normalized—

Quick presets for common clamp ranges

  • NormalizedNormalized
    Set the clamp range to 0..1
  • SignedNormalizedSignedNormalized
    Set the clamp range to -1..1
  • PercentPercent
    Set the clamp range to 0..100
  • CountCount
    Set the clamp range to 1..16
  • PixelOffsetPixelOffset
    Set the clamp range to -32..32
  • LargeOffsetLargeOffset
    Set the clamp range to -256..256
  • CustomCustom
    Use the custom Min and Max values
Min
min
Float
0-10000–10000 / step 0.01

Lower bound

Max
max
Float
1-10000–10000 / step 0.01

Upper bound

Soft Min
soft_min
Float
0-100000–100000 / step 0.01

Slider minimum used while editing Min and Max

Soft Max
soft_max
Float
1-100000–100000 / step 0.01

Slider maximum used while editing Min and Max

Soft Step
soft_step
Float
0.010.001–1000 / step 0.001

Slider step used while editing Min and Max

What is it for?

  • Keeping a value within 0–1
  • Preventing positions or strengths from varying too far
  • Producing a safe value that cannot exceed a lower or upper bound

Overview

A safety node that confines a number to a specified range. Values outside the range stick to the nearest endpoint. It is typically placed immediately before a parameter input so that a runaway waveform or calculation cannot break downstream processing.

Usage tips

  • Choose between this node and remap by intent: Remap converts a range while preserving proportions; Clamp clips only the values outside a range. Use Clamp when values already inside the range must pass through unchanged.
  • Placing the Normalized preset before opacity and other 0–1 ratio inputs is the go-to setup.
  • You can also use the flattened out-of-range portions intentionally to cap a waveform and create a trapezoid-like shape.

Related nodes

  • remap — convert a range by compressing or expanding it
  • math_op — Min and Max can limit only one side
  • expression_float — write clamp() directly in an expression

Range presets

  • Normalized
    • The go-to preset for limiting a value to 0..1.
  • SignedNormalized
    • Suited to signed strengths such as -1..1.
  • Percent
    • Suited to percentage values from 0..100.
  • Count
    • Suited to counts or step counts from 1..16.
  • PixelOffset
    • Suited to pixel offsets from -32..32.
  • LargeOffset
    • Suited to larger offsets from -256..256.
  • Custom
    • Use this when you want min / max to define the clamp range.

Notes

  • When min > max, the node automatically swaps them before processing.
  • The output port is Number, but the value currently returned at runtime is Float.
  • For every preset except Custom, range_preset itself determines the evaluated clamp range. The selected preset remains authoritative even if saved data or PPL contains stale min / max values.
  • min / max are evaluated as the actual bounds only in Custom mode.
  • For fine adjustments, switch to Custom and use soft_min / soft_max / soft_step.

Examples

  1. range_preset = Normalized
    • Quickly creates a 0.0–1.0 range.
    • Useful for limiting opacity and ratio values.
  2. Keep the output of Noise Wave within 0.0–1.0
    • Useful when negative values or values above 1 must not pass downstream unchanged.
  3. Pass the result of Math Op(Add) through Clamp
    • Suppresses values that have grown too large through addition.
  4. Limit a value to 0–1 before Opacity
    • Keeps the opacity input within a safe range.
  5. range_preset = PixelOffset
    • Quickly creates a position-correction clamp from -32..32.
  6. Fix ratio inputs for Reveal or Trim to 0–1
    • Helps prevent glitches during animation.
Back to Node List