summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2020-04-27 15:16:21 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2020-04-27 15:16:21 +0300
commit94dc8f12f86adb3bf79b44ab0bc98e6c0f6899ee (patch)
tree7434d3d4dde8eedbad54d5b954579029026f1308 /indra/newview/app_settings/shaders/class1/environment/waterF.glsl
parenta5eb15da0a89c6f9df7d426c0c3c41df445cfd2f (diff)
parentd7f1c88c35849e56f5b352f13c16a08467d1533b (diff)
Merge branch 'master' into DRTVWR-507-maint
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment/waterF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterF.glsl37
1 files changed, 32 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
index 79bffab745..d370997123 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
@@ -32,7 +32,9 @@ out vec4 frag_color;
vec3 scaleSoftClip(vec3 inColor);
vec3 atmosTransport(vec3 inColor);
-uniform sampler2D bumpMap;
+uniform sampler2D bumpMap;
+uniform sampler2D bumpMap2;
+uniform float blend_factor;
uniform sampler2D screenTex;
uniform sampler2D refTex;
@@ -55,6 +57,13 @@ VARYING vec4 refCoord;
VARYING vec4 littleWave;
VARYING vec4 view;
+vec3 BlendNormal(vec3 bump1, vec3 bump2)
+{
+ vec3 n = mix(bump1, bump2, blend_factor);
+ return n;
+}
+
+
void main()
{
vec4 color;
@@ -65,9 +74,21 @@ void main()
vec3 viewVec = normalize(view.xyz);
//get wave normals
- vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
- vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
- vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;
+ vec2 bigwave = vec2(refCoord.w, view.w);
+ vec3 wave1_a = texture2D(bumpMap, bigwave ).xyz*2.0-1.0;
+ vec3 wave2_a = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
+ vec3 wave3_a = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;
+
+
+ vec3 wave1_b = texture2D(bumpMap2, bigwave ).xyz*2.0-1.0;
+ vec3 wave2_b = texture2D(bumpMap2, littleWave.xy).xyz*2.0-1.0;
+ vec3 wave3_b = texture2D(bumpMap2, littleWave.zw).xyz*2.0-1.0;
+
+ vec3 wave1 = BlendNormal(wave1_a, wave1_b);
+ vec3 wave2 = BlendNormal(wave2_a, wave2_b);
+ vec3 wave3 = BlendNormal(wave3_a, wave3_b);
+
+
//get base fresnel components
vec3 df = vec3(
@@ -136,6 +157,12 @@ void main()
color.rgb = atmosTransport(color.rgb);
color.rgb = scaleSoftClip(color.rgb);
color.a = spec * sunAngle2;
-
+
frag_color = color;
+
+#if defined(WATER_EDGE)
+ gl_FragDepth = 0.9999847f;
+#endif
+
}
+