Soft Clip Formula

Anyone know the math behind the standard “Soft Clip” formula? I have the Reinhard Burn math, but I was looking for the traditional Soft Clip control, like what is in Chaos Player, or pretty much every app.

Thanks.

Bump. Would also like to know :slight_smile:

The person who wrote the “Soft Clip” algorithm is no longer working for Chaos, but the pseudo code below explains my understanding of how it works.

x # input color channel
soft_clip # soft clip input value from the ChaosPlayer's ui (used to control the clipping curve)
r # result color

sft = 2 ^ ( - soft_clip / 100 / 3.5 ) # threshold above which the clipping begins

if x <= sft
   r = x
else
   # Factor for smoother clipping.
   # As 'soft_clip' increases, 'f' increases, making the transition softer.
   f = 1 + soft_clip / 100

   # 'x' is translated and logarithmically compressed to make the clipping curve smoother.
   # The division by 'f' Ensures the curve's output is consistent with the softness factor.
   r = ln((x - sft) * f + 1) / f
```​