Re: [osg-users] osgShadow and node masks

2012-04-23 Thread Garth D


Hi all,

A quick update on this:

I had speculated that attaching things to a separate tree that was not 
attached to a osgShadow::ShadowedScene would avoid the problem, and I 
can confirm now that this is the case. I am now effectively keeping two 
copies of the scene tree now: one that contains things that should cast 
or receive shadows; and one that contains things that should do neither. 
I don't expect much of a performance hit, and haven't seen one. It 
sounds messy, but in practice it isn't too bad. I have actors that 
manage their own nodes/drawables, and these are the only entities that 
need the shadow-less text, so I just create two sets of transforms and 
maintain two trees for each actor, rather than one.


This solves the problem as such.

One school of thought is that the solution that quickly solves the 
problem at hand is the correct solution, but I'm not entirely convinced. ;)


I am curious as to what the "correct" solution should be. Perhaps it is 
to logically separate entities into a scene with shadows and a scene 
without, as I have mentioned above. Or perhaps my initial approach was 
right, and everything that appears together *should* logically be 
created together under a ShadowedScene, with some objects casting, some 
receiving, and some abstaining. In the latter case, the questions from 
my last email remain- essentially, is my understanding of node masks 
correct, is the vanishing text expected behaviour given my choice of 
masks, and am I approaching things in the right way?


I would love to hear the thoughts of anyone who has touched on this 
area, and can correct or confirm my understanding on the issue. With 
this input, I will have a better placed to track down the actual problem 
in my case. Opinions on the best approach definitely welcomed.


Any input appreciated. :)

Cheers,
Garth

On 21/04/12 16:50, Garth D wrote:
>
> Hi all,
>
> I was wondering if someone could help me out with respect to correcting
> my understanding of shadows and node masks. I am using OpenSceneGraph
> 3.0.1.
>
> I have created a scene, including a osgShadow::ShadowedScene. I have set
> the node mask for receiving shadows (via setReceivesShadowTraversalMask)
> to 1, and the mask to cast shadows (via setCastsShadowTraversalMask) to
> 2. I am using ShadowTexture- I have not been able to get the other
> techniques to work properly.
>
> I have some text (osgText::Text) that I wish to attach to an animated
> model, screen-facing. I neither want to cast nor receive shadows from
> this text. The text is attached to a osg::Geode, which is attached to a
> osg::MatrixTransform, which the model is also attached to, indirectly.
> Up the tree a little bit, the osgShadow::ShadowedScene can be found.
>
> If I leave the Geode as-is, it takes the default all-bits-set node mask,
> and casts a shadow. If I set it to 2, it casts a shadow. If I set it to
> 1, it doesn't cast one, but receives shadows from objects in the scene.
>
> If I then set the Geode node mask to 0, or 4, both of which should
> indicate no shadow casting or receiving (as bits zero and one are not
> set), the text vanishes entirely.
>
> Now, obviously it shouldn't do that.
>
> I saw similar symptoms when playing with osgEphemeris, but didn't dig
> into it further when I shifted away from using it.
>
> If believe that if I reparent the scene so that it lies outside of the
> ShadowedScene, it appears correctly. This is because I have a scene
> fadeout using RTT, and I reparent the scene so that it does not touch a
> ShadowedScene in this case, and the text appears again during the
> transition.
>
> I am wondering if my understanding of node masks and how they interact
> with osgShadow is correct. If not, if someone could indicate where and
> how I am using them incorrectly, it would be appreciated.
>
> I was also wondering with respect to modern-day usage, which parts of
> osgShadow would be considered most reliable and mature.
>
> Cheers,
> Garth
> ___
> 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


[osg-users] osgShadow and node masks

2012-04-21 Thread Garth D


Hi all,

I was wondering if someone could help me out with respect to correcting 
my understanding of shadows and node masks. I am using OpenSceneGraph 3.0.1.


I have created a scene, including a osgShadow::ShadowedScene. I have set 
the node mask for receiving shadows (via setReceivesShadowTraversalMask) 
to 1, and the mask to cast shadows (via setCastsShadowTraversalMask) to 
2. I am using ShadowTexture- I have not been able to get the other 
techniques to work properly.


I have some text (osgText::Text) that I wish to attach to an animated 
model, screen-facing. I neither want to cast nor receive shadows from 
this text. The text is attached to a osg::Geode, which is attached to a 
osg::MatrixTransform, which the model is also attached to, indirectly. 
Up the tree a little bit, the osgShadow::ShadowedScene can be found.


If I leave the Geode as-is, it takes the default all-bits-set node mask, 
and casts a shadow. If I set it to 2, it casts a shadow. If I set it to 
1, it doesn't cast one, but receives shadows from objects in the scene.


If I then set the Geode node mask to 0, or 4, both of which should 
indicate no shadow casting or receiving (as bits zero and one are not 
set), the text vanishes entirely.


Now, obviously it shouldn't do that.

I saw similar symptoms when playing with osgEphemeris, but didn't dig 
into it further when I shifted away from using it.


If believe that if I reparent the scene so that it lies outside of the 
ShadowedScene, it appears correctly. This is because I have a scene 
fadeout using RTT, and I reparent the scene so that it does not touch a 
ShadowedScene in this case, and the text appears again during the 
transition.


I am wondering if my understanding of node masks and how they interact 
with osgShadow is correct. If not, if someone could indicate where and 
how I am using them incorrectly, it would be appreciated.


I was also wondering with respect to modern-day usage, which parts of 
osgShadow would be considered most reliable and mature.


Cheers,
Garth
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org