Hi, Robert

Its a problem related to the fact that there are two virtual aimShadowCastingCamera(...) methods with different arguments :

1: First is defined by StandardShadowMap::ViewData and used for setting up first approximation of ShadowCamera projection

virtual void aimShadowCastingCamera(
   const osg::BoundingSphere &bounds,
   const osg::Light *light,
   const osg::Vec4 &worldLightPos,
   const osg::Vec3 &worldLightDir,
   const osg::Vec3 &worldLightUp = osg::Vec3(0,1,0) );

2: Second is defined by MinimalShadowMap::ViewData and overriden in deriveing classes to further refine/optimize ShadowCamera projection

virtual void aimShadowCastingCamera
 ( const osg::Light *light,
   const osg::Vec4 &worldLightPos,
   const osg::Vec3 &worldLightDir,
   const osg::Vec3 &worldLightUp
   = osg::Vec3(0,1,0) );

Current code invokes first method but in this way it also disables possible virtualiation of this method in user derived classes. I always wanted to make it overridable. Up until recently, I did not notice I made an error here. I initially wrote it in such a way because simple aimShadowCastingCamera( bounds, light, lightPos, ...) call was producing compiler errors due to the fact that I was calling method inherited from the parent class and compiler was seeing only second method. So once I realized its not overridable as intended, I had to change the code to make sure compiler resolves which variant is called but in the same time it would be possible to override both methods in user derived classes.

I hope this explains my motives. However... Upon further consideration I am glad you rejected this change ;-). I just realized it will be much more eleagant to also add this first variant in MinimalShadowMap::ViewData and simply call parent method inside. That way compiler will see both methods and will be able to resolve between them properly. And code will be much clearer. I will prepare such a change soon.

Cheers,
Wojtek Lewandowski


----- Original Message ----- From: Robert Osfield
To: OpenSceneGraph Submissions
Sent: Monday, March 01, 2010 12:52 PM
Subject: Re: [osg-submissions] Tweaks in osgShadow::StandardShadowMap andderived classes


Thanks Woktek, changes now merged and submitted to svn/trunk. The only line I didn't merge was the line where you changed:

    BaseClass::ViewData::aimShadowCastingCamera(...)

to

    static_cast<BaseClass::ViewData*>(this)->aimShadowCastingCamera(...)

I don't understand the motivation for adding the static_cast<>. Could you please explain this.

Thanks,
Robert.
-



2010/2/1 Wojciech Lewandowski <[email protected]>

Hi Robert,

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).

Cheers,
Wojtek Lewandowski






_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org







_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to