Re: [osg-users] getting userData or accumulated Uniform in nodevisitor

27 views
Skip to first unread message

Robert Osfield

unread,
Jan 31, 2021, 1:19:34 PM1/31/21
to OpenSceneGraph Users
Hi Werner,

You'll need to override the Cull traversal behavior and get the StateSet stack from the CullVisitor.  I don't recall the details off the top of my head so you'll need to look at the osgUtil::CullVisitor and it's parent class osg::CullStack for the tracking of state.

Robert.

杨光

unread,
Feb 1, 2021, 5:38:45 AM2/1/21
to OpenSceneGraph Users
Hello, I’m sorry to ask you, I use shader on osgearth, the coloring effect is unsatisfactory, and the coloring area will change with the movement of the camera, can you give some hints on this question ?

Robert Osfield

unread,
Feb 1, 2021, 5:45:27 AM2/1/21
to OpenSceneGraph Users, OpenSceneGraph Users
On Mon, 1 Feb 2021 at 10:38, 杨光 <cupsu...@gmail.com> wrote:
Hello, I’m sorry to ask you, I use shader on osgearth, the coloring effect is unsatisfactory, and the coloring area will change with the movement of the camera, can you give some hints on this question ?

If you have an unrelated question it's inappropriate to piggyback off another thread as it makes it harder for everyone to follow.  It'd be rude to interrupt someone else's conversation in real-life, online forum/mailing list as just the same. Please start your own thread for your question.

For osgEarth related questions there is a dedicated community for it so it's likely to be the best place to ask questions about it there.

Cheers,
Robert.

杨光

unread,
Feb 1, 2021, 8:40:00 PM2/1/21
to osg-...@googlegroups.com
ok i get it,i feel sorry for that

Robert Osfield <robert....@gmail.com> 于2021年2月1日周一 下午6:45写道:
--
You received this message because you are subscribed to a topic in the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/osg-users/SlS_7SY0528/unsubscribe.
To unsubscribe from this group and all its topics, send an email to osg-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/CAFN7Y%2BXoqf_pZNJ5fLB_KWSWUqsduJgbogdvMakw_mOJ76rC%2Bw%40mail.gmail.com.

Robert Osfield

unread,
Feb 2, 2021, 8:00:28 AM2/2/21
to OpenSceneGraph Users
On Tue, 2 Feb 2021 at 10:38, Werner Modenbach <Werner.M...@modenbach-ac.de> wrote:
Hi Robert,

Replying to osg-users list so that others can chip in with insights or learn from the discussion.
 
I think I'm close to getting the solution.
Unfortunately the CullStack doesn't handle any StateSets.
I also do not really understand what a StateGraph is.
I just guess, calling CullVisitor->getCurrentStateGraph()->_stateSet gives me the accumulated StateSet.
Am I right?
Or is the accumulation of StateSets somewhere in CullVisitor->getState()? But there is no method for just querying a uniform in State.
Most of the classes have only push(), pop() or apply() methods. No query methods.

I have touched this code for years so you are probably more familiar with it now than I. 

From the top of my head the CullVisitor doesn't directly manage individual state components like Uniform, just the high level StateSet.  The results of the Cull traversal are passed on to the a osgUitl::StateGraph that remains at the StateSet levels, it's only once this StateGraph is applied during the draw traversal does the OSG's draw traversal behind to handle the individual components of state like models, attributes and modes, and this is done via osg::State.

What you are wanting to do is out of the ordinary, it's not something the OSG was specifically designed to do.  Whether your approach is really necessary or the best approach I don't know - I'm just trying to answer questions.  When you do go beyond what the OSG was originally envisaged to do you'll need to accept that you'll need to dig into code and figure stuff out, I can only help you so much.

Robert.



 
Reply all
Reply to author
Forward
0 new messages