summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3/environment
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-03-02 16:36:03 -0600
committerDave Parks <davep@lindenlab.com>2023-03-02 16:36:03 -0600
commitbc7856098f70371dd392c74689df267cce819aa7 (patch)
treecab4a765e34088ff63e4e9d496f6036513c4b337 /indra/newview/app_settings/shaders/class3/environment
parent0982c44b46bfcbbf0d9a7a9a93605112fd1a4bd4 (diff)
SL-19281 Unify handling of haze and gamma between fullbright and not and move haze back to sRGB color space to stay consistent with sky colors. Also fix broken "roughness" stuck at 0.2.
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/environment')
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl17
1 files changed, 12 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index a87682affb..991079e77a 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -114,6 +114,7 @@ vec3 BlendNormal(vec3 bump1, vec3 bump2)
}
vec3 srgb_to_linear(vec3 col);
+vec3 linear_to_srgb(vec3 col);
vec3 vN, vT, vB;
@@ -200,6 +201,8 @@ void main()
calcAtmosphericVarsLinear(pos.xyz, wavef, vary_light_dir, sunlit, amblit, additive, atten);
+ vec3 sunlit_linear = srgb_to_linear(sunlit);
+
#ifdef TRANSPARENT_WATER
vec4 fb = texture2D(screenTex, distort2);
float depth = texture2D(screenDepth, distort2).r;
@@ -216,9 +219,10 @@ void main()
fb = applyWaterFogViewLinear(refPos, fb, sunlit);
#else
- vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(1.0), sunlit);
+ vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(1.0), sunlit_linear);
#endif
+ fb.rgb *= 0.75;
float metallic = 0.0;
float perceptualRoughness = 0.05;
float gloss = 1.0 - perceptualRoughness;
@@ -247,10 +251,7 @@ void main()
vec3 punctual = pbrPunctual(vec3(0), specularColor, 0.1, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir));
- vec3 color = punctual * sunlit * 2.75 * scol;
-
- color = atmosFragLightingLinear(color, additive, atten);
- color = scaleSoftClipFragLinear(color);
+ vec3 color = punctual * sunlit_linear * 2.75 * scol;
vec3 ibl = pbrIbl(vec3(0), vec3(1), radiance, vec3(0), ao, NdotV, 0.0);
@@ -274,6 +275,12 @@ void main()
color = mix(color, fb.rgb, f);
+ color.rgb = linear_to_srgb(color.rgb);
+ color = atmosFragLightingLinear(color, additive, atten);
+ color = scaleSoftClipFragLinear(color);
+ color.rgb = srgb_to_linear(color.rgb);
+
+
float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.05);
frag_color = vec4(color, spec); //*sunAngle2);