summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-05-17 14:21:52 -0700
committerGraham Linden <graham@lindenlab.com>2019-05-17 14:21:52 -0700
commitc8ae0c0c3f1747faf36d27a63c66755a1bfeeb3c (patch)
treed710ca558ccaea9bd72faea4f6963d8cc7aa4fe7 /indra/newview/app_settings/shaders/class1
parentb3c0218a31b9d7dd699cf3944bbcfc35e9adbd49 (diff)
SL-11112
Fix blend between reflected/refracted water maps (make less transparent) and fix setting of water fog color alpha on low end to better match prev behavior of setting the internal control value in that case.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterF.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterF.glsl7
3 files changed, 17 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 4a6dbc0313..c81d0f97da 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -153,7 +153,7 @@ vec3 post_diffuse = color.rgb;
vec3 post_spec = color.rgb;
#ifndef WATER_FOG
- color.rgb += diffuse_srgb.a * diffuse_srgb.rgb;
+ color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a);
#endif
if (envIntensity > 0.0)
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index 180f38b1e1..914e17beed 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -64,7 +64,9 @@ VARYING vec4 view;
VARYING vec4 vary_position;
vec2 encode_normal(vec3 n);
-vec3 scaleSoftClipFrag(vec3 l);
+vec3 scaleSoftClip(vec3 l);
+vec3 srgb_to_linear(vec3 c);
+vec3 linear_to_srgb(vec3 c);
vec3 BlendNormal(vec3 bump1, vec3 bump2)
{
@@ -75,7 +77,7 @@ vec3 BlendNormal(vec3 bump1, vec3 bump2)
void main()
{
vec4 color;
- float dist = length(view.xy);
+ float dist = length(view.xyz);
//normalize view vector
vec3 viewVec = normalize(view.xyz);
@@ -127,7 +129,8 @@ void main()
vec4 refcol = refcol1 + refcol2 + refcol3;
float df1 = df.x + df.y + df.z;
- refcol *= df1 * 0.333;
+ df1 *= 0.333;
+ refcol *= df1;
vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5;
wavef.z *= max(-viewVec.z, 0.1);
@@ -142,16 +145,18 @@ void main()
vec4 baseCol = texture2D(refTex, refvec4);
refcol = mix(baseCol*df2, refcol, dweight);
-
+
//figure out distortion vector (ripply)
vec2 distort2 = distort+wavef.xy*(refScale * 0.01)/max(dmod*df1, 1.0);
vec4 fb = texture2D(screenTex, distort2);
-
+
//mix with reflection
// Note we actually want to use just df1, but multiplying by 0.999999 gets around an nvidia compiler bug
- color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999);
-
+ color.rgb = mix(fb.rgb, refcol.rgb, df1 + 0.6);
+ color.rgb *= 2.0f;
+ color.rgb = scaleSoftClip(color.rgb);
+
vec4 pos = vary_position;
vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
index a4e3f94816..043815c824 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
@@ -121,7 +121,8 @@ void main()
vec4 refcol = refcol1 + refcol2 + refcol3;
float df1 = df.x + df.y + df.z;
- refcol *= df1 * 0.333;
+ df1 *= 0.3333;
+ refcol *= df1;
vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5;
@@ -144,13 +145,13 @@ void main()
spec = pow(spec, 128.0);
//figure out distortion vector (ripply)
- vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0);
+ vec2 distort2 = distort+wavef.xy*(refScale*0.01)/max(dmod*df1, 1.0);
vec4 fb = texture2D(screenTex, distort2);
//mix with reflection
// Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug
- color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999);
+ color.rgb = mix(fb.rgb, refcol.rgb, df1 + 0.6);
color.rgb += spec * specular;
color.rgb = atmosTransport(color.rgb);