<aside>

Recommended download:

HDA FIT RANGE VISUALIZER An interactive Houdini HDA designed to make the FIT RANGE visible and intuitive.

[[ NEW ]] HDA FIT RANGE VISUALIZER [[ NEW ]]

</aside>

<aside>

TL:DR Take a value from one range → find its relative position → put it into another range.

And then there are two important behaviors:

Outside Source range → clamped

Smaller Source range → more contrast

</aside>

Fit Range is like a ruler conversion. It doesn't care about the actual numbers. It cares about where the value sits within the range.

1. Find the value's position

Let's say:

Source Range: 2 → 8

Input: 3

The Source range has a total length of:

8 − 2 = 6 Spaces
In other words, this can also be seeing as the "magnitude" of the line

The input is measured by calculating the distance from the start:

3 − 2 = 1      
In other words, **3** is 1 distance from 2 which is where the input range starts

So the input is 1 unit into a 6-unit range:

1 / 6 ≈ 0.167
This is calculated by dividing 1 by the number of total spaces calculated above

3 is 1/6 of the way from 2 to 8.

1/6 is the position of 3 within the Source range.

image.png


2. Transfer that position

Destination is:

0 → 10

We take the same position — 1/6 of the way — and put it into the Destination:

The Destination has a length of 10.

So:

1/6 × 10 = 1.67

Therefore:

3 → 1.67

Source:       2 ── 3 ───────── 8
                  ↑
               1/6 along

Destination:  0 ── ? ───────── 10
                  ↑
               1/6 along (same position, different values, "fitted result")

3. What happens outside the Source range?

Our Source is still:

2 → 8

What if the input is 1?

1    2 ─────────────── 8
↑    │                 │
input

The normal Fit Range clamps the input to the Source range.

So 1 is treated as 2.

Since 2 is the beginning of the Source:

2 → 0

Therefore:

1 → 0

Likewise, an input above 8 is treated as 8 and produces 10.

Outside the Source range → clamp to the nearest endpoint.


4. How does Source Range affect contrast?

Destination: 0 → 10

Compare:

Source A:      2 ───── 8
Source B:  0 ───────────── 10

With 2 → 8, the values have a small Source range.

With 0 → 10, the values have a larger Source range to spread across.

So Fit Range has to stretch the values more to fill the same Destination range.

Source:       2 ── 3 ── 4 ── 5 ── 6 ── 7 ── 8

Output:       0  1.67  3.33   5  6.67  8.33  10

The differences between values become larger.

In other words:

Smaller Source range → values are stretched → more contrast

Larger Source range → values are compressed → less contrast