|
|
|
@ -174,7 +174,7 @@ void main(void)
|
|
|
|
|
vec3 waterColor = WATER_COLOR * sunFade;
|
|
|
|
|
|
|
|
|
|
vec4 sunSpec = lcalcSpecular(0);
|
|
|
|
|
// alpha component is sun visibility; we want to start fading specularity when visibility is low
|
|
|
|
|
// alpha component is sun visibility; we want to start fading lighting effects when visibility is low
|
|
|
|
|
sunSpec.a = min(1.0, sunSpec.a / SUN_SPEC_FADING_THRESHOLD);
|
|
|
|
|
|
|
|
|
|
// artificial specularity to make rain ripples more noticeable
|
|
|
|
@ -203,7 +203,7 @@ void main(void)
|
|
|
|
|
float sunHeight = lVec.z;
|
|
|
|
|
vec3 scatterColour = mix(SCATTER_COLOUR*vec3(1.0,0.4,0.0), SCATTER_COLOUR, clamp(1.0-exp(-sunHeight*SUN_EXT), 0.0, 1.0));
|
|
|
|
|
vec3 lR = reflect(lVec, lNormal);
|
|
|
|
|
float lightScatter = clamp(dot(lVec,lNormal)*0.7+0.3, 0.0, 1.0) * clamp(dot(lR, vVec)*2.0-1.2, 0.0, 1.0) * SCATTER_AMOUNT * sunFade * clamp(1.0-exp(-sunHeight), 0.0, 1.0);
|
|
|
|
|
float lightScatter = clamp(dot(lVec,lNormal)*0.7+0.3, 0.0, 1.0) * clamp(dot(lR, vVec)*2.0-1.2, 0.0, 1.0) * SCATTER_AMOUNT * sunFade * sunSpec.a * clamp(1.0-exp(-sunHeight), 0.0, 1.0);
|
|
|
|
|
gl_FragData[0].xyz = mix(mix(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpec.rgb * sunSpec.a + rainSpecular;
|
|
|
|
|
gl_FragData[0].w = 1.0;
|
|
|
|
|
|
|
|
|
|