diff --git a/res/shaders/effects/deferred_lighting.glsl b/res/shaders/effects/deferred_lighting.glsl index 6207f1583..55e267bf3 100644 --- a/res/shaders/effects/deferred_lighting.glsl +++ b/res/shaders/effects/deferred_lighting.glsl @@ -1,6 +1,9 @@ #include #include +#define CLOUDS_FOG_FACTOR_MUL 0.3f +#define CLOUDS_FOG_CURVE_MUL 0.4f + vec4 effect() { vec4 pos = texture(u_position, v_uv); float light = 1.0; @@ -32,6 +35,10 @@ vec4 effect() { light = pow(light, u_gamma); vec3 fogColor = texture(u_skybox, dir).rgb; - float fog = calc_fog(pow(length(u_view * vec4((modelpos.xyz - u_cameraPos) * FOG_POS_SCALE, 0.0)) / 256.0, (1.0f - emission * 0.7))); + float fog = calc_fog( + length(u_view * vec4((modelpos.xyz - u_cameraPos) * FOG_POS_SCALE, 0.0)) / 256.0, + mix(1.0, CLOUDS_FOG_FACTOR_MUL, emission), + mix(1.0, CLOUDS_FOG_CURVE_MUL, emission) + ); return vec4(mix(texture(u_screen, v_uv).rgb * mix(1.0, light, 1.0), fogColor, fog), 1.0); } diff --git a/res/shaders/lib/fog.glsl b/res/shaders/lib/fog.glsl index e5ff18bbd..597380bb6 100644 --- a/res/shaders/lib/fog.glsl +++ b/res/shaders/lib/fog.glsl @@ -7,13 +7,17 @@ uniform float u_weatherFogOpacity; uniform float u_weatherFogDencity; uniform float u_weatherFogCurve; -float calc_fog(float depth) { +float calc_fog(float depth, float fogFactor, float fogCurve) { return min( 1.0, - max(pow(depth * u_fogFactor, u_fogCurve), + max(pow(depth * u_fogFactor * fogFactor, u_fogCurve * fogCurve), min(pow(depth * u_weatherFogDencity, u_weatherFogCurve), u_weatherFogOpacity)) ); } +float calc_fog(float depth) { + return calc_fog(depth, 1.0, 1.0); +} + #endif // FOG_GLSL_ diff --git a/src/graphics/render/CloudsRenderer.cpp b/src/graphics/render/CloudsRenderer.cpp index e2047eb63..bfc53e4bb 100755 --- a/src/graphics/render/CloudsRenderer.cpp +++ b/src/graphics/render/CloudsRenderer.cpp @@ -329,7 +329,7 @@ void CloudsRenderer::draw( shader.uniform4f("u_tint", glm::vec4(weather.cloudsTint(), 1.0f)); shader.uniform1f("u_fogFactor", fogFactor * 0.03f); - shader.uniform1f("u_fogCurve", 0.7f - 0.3f); + shader.uniform1f("u_fogCurve", 0.4f); for (int i = 0; i < std::min(quality, layers.size()); i++) { draw(layers[i], frustum, shader, camera, timer, i);