From c2859d24ce4bd7628b0284ee909f109c5dbc9477 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sat, 15 Nov 2014 21:27:15 +0100 Subject: [PATCH] Improved shadow stability --- data/shaders/sunlightshadow.frag | 2 +- src/graphics/post_processing.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/shaders/sunlightshadow.frag b/data/shaders/sunlightshadow.frag index 7ad3e08a0..f242a309c 100644 --- a/data/shaders/sunlightshadow.frag +++ b/data/shaders/sunlightshadow.frag @@ -34,7 +34,7 @@ float getShadowFactor(vec3 pos, float bias, int index) float z = texture(shadowtex, vec3(shadowtexcoord, float(index))).x; float d = shadowcoord.z; - return min(pow(exp(-8. * d) * z, 256.), 1.); + return min(pow(exp(-8. * d) * z, 32.), 1.); } void main() { diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 2f557ecc6..cf6b58e5e 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -341,7 +341,7 @@ void PostProcessing::renderGaussian6BlurLayer(FrameBuffer &in_fbo) FullScreenShader::ComputeShadowBlurVShader::getInstance()->SetTextureUnits(LayerTex); glBindSampler(FullScreenShader::ComputeShadowBlurVShader::getInstance()->TU_dest, 0); glBindImageTexture(FullScreenShader::ComputeShadowBlurVShader::getInstance()->TU_dest, irr_driver->getFBO(FBO_SCALAR_1024).getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R32F); - FullScreenShader::ComputeShadowBlurVShader::getInstance()->setUniforms(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.f); + FullScreenShader::ComputeShadowBlurVShader::getInstance()->setUniforms(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.5f); glDispatchCompute((int)1024 / 8 + 1, (int)1024 / 8 + 1, 1); glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); @@ -349,7 +349,7 @@ void PostProcessing::renderGaussian6BlurLayer(FrameBuffer &in_fbo) FullScreenShader::ComputeShadowBlurHShader::getInstance()->SetTextureUnits(irr_driver->getFBO(FBO_SCALAR_1024).getRTT()[0]); glBindSampler(FullScreenShader::ComputeShadowBlurHShader::getInstance()->TU_dest, 0); glBindImageTexture(FullScreenShader::ComputeShadowBlurHShader::getInstance()->TU_dest, LayerTex, 0, false, 0, GL_WRITE_ONLY, GL_R32F); - FullScreenShader::ComputeShadowBlurHShader::getInstance()->setUniforms(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.f); + FullScreenShader::ComputeShadowBlurHShader::getInstance()->setUniforms(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.5f); glDispatchCompute((int)1024 / 8 + 1, (int)1024 / 8 + 1, 1); glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); }