summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-05-25 16:16:36 -0500
committerRunitaiLinden <davep@lindenlab.com>2023-05-25 16:16:36 -0500
commita70575091bcedc762b47bc1115c4aa8ebdb58778 (patch)
tree391ad8837c7fd1ce5b086779eb4621f82cd5aea7 /indra/newview/app_settings/shaders
parent30311e5229bff107c2722de68aabb656d9b8f097 (diff)
parentcbd17fce86cc30434d6d665338a7d771bddcad8b (diff)
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl12
3 files changed, 19 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index ae8cd97b18..cd57b47eae 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -274,6 +274,10 @@ void main()
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
+#ifdef WATER_FOG
+ color = applyWaterFogViewLinear(pos.xyz, color, sunlit_linear);
+#endif // WATER_FOG
+
vec4 light = vec4(0,0,0,0);
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w);
@@ -291,11 +295,6 @@ void main()
color.rgb += light.rgb;
#endif // !defined(LOCAL_LIGHT_KILL)
-
-#ifdef WATER_FOG
- color = applyWaterFogViewLinear(pos.xyz, color, sunlit_linear);
-#endif // WATER_FOG
-
#endif // #else // FOR_IMPOSTOR
#ifdef IS_HUD
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index e6aef7abdc..9ac106149e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -84,6 +84,10 @@ vec3 linear_to_srgb(vec3 c);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
vec3 atmosFragLightingLinear(vec3 color, vec3 additive, vec3 atten);
+#ifdef WATER_FOG
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
+#endif
+
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
float calcLegacyDistanceAttenuation(float distance, float falloff);
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
@@ -237,6 +241,11 @@ void main()
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
+#ifdef WATER_FOG
+ vec4 temp = applyWaterFogViewLinear(pos, vec4(color, 0.0), sunlit_linear);
+ color = temp.rgb;
+#endif
+
vec3 light = vec3(0);
// Punctual lights
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index ba19fe0f19..5fb5647d35 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -38,7 +38,7 @@ uniform float emissive_brightness; // fullbright flag, 1.0 == fullbright, 0.0 o
uniform int sun_up_factor;
#ifdef WATER_FOG
-vec4 applyWaterFogView(vec3 pos, vec4 color);
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
#endif
vec3 atmosFragLightingLinear(vec3 l, vec3 additive, vec3 atten);
@@ -411,6 +411,11 @@ void main()
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
+#ifdef WATER_FOG
+ vec4 temp = applyWaterFogViewLinear(pos, vec4(color, 0.0), sunlit_linear);
+ color = temp.rgb;
+#endif
+
vec3 npos = normalize(-pos.xyz);
vec3 light = vec3(0, 0, 0);
@@ -431,11 +436,6 @@ void main()
glare = min(glare, 1.0);
float al = max(diffcol.a, glare) * vertex_color.a;
-#ifdef WATER_FOG
- vec4 temp = applyWaterFogView(pos, vec4(color, 0.0));
- color = temp.rgb;
-#endif
-
frag_color = max(vec4(color, al), vec4(0));
#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer