A colleague of mine has found a "fix" for this issue. I think that the question
now is, is it a "bug" in OSG
or us using OSG improperly (in that case should / could it be prevented).
The fix is as follow (modify EffectDecorator.h in provided code):
class CameraCullCallback : public osg::NodeCallback
{
public:
CameraCullCallback(osg::Group* fx) : m_fx(fx)
{ }
virtual void operator()(osg::Node*, osg::NodeVisitor* nv)
{
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if(cv && (cv->getCurrentRenderStage() != cv->getRenderStage()))
{
cv->getCurrentRenderStage()->setInheritedPositionalStateContainer(cv->getRenderStage()->getPositionalStateContainer());
}
m_fx->osg::Group::traverse(*nv);
}
private:
osg::observer_ptr<osg::Group> m_fx; /// group which has the scene
under it
};
cheers,
guillaume
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Poirier,
Guillaume
Sent: September-27-11 11:13 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Lighting problem when using help or stats handler
I have attached a simple example that reproduces the problem. I am not sure if
this is a OSG problem or if we are not using it properly.
The problem occurs when more than 2 pre-render stages are cascading (as
described in previous post of thread), as the inherited
PositionalStateContainer will stop at the 2nd stage and not be pushed on the
following cascading pre-rendering stages, which happens in our scene graph (and
reproduced in the attached example).
Run the example, see the cow with green specular light. Press 'h'. The cow does
not change. Now set MULTIPLE_PRERENDER_STAGES = true in prerenderbin.cpp line
26. Repeat the above procedure. The lighting changes when the help is
displayed...
cheers,
guillaume
PK
=?
prerenderbin/PK e|:?7 % ) prerenderbin/CMakeLists.txtTMoÚ0¾#ñ,Æ!½PmvëÁI
ÍâÈvPw²Râ¶ÖHÂ
vCü÷½v@ÚÄ<~÷ÛýN<á¬+U©"SÕ.ná`§?Ìu¡óM.+õk£+9Âx@#ôeòmòÕçØcÔÍa=ÀËeK#_úî
µ 4¥`ïÞYé'4Þí
ÏU3ÎxÛâ;T®ë?*C£ñä»ÊÔÓæåðw¼õæøH¸ÉLÆið¸Yë$òOÀô³"*y
¸ààD-å3É(OI®ê:}QbCI£2¨á²)«ßè ¸ëËQVªeÔ»®k
Ú>oÀèpP«Æ±Z?`¨/5Ôi ñÆXÜ·¤ òÂÄ'ÌQY¿Ü.TUë²@ÂÏô·ºX®6:'ä
â$Ö
8ü]ú2ÝØy4kS9°÷UþqÉÎôÇ~ØÌÏwÍ{Í¿¦YùfVB½7æ4ze¾ÞTeVqZ5z¹R®U!^+fµe«M®Ìjz½Y¥ÐáàÄ·I6óAöÃÒ$òÑç#p"Gp4<0\JC4JjeèV;,0yQ·;8ç ÞKeWÃNÙÿ£45
§Uv
Èl°çÊa!n÷ObZs2Ã- ÎN±9h}Ù8Ë íÃé_R3ÏîåzmAòüÍW˲2m¼^C
»s}_Gâ%»!éùÈÎ]ïnlHruÀ5&
¾°ÃÑþ¦!vIhfþ DxNv£Û£V}iÍfôÏkÍéï¤wGz׿PK ¹X;?éHbø1
á"