summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl20
3 files changed, 20 insertions, 14 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index 4a0bb3fe98..e1cdeddcea 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -72,7 +72,7 @@ vec4 applyWaterFogView(vec3 pos, vec4 color)
return color;
}
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit)
{
if (dot(pos, waterPlane.xyz) + waterPlane.w > 0.0)
{
@@ -101,6 +101,7 @@ vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
float ks = waterFogKS;
vec4 kc = waterFogColor;
kc.rgb = srgb_to_linear(kc.rgb); // TODO -- pass in waterFogColor linear
+ kc.rgb *= sunlit;
float F = 0.98;
@@ -117,6 +118,11 @@ vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
return color;
}
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
+{
+ return applyWaterFogViewLinear(pos, color, vec3(1));
+}
+
vec4 applyWaterFog(vec4 color)
{
//normalize view vector
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 25b0a0b970..076b976dc4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -72,7 +72,7 @@ uniform vec3 light_diffuse[8];
void waterClip(vec3 pos);
#ifdef WATER_FOG
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color);
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
#endif
vec3 srgb_to_linear(vec3 c);
@@ -226,7 +226,7 @@ void main()
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
- vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir;
+ vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir; // TODO -- factor out "sun_up_factor" and just send in the appropriate light vector
float final_alpha = diffuse_linear.a;
@@ -295,7 +295,7 @@ void main()
#endif // !defined(LOCAL_LIGHT_KILL)
#ifdef WATER_FOG
- color = applyWaterFogViewLinear(pos.xyz, color);
+ color = applyWaterFogViewLinear(pos.xyz, color, sunlit);
#endif // WATER_FOG
#endif // #else // FOR_IMPOSTOR
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index dbe0929657..85c3f42801 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -34,7 +34,7 @@ out vec4 frag_color;
vec3 scaleSoftClipFragLinear(vec3 l);
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color);
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
// PBR interface
vec3 pbrIbl(vec3 diffuseColor,
@@ -179,7 +179,14 @@ void main()
vec2 distort2 = distort + waver.xy * refScale / max(dmod, 1.0);
distort2 = clamp(distort2, vec2(0), vec2(0.999));
-
+
+ vec3 sunlit;
+ vec3 amblit;
+ vec3 additive;
+ vec3 atten;
+
+ calcAtmosphericVarsLinear(pos.xyz, wavef, vary_light_dir, sunlit, amblit, additive, atten);
+
#ifdef TRANSPARENT_WATER
vec4 fb = texture2D(screenTex, distort2);
float depth = texture2D(screenDepth, distort2).r;
@@ -194,18 +201,11 @@ void main()
refPos = getPositionWithNDC(vec3(distort2 * 2.0 - vec2(1.0), depth * 2.0 - 1.0));
}
- fb = applyWaterFogViewLinear(refPos, fb);
+ fb = applyWaterFogViewLinear(refPos, fb, sunlit);
#else
vec4 fb = vec4(waterFogColorLinear.rgb, 0.0);
#endif
- vec3 sunlit;
- vec3 amblit;
- vec3 additive;
- vec3 atten;
-
- calcAtmosphericVarsLinear(pos.xyz, wavef, vary_light_dir, sunlit, amblit, additive, atten);
- sunlit = vec3(1); // TODO -- figure out why sunlit is breaking at some view angles
vec3 v = -viewVec;
float NdotV = clamp(abs(dot(wavef.xyz, v)), 0.001, 1.0);