From b76b85770f3864e3a0c55e9aa54bd5056783004e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 16 Dec 2007 17:41:46 +0000 Subject: [PATCH] From Wojiech Lewandowski, "There was a bug in ShadowMap camera view matrix computation. View matrix was wrong when light was directional and shadowed scene was not centered at zero coord. I fixed that and also modified cast distance to much smaller value. With former range it was possible to generate shadows with lowest LODs. " --- src/osgShadow/ShadowMap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgShadow/ShadowMap.cpp b/src/osgShadow/ShadowMap.cpp index b87cf907d..d2b2addc3 100644 --- a/src/osgShadow/ShadowMap.cpp +++ b/src/osgShadow/ShadowMap.cpp @@ -433,7 +433,7 @@ void ShadowMap::cull(osgUtil::CullVisitor& cv) lightDir.normalize(); // set the position far away along the light direction - osg::Vec3 position = lightDir * bb.radius() * 20; + osg::Vec3 position = bb.center() + lightDir * bb.radius() * 2; float centerDistance = (position-bb.center()).length();