Hi Ben,

I've just done a quick review and the code looks correct to me.

> Now ShadowMap comes along, and the above code computes (0x4 & 0x2) == 0.  A 
> visitor mask of 0 finds nothing.  That's not right.

No it's perfectly correct, this is how traversal masks are meant to be
used.  However, if bits being used by the viewer are the same as the
ones used by effects like osgShadow then their will be conflict, the
only way to solve this is set the appropriate bits.  I can see use
traversal masks in the osgstereoimage example conflicting with
osgShadow.

In your example where the viewers traversal mask is 0x4, this would be
a very extreme setting - only accepting one bit for traversal is
extremely picky.

Robert.



On Tue, May 20, 2008 at 8:30 PM, Ben Discoe <[EMAIL PROTECTED]> wrote:
> I found what appears to be another bug/limitation in ShadowMap.cpp.  When 
> traversing the nodes which cast shadows, it uses this code:
>
> cv.setTraversalMask( traversalMask &
>   getShadowedScene()->getCastsShadowTraversalMask() );
>
> 'traversalMask' here is the sceneview's draw mask, which defaults to 
> 0xffffffff, but can be set to other values depending on the application's 
> needs.
>
> Consider the case:
> ReceivesShadow = 0x1
> CastsShadow = 0x2
> Scene's DrawMask = 0x4
>
> For a node which is drawn and fully shadowed, such as the default mask, these 
> are all set, so its node mask includes the bits 0x7.
>
> Now ShadowMap comes along, and the above code computes (0x4 & 0x2) == 0.  A 
> visitor mask of 0 finds nothing.  That's not right.
>
> I can only imagine the ShadowMap author meant, they wanted to traverse nodes 
> with _both_ bits set, both visible and casting.  But, AFAIK, NodeVisitor 
> doesn't do AND, it only does OR.  That is, a traversal will always proceed 
> when _any_ bit matches, not when _all_ bits match.  So the above is a bug 
> from misunderstanding how NodeVisitor works.
>
> To replace the code with this, would at least fix the general case:
>
> cv.setTraversalMask( getShadowedScene()->getCastsShadowTraversalMask() );
>
> However, that doesn't correctly omit nodes which are casting but not drawn, 
> e.g. mask=0x3 using the values above.  Perhaps it's just not possible for 
> node traversal to do the correct thing?  Or maybe, there is some more 
> powerful visitor capability in OSG that would save the day here?
>
> -Ben
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to