1
0
Fork 0

Sky irradiance reflection for ALS water shader

This commit is contained in:
Thorsten Renk 2014-05-09 09:06:34 +03:00
parent a9fe9d095f
commit dd72bbb5fa

View file

@ -511,12 +511,21 @@ void main(void)
// primary reflection of the sun
specular_light = gl_Color.rgb * earthShade;
vec3 specular_color = vec3(specular_light)
* pow(max(0.0, dot(N, Hv)), water_shininess) * 6.0;
// secondary reflection of sky irradiance
vec3 ER = E - 2.0 * N * dot(E,N);
float ctrefl = dot(vec3(0.0,0.0,1.0), -normalize(ER));
float fresnel = -0.5 + 8.0 * (1.0-smoothstep(0.0,0.4, dot(E,N)));
specular_color += (ctrefl*ctrefl) * fresnel* specular_light.rgb;
vec4 specular = vec4(specular_color, 0.5);
specular = specular * saturation * 0.3 * earthShade ;