OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Bug in Cull Visitor


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Gedalia Pasternak
Guest





PostPosted: Sat May 12, 2018 8:34 pm    Post subject:
Bug in Cull Visitor
Reply with quote

Both CullVisitor and it's base class NodeVisitor have members named _traversalNumber. Yielding duplicate member variables with the same name, and inconsistent behavior depending on how you access the class.
Cull visitor's should be renamed, maybe to _cullTraversalNumber or something that wouldn't conflict with the base class. An accessor would be nice as well. In the case of NodeVisitor it's what frame it's up to, for cull visitor it's what accepted object it's up to ( 

   // Otherwise need to create new renderleaf.
    RenderLeaf* renderleaf = new RenderLeaf(drawable,projection,matrix,depth,_traversalNumber++);
)


-Gedalia

------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11758

PostPosted: Sun May 13, 2018 10:56 am    Post subject:
Bug in Cull Visitor
Reply with quote

Hi Gedalia,

Well spotted, this issue has been in the code for almost two decades
without anyone noticing. I've removed the duplicate from CullVisitor
and checked this into OSG master and the 3.6 branch.

Robert.

On 12 May 2018 at 21:34, Gedalia Pasternak <> wrote:
Quote:
Both CullVisitor and it's base class NodeVisitor have members named
_traversalNumber. Yielding duplicate member variables with the same name,
and inconsistent behavior depending on how you access the class.
Cull visitor's should be renamed, maybe to _cullTraversalNumber or something
that wouldn't conflict with the base class. An accessor would be nice as
well. In the case of NodeVisitor it's what frame it's up to, for cull
visitor it's what accepted object it's up to (
// Otherwise need to create new renderleaf.
RenderLeaf* renderleaf = new
RenderLeaf(drawable,projection,matrix,depth,_traversalNumber++);
)

-Gedalia





------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Gedalia Pasternak
Guest





PostPosted: Sun May 13, 2018 2:28 pm    Post subject:
Bug in Cull Visitor
Reply with quote

Thanks Robert, 
   But won’t just simply removing it mean that adding a render leaf will be changing what the current frame is?
 For occlusion nodes I’ve realized that it’s not currently possible to use them within instanced hierarchy without tracking which traversal generated a given query, the cull visitor traversal index (along with other changes) can help disambiguate which draw query it was.
Gedalia


On Sun, May 13, 2018 at 6:55 AM Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Gedalia,

Well spotted, this issue has been in the code for almost two decades
without anyone noticing.  I've removed the duplicate from CullVisitor
and checked this into OSG master and the 3.6 branch.

Robert.

On 12 May 2018 at 21:34, Gedalia Pasternak < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Both CullVisitor and it's base class NodeVisitor have members named
_traversalNumber. Yielding duplicate member variables with the same name,
and inconsistent behavior depending on how you access the class.
Cull visitor's should be renamed, maybe to _cullTraversalNumber or something
that wouldn't conflict with the base class. An accessor would be nice as
well. In the case of NodeVisitor it's what frame it's up to, for cull
visitor it's what accepted object it's up to (
    // Otherwise need to create new renderleaf.
     RenderLeaf* renderleaf = new
RenderLeaf(drawable,projection,matrix,depth,_traversalNumber++);
)

-Gedalia

_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
DI-Guy Engineering Lead, VT MÄK
150 Cambridge Park Drive, 3rd Floor, Cambridge, MA 02140

------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11758

PostPosted: Sun May 13, 2018 2:58 pm    Post subject:
Bug in Cull Visitor
Reply with quote

Hi Gedalia,

On 13 May 2018 at 15:27, Gedalia Pasternak <> wrote:
Quote:
But won’t just simply removing it mean that adding a render leaf will be
changing what the current frame is?

TraversalNumber is local value to a visitor it isn't a the frame
number, this is retrieved with the osg::FrameStamp::getFrameStamp().

Quote:
For occlusion nodes I’ve realized that it’s not currently possible to use
them within instanced hierarchy without tracking which traversal generated a
given query, the cull visitor traversal index (along with other changes) can
help disambiguate which draw query it was.

The FrameStamp is probably what you should be using, it's attached the
CullVisitor and the osg::State as well as the viewer.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Gedalia Pasternak
Guest





PostPosted: Sun May 13, 2018 4:02 pm    Post subject:
Bug in Cull Visitor
Reply with quote

Does that mean it’s used incorrectly in OcclusionQueryNode::getPassed()? That was what I was basing my understanding on.
Gedalia




On Sun, May 13, 2018 at 10:57 AM Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Gedalia,

On 13 May 2018 at 15:27, Gedalia Pasternak < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
    But won’t just simply removing it mean that adding a render leaf will be
changing what the current frame is?

TraversalNumber is local value to a visitor it isn't a the frame
number, this is retrieved with the osg::FrameStamp::getFrameStamp().

Quote:
  For occlusion nodes I’ve realized that it’s not currently possible to use
them within instanced hierarchy without tracking which traversal generated a
given query, the cull visitor traversal index (along with other changes) can
help disambiguate which draw query it was.

The FrameStamp is probably what you should be using, it's attached the
CullVisitor and the osg::State as well as the viewer.

Robert.
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
DI-Guy Engineering Lead, VT MÄK
150 Cambridge Park Drive, 3rd Floor, Cambridge, MA 02140

------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11758

PostPosted: Sun May 13, 2018 5:49 pm    Post subject:
Bug in Cull Visitor
Reply with quote

Hi Gedalia,

On 13 May 2018 at 17:01, Gedalia Pasternak <> wrote:
Quote:
Does that mean it’s used incorrectly in
OcclusionQueryNode::getPassed()? That was what I was basing my understanding
on.

I'm not the author of OcclisionQueyNode so I have to look it up,
jikes, yep it shouldn't be using TraversalNumber, it should be using
nv->getFrameStamp()->getFrameNumber().

I we amend the code and get it checked in, but it'll have to wait a
little longer as it's dinner time!! :-)

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11758

PostPosted: Mon May 14, 2018 8:06 am    Post subject:
Bug in Cull Visitor
Reply with quote

On 13 May 2018 at 18:48, Robert Osfield <> wrote:
Quote:
On 13 May 2018 at 17:01, Gedalia Pasternak <> wrote:
Quote:
Does that mean it’s used incorrectly in
OcclusionQueryNode::getPassed()? That was what I was basing my understanding
on.

I'm not the author of OcclisionQueyNode so I have to look it up,
jikes, yep it shouldn't be using TraversalNumber, it should be using
nv->getFrameStamp()->getFrameNumber().

I we amend the code and get it checked in, but it'll have to wait a
little longer as it's dinner time!! Smile

I have done another review the CullVisitor and OcclusionQueryNode and
the use of FrameNumber, The OSG's rendering backend does
automatically assign the FrameStampe::getFrameNumber() to the
CullVisitor::setTraversalNumber() so it "should" be safe for it to use
the NodeVisitor::getTraveralNumber() in place of
getFrameStamp()->getFrameNumber().

However, looking that the code in CullVisitor that increments the
_traversalNumber value, this is mis-using that value for a traversal
order number which isn't the same thing as traversal number. I've
amended the CullVisitor and RenderLeaf/RenderBin so that they now use
_traversalOrderNumber. This is checked into 3.6 branch and master.

I also checked in a small tweak to the precision of the some of the
local variables in OcclusionQueryNode.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Scaling visitor not working as expected wernerM General 2 Tue Jan 09, 2018 2:01 pm View latest post
No new posts Using visitor to transfer material co... wernerM General 1 Mon Jan 08, 2018 4:14 pm View latest post
No new posts Do not cull inactive culling drawables Mathieu Submission 0 Fri Dec 01, 2017 3:50 pm View latest post
No new posts How to access the view parameters fro... Miguel General 1 Fri Sep 22, 2017 5:31 pm View latest post
No new posts How safe is it to modify an node duri... makulis General 2 Tue Oct 11, 2016 8:46 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP