From ee3d012a6a7f03920f91c196db7f256097149e8f Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Mon, 29 Apr 2024 01:21:29 +0100 Subject: [PATCH] Use CLAMP_TO_EDGE for shadows Partially mitigates https://gitlab.com/OpenMW/openmw/-/issues/7944 The border was necessary in the olden days when the FFP might have shadows, but they require shaders now. --- components/sceneutil/mwshadowtechnique.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/sceneutil/mwshadowtechnique.cpp b/components/sceneutil/mwshadowtechnique.cpp index d1553cc8d8..9fd435f40d 100644 --- a/components/sceneutil/mwshadowtechnique.cpp +++ b/components/sceneutil/mwshadowtechnique.cpp @@ -558,11 +558,9 @@ MWShadowTechnique::ShadowData::ShadowData(MWShadowTechnique::ViewDependentData* _texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); _texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); - // the shadow comparison should fail if object is outside the texture - _texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER); - _texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER); - _texture->setBorderColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); - //_texture->setBorderColor(osg::Vec4(0.0f,0.0f,0.0f,0.0f)); + // the shader clips sampled coordinates, so no need for border + _texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE); + _texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE); // set up the camera _camera = new osg::Camera;