diff --git a/data/shaders/fog.frag b/data/shaders/fog.frag index cb5ec7348..3b97ab40f 100644 --- a/data/shaders/fog.frag +++ b/data/shaders/fog.frag @@ -15,13 +15,11 @@ vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); void main() { vec2 uv = gl_FragCoord.xy / screen; - float z = texture(tex, uv).x; - vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix); + float z = texture(tex, uv).x; + vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix); - float dist = length(xpos.xyz); - float fog = smoothstep(start, end, dist); + float dist = length(xpos.xyz); + vec3 fog = col * (1. - exp(- fogmax * .01 * dist)); - fog = min(fog, fogmax); - - FragColor = vec4(col, fog); + FragColor = vec4(fog, 1.); } diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 71830777f..8322ae814 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -473,7 +473,7 @@ void PostProcessing::renderFog() glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFunc(GL_ONE, GL_ONE); FullScreenShader::FogShader::getInstance()->SetTextureUnits(irr_driver->getDepthStencilTexture()); diff --git a/src/graphics/render_skybox.cpp b/src/graphics/render_skybox.cpp index 0016016f2..dca9dd889 100644 --- a/src/graphics/render_skybox.cpp +++ b/src/graphics/render_skybox.cpp @@ -538,6 +538,7 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera) core::matrix4 transform = translate * scale; core::matrix4 invtransform; transform.getInverse(invtransform); + glDisable(GL_BLEND); glUseProgram(MeshShader::SkyboxShader::getInstance()->Program); MeshShader::SkyboxShader::getInstance()->setUniforms(transform);