summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-09-27 23:32:02 -0500
committerDave Parks <davep@lindenlab.com>2022-09-27 23:32:02 -0500
commitaaf7b17db047f0cb2630b479d5468062e6ca815e (patch)
treea84d5d7668ff65fc6dec3315fd1a760213496e4d /indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
parent44f2286e42a10270c23ea11e308143948d1e3288 (diff)
SL-18190 WIP -- Take 2 on linear space windlight (more methodical approach -- make desired interface but brute force color conversions). Placeholder PBR water and move to deprecate forward rendering shaders.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl16
1 files changed, 16 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
index 68db7fcbb1..6dfb2e7cf6 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
@@ -28,6 +28,22 @@ uniform int no_atmo;
vec3 getAtmosAttenuation();
vec3 getAdditiveColor();
+vec3 srgb_to_linear(vec3 col);
+vec3 linear_to_srgb(vec3 col);
+
+vec3 scaleSoftClipFragLinear(vec3 light)
+{
+ if (no_atmo == 1)
+ {
+ return light;
+ }
+ light = linear_to_srgb(light);
+ //soft clip effect:
+ light = 1. - clamp(light, vec3(0.), vec3(1.));
+ light = 1. - pow(light, vec3(gamma)); // s/b inverted already CPU-side
+ return srgb_to_linear(light);
+}
+
vec3 scaleSoftClipFrag(vec3 light)
{
if (no_atmo == 1)