> -----
> From: Robert Osfield
> Sent: Wednesday, May 21, 2008 10:20 PM
> 
> On Thu, May 22, 2008 at 8:22 AM, Ben Discoe <[EMAIL PROTECTED]> wrote:
> > I'm sorry, but a node mask of 0 matches no nodes, and that's definitely
> not correct; this Visitor is supposed to find nodes which are drawn and
> cast shadows.  If it finds no nodes, it's not correct.
> 
> A node mask/traversal mask of 0 absolutely doesn't match any nodes,
> that is exactly how things are designed to work.

Yes, that's how NodeVisitors are designed to work.  But in this case, it 
produces the wrong result, with how ShadowMap is using it.  Let me try to lay 
it out simply..

1. The user sets the traversal masks and shadow masks to bit patterns that do 
not overlap.  This is not only useful, and a good idea, because it keeps the 
logic separate: these bit(s) says whether to draw a node, this bit says whether 
it should cast a shadow.

2. ShadowMap does a & operation, and gets a traversal mask of zero.

3. No nodes are rendered into the Shadow.

In this case, the masks are all set appropriately, and a wrong visual results.

> If you don't want to
> cull out whole subgraphs this way then you simple set the node
> mask/traversal masks appropriately.

0xfffffffc is an appropriate traversal mask.  The only reason it doesn't work 
here is because of the bug in ShadowMap's logic.  This is a one-line fix!

If you are saying that avoiding conflict between bit values is inappropriate, 
that there should always be overlap, then what use does this statement serve:

cv.setTraversalMask( traversalMask &
  getShadowedScene()->getCastsShadowTraversalMask() );

If there is always overlap, then &= with traversalmask is a no-op.  That isn't 
logical.

> It makes it work in the way you're understanding of node
> masks/traversal masks, but not how they are intended to be used

Traversal masks are surely intended to allow the user to select which nodes are 
traversed.  There is surely not some extra intention, that traversal masks must 
also overlap with shadow masks, in order to make a no-op & operation in 
ShadowMap.cpp function.

-Ben

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to