From 19d02d8c78868b6dd592c9b61fdcde3725f37c8d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 17 Sep 2008 18:51:17 +0000 Subject: [PATCH] From Adrian Egli, "I changed the PSSM shadow map implementation, if we have filtered turned on, it should be now correct. The implementation is more robut on different scene. i tested it on NVIDIA card against a park scene, a chess board and a terrain. unfort. i couldn't test it on any ATI system. may there will be still another problem there. if there are still some artefacts. we should try out better fZOffSet value " --- src/osgShadow/ParallelSplitShadowMap.cpp | 48 ++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/osgShadow/ParallelSplitShadowMap.cpp b/src/osgShadow/ParallelSplitShadowMap.cpp index 7df883ff1..57ce2c7e4 100644 --- a/src/osgShadow/ParallelSplitShadowMap.cpp +++ b/src/osgShadow/ParallelSplitShadowMap.cpp @@ -102,28 +102,46 @@ std::string ParallelSplitShadowMap::FragmentShaderGenerator::generateGLSL_Fragme } if (filtered) { - sstr << " float fTexelSize="<< (sqrt(2.0) / textureRes ) <<";" << std::endl; + sstr << " float fTexelSize="<< (1.41 / textureRes ) <<";" << std::endl; + sstr << " float fZOffSet = -0.0015;" << std::endl; + } for (unsigned int i=0;isetInternalFormat(GL_RGBA); #endif - pssmShadowSplitTexture._texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); - pssmShadowSplitTexture._texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); + pssmShadowSplitTexture._texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST); + pssmShadowSplitTexture._texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST); pssmShadowSplitTexture._texture->setBorderColor(osg::Vec4(1.0,1.0,1.0,1.0)); pssmShadowSplitTexture._texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_BORDER); pssmShadowSplitTexture._texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_BORDER);