From Wojciech Lewandowski, "Here comes a list of small fixes in StandardShadowMap and derived classes affecting LispSM techniques. Changes made against SVN trunk.
Fixes in StandardShadowMap.cpp & MinimalShadowMap.cpp were made for spotlight issues. There were cases when further located spotlights were not shadowing properly. Small tweak in DebugShadowMap & StandardShadowMap.cpp to not limit shadow maps to texture2D (which should also allow texture2D arrays and cube maps). I simply replaced ptr to osg::Texture2D with pointer to osg::Texture. Interpretation of this member could be now changed with change of shaders in derived classes. This may be useful for guys who override LispSM or MinimalBoundsShadowMaps techniques. Could be useful for implementation of PerspectiveCascadedShadowMaps technique for example. ConvexPolyhedron.cpp & DebugShadowMap.cpp contain debug HUD tweaks. Change in ConvexPolyhedron.cpp overcomes the regression problem with color per primitive binding which caused that shadow volume outlines stopped to draw. I simply changed PER_PRIMITIVE to PER_PRIMITIVE_SET and it works again. Other adition is dump method I added to DebugShadowMap which can be used in shadow debugging mode to dump current frame shadow volumes & scene to osg file. It could be then loaded into viewer and freely examined from different angles (which is difficult inside the application if shadow adopts to view and projection). "
This commit is contained in:
@@ -180,7 +180,13 @@ void MinimalShadowMap::ViewData::frameShadowCastingCamera
|
||||
|
||||
osg::Matrix transform = osg::Matrix::inverse( mvp );
|
||||
|
||||
osg::Vec3d normal = osg::Matrix::transform3x3( osg::Vec3d(0,0,-1), transform );
|
||||
// Code below was working only for directional lights ie when projection was ortho
|
||||
// osg::Vec3d normal = osg::Matrix::transform3x3( osg::Vec3d( 0,0,-1)., transfrom );
|
||||
|
||||
// So I replaced it with safer code working with spot lights as well
|
||||
osg::Vec3d normal =
|
||||
osg::Vec3d(0,0,-1) * transform - osg::Vec3d(0,0,1) * transform;
|
||||
|
||||
normal.normalize();
|
||||
_sceneReceivingShadowPolytope.extrude( normal * *_minLightMarginPtr );
|
||||
|
||||
@@ -255,7 +261,7 @@ void MinimalShadowMap::ViewData::cullShadowReceivingScene( )
|
||||
_cv->clampProjectionMatrix( _clampedProjection, n, f );
|
||||
}
|
||||
|
||||
// Aditionally clamp far plane if shadows are don't need to be cast as
|
||||
// Aditionally clamp far plane if shadows don't need to be cast as
|
||||
// far as main projection far plane
|
||||
if( 0 < *_maxFarPlanePtr )
|
||||
clampProjection( _clampedProjection, 0.f, *_maxFarPlanePtr );
|
||||
|
||||
Reference in New Issue
Block a user