accommodate inspector change
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / model_gate.fs
1 out vec4 FragColor;
2
3 uniform sampler2D uTexMain;
4 uniform sampler2D uTexWater;
5 uniform vec2 uInvRes;
6 uniform float uTime;
7 uniform vec3 uCam;
8
9 in vec3 aNorm;
10 in vec2 aUv;
11 in vec3 aCo;
12
13 void main()
14 {
15 vec2 ssuv = gl_FragCoord.xy*uInvRes;
16 vec4 mapwater = texture( uTexWater, vec2(aUv.x,aUv.y-uTime));
17
18 float undistort = smoothstep(0.1,0.6,distance( uCam, aCo )*0.1);
19 vec2 trimedge = smoothstep(0.0,0.2,1.0-abs(ssuv-0.5)*2.0);
20 undistort *= trimedge.x * trimedge.y;
21
22 vec2 warpamt = (mapwater.rg-0.5)*0.05*aUv.y*undistort;
23 vec4 mapbackbuffer = texture( uTexMain, ssuv + warpamt );
24
25 float opacity = 1.0-smoothstep(0.4,1.0,aUv.y);
26 FragColor = vec4( mapbackbuffer.rgb, opacity );
27 }