Changed fog function from exp to linear.

This commit is contained in:
Faerbit 2014-11-25 13:24:02 +01:00
parent dc06154163
commit 51bb3a9868

View File

@ -55,7 +55,7 @@ void main()
vec3 finalColor = specularColor + diffuseColor + ambientColor; vec3 finalColor = specularColor + diffuseColor + ambientColor;
float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition)); float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition));
float fogFactor = clamp((1.0 - exp(-distanceCameraCenter+fogStart)), 0.0, 1.0); float fogFactor = clamp((1.0 - exp(-distanceCameraCenter+fogStart)), 0.0, 1.0);
fogFactor = mix(fogFactor, 0.0, clamp((1.0 - exp(-fragPosition.y+20.0)), 0.0, 1.0)); fogFactor = mix(fogFactor, 0.0, clamp((fragPosition.y/50.0), 0.0, 1.0));
vec4 texture = texture(uTexture, vTexCoord).rgba; vec4 texture = texture(uTexture, vTexCoord).rgba;
oColor = vec4(finalColor, 1.0f)*texture; oColor = vec4(finalColor, 1.0f)*texture;