reworked lighting uniforms
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / vg / water.fs.glsl
diff --git a/shaders/vg/water.fs.glsl b/shaders/vg/water.fs.glsl
new file mode 100644 (file)
index 0000000..b352e39
--- /dev/null
@@ -0,0 +1,20 @@
+out vec4 FragColor;
+
+uniform sampler2D uTexMain;
+uniform sampler2D uTexDudv;
+uniform vec2 uInvRes;
+uniform float uTime;
+
+in vec2 aUv;
+
+void main()
+{
+   vec2 ssuv = gl_FragCoord.xy*uInvRes;
+   vec4 dudva = texture( uTexDudv, aUv + vec2(uTime*0.04f,uTime*0.03f) );
+   vec4 dudvb = texture( uTexDudv, aUv - vec2(uTime*0.1,uTime*0.054) );
+
+   vec2 distortamt = (dudva.rg-0.5) * (dudvb.ba-0.5) * 2.0;
+
+   vec4 reflected = texture( uTexMain, ssuv+distortamt );
+   FragColor = vec4(reflected.rgb*1.0,reflected.a);
+}