Water threshhold added, now it's actually waterlike

This commit is contained in:
tleety
2015-09-24 16:23:57 +02:00
parent a1215d71e9
commit ef3591ba46
@@ -45,6 +45,8 @@ void main()
float hstep = dir.x;
float vstep = dir.y;
float Threshhold = 0.1;
//apply filter using a 9 tap filter with predefined gaussian weights
sum += texture(WaterTexture, vec2(tc.x - 4.0*blur*hstep, tc.y - 4.0*blur*vstep)) * 0.0162162162;
@@ -59,5 +61,10 @@ void main()
sum += texture(WaterTexture, vec2(tc.x + 3.0*blur*hstep, tc.y + 3.0*blur*vstep)) * 0.0540540541;
sum += texture(WaterTexture, vec2(tc.x + 4.0*blur*hstep, tc.y + 4.0*blur*vstep)) * 0.0162162162;
frag_Diffuse = vec4(sum.rgb, 1.0) * vec4(0.0, 0.3, 1.0, 1.0);
frag_Diffuse = vec4(sum.rgb, 1.0) * vec4(0.0, 0.6, 1.5, 1.0);
float avgColor = frag_Diffuse.r + frag_Diffuse.g + frag_Diffuse.b;
avgColor = avgColor/3;
if ( avgColor*dir.y > Threshhold ){
frag_Diffuse = vec4(0.0, 0.6, 1.0, 1.0);
}
}