summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/environment
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-12-04 16:50:06 -0600
committerRunitaiLinden <davep@lindenlab.com>2023-12-04 16:50:06 -0600
commit6472b75bcd70470fe5775d1cf6eb70a75b3d76e5 (patch)
tree4fae5abd39b9af7bad0f6ed55b651d87fa3bfc3b /indra/newview/app_settings/shaders/class1/environment
parentc573d27e5baf23adbc14153c4d65a581f55febb4 (diff)
SL-20611 Followup -- fix edge cases with transparent objects around eye/object above/below water.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment')
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl34
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index 140e01cc2a..f796bb5f3f 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -33,6 +33,8 @@ uniform float waterFogKS;
vec3 srgb_to_linear(vec3 col);
vec3 linear_to_srgb(vec3 col);
+vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
+
// get a water fog color that will apply the appropriate haze to a color given
// a blend function of (ONE, SOURCE_ALPHA)
vec4 getWaterFogViewNoClip(vec3 pos)
@@ -108,3 +110,35 @@ vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
return applyWaterFogViewLinearNoClip(pos, color);
}
+// for post deferred shaders, apply sky and water fog in a way that is consistent with
+// the deferred rendering haze post effects
+vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color)
+{
+ bool eye_above_water = dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0;
+ bool obj_above_water = dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0;
+
+ if (eye_above_water)
+ {
+ if (!obj_above_water)
+ {
+ color.rgb = applyWaterFogViewLinearNoClip(pos, color).rgb;
+ }
+ else
+ {
+ color.rgb = atmosFragLighting(color.rgb, additive, atten);
+ }
+ }
+ else
+ {
+ if (obj_above_water)
+ {
+ color.rgb = atmosFragLighting(color.rgb, additive, atten);
+ }
+ else
+ {
+ color.rgb = applyWaterFogViewLinearNoClip(pos, color).rgb;
+ }
+ }
+
+ return color;
+}