Hello, I'm trying to add shadows to the application I'm working on, and encountered two issues which seems to be ATI card/driver related.
The first issue is, that shadows generated using the ShadowMap technique are in the wrong location, both in the application I'm working on and the 'osgshadow' example. Only the ShadowTexture technique gives correct results. For example, in the 'aircraft above terrain' example scene with the ShadowMap technique (osgshadow --sm -2), there is a shadow on the ground below the aircraft, but it is turning in the opposite direction to the aircraft. A colleague who is using an Nvidia card is seeing correct shadows in the example. After searching the osg mailing list I found a few clues towards solving the problem, one was that ATI had inverted a coordinate of the FBO-texture in their drivers: http://archive.netbsd.se/?ml=openscenegraph-submissions&a=2008-02&m=6605417 The solution was to mirror the shadow map along the Y axis in the ShadowMap::cull() function: _texgen->setPlanesFromMatrix( osg::Matrix::scale(1.0, -1.0, 1.0) * _camera->getProjectionMatrix() * osg::Matrix::translate(1.0,1.0,1.0) * osg::Matrix::scale(0.5f,0.5f,0.5f) ); (I am using a Radeon X1800 series card with the Catalyst 8.9 drivers, and the osg2.7.3 developer release. However, the effect also occurs with the osg2.2 stable release.) Now for the second, still unsolved issue: At the moment, I am looking at using the LightSpacePerspectiveShadowMap technique in the application. However, the problem here is that when changing the viewpoint position or orientation, the shadows also move or rotate! It is very difficult to see what is going on from the position or movements of the shadows in this case. However, when I mirror the shadow map (like in the code above), the shadows seem to be correct in one special case. This is when the viewpoint is looking down along the Z axis, and the viewpoint viewx/vup axes are parallel to the world X/Y-axes. Does anyone have an idea on how this might be solved? Thanks + Best Regards, Rick. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

