diff options
| author | yum <yum.food.vr@gmail.com> | 2024-11-18 18:16:38 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-11-18 18:16:38 -0800 |
| commit | 8bc2ce35d518a37cc07fba23613d85822c9c0ea6 (patch) | |
| tree | c917bba999b5491d08291612d8472db2cda6ba84 /tone.cginc | |
| parent | 5fdbeddf4b0002ae292c6f4081a0c9baeda919bf (diff) | |
Add ACES filmic toggle to main shader
Diffstat (limited to 'tone.cginc')
| -rw-r--r-- | tone.cginc | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -21,7 +21,7 @@ float3 aces_filmic(float3 x) { // Nice properties: // 1. At x=0, the derivative is 1. // 2. No transcendental ops, and branchless. -float3 smooth_clamp(float3 x, float k) { +float3 smooth_min(float3 x, float k) { // Derivation of `b` from `k`: // f(x, b) = b * x / (x + b) // We want f(1, b) = k. @@ -40,12 +40,15 @@ float3 smooth_clamp(float3 x, float k) { float b = k/(1-k); return b * x / (x + b); } -float smooth_clamp(float x, float k) { +float smooth_min(float x, float k) { float e = 1E-4; k = min(1-e, k); float b = k/(1-k); return b * x / (x + b); } +float smooth_clamp(float x, float lo, float hi) { + return smooth_max(smooth_min(x, hi), lo); +} #endif // __TONE_INC |
