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 

Display one scene, pick from another one


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Fri Sep 08, 2017 11:50 am    Post subject:
Display one scene, pick from another one
Reply with quote

Hi all,

I handle a scene which is very dense (~4M triangles) and displayed with triangles only (no line, nor points). I would like to select the vertices of this scene though (not the displayed triangles).

I thought of reusing the same osg::Geometry twice in the graph and with different states (PolygonMode::FILL and PolygonMode::POINT to name them).

1) This does not seem to work, as I seem to still have triangles returned by the pick, not points
2) I need to swap osg::Geometry, just for the pick and I have not managed to find a way through

Any idea?

Thanks a lot for reading (and if you can help, it is even better Wink).

Antoine.
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 789

PostPosted: Fri Sep 08, 2017 11:59 am    Post subject:
Display one scene, pick from another one
Reply with quote

Hi Antoine,

Quote:

I handle a scene which is very dense (~4M triangles) and displayed with triangles only (no line, nor points). I would like to select the vertices of this scene though (not the displayed triangles).

I thought of reusing the same osg::Geometry twice in the graph and with different states (PolygonMode::FILL and PolygonMode::POINT to name them).

1) This does not seem to work, as I seem to still have triangles returned by the pick, not points
2) I need to swap osg::Geometry, just for the pick and I have not managed to find a way through

From what you describe you don't need two scenes. The pick-reply will
give you all information on the picked face (which vertex-indices, the
intersection point) from which you can determine the vertex near to the
picking point. (Picking vertices is almost impossible with a
line-intersector anyways)

If you absolutely need two scene representations, you might consider
using the TraversalMask and NodeMask, where you give the two scenes
different NodeMasks at their roots and set the camera's and
intersection-visitors traversal mask respectively.

HtH
Sebastian






Quote:

Any idea?

Thanks a lot for reading (and if you can help, it is even better Wink).

Antoine.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71659#71659









------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Thu Sep 14, 2017 5:21 pm    Post subject:
Reply with quote

Hello Sebatian,

I was finally able to test your suggestion and it does work fine except that it does return the primitives, not the vertices composing the primitives (triangles for me).

Of course you can retrieve the vertices from the primitives (which I am currently doing), but selecting primitives and selecting vertices is not exactely the same.

What I understand is that if I want to draw triangles but select exact vertices then I need to handle 2 different geometries, one with triangles for drawing and one with points for selection (and using your suggested technique with masks). Is that right?

PS: at the time being I can live with the primitives / vertices approximation, but I want to get to the bottom of it eventually.

Kind regards,

Antoine.
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Fri Sep 15, 2017 1:37 pm    Post subject:
Reply with quote

Sebastian,

Thanks for your answer.

I believe my problem is that Intersection::indexList is only found in the LineSegmentIntersector::Intersection, not the PolytopeIntersector::Intersection. Well at least that's what I can see from the code.

Or am I wrong?

Thanks,

Antoine.
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Fri Sep 15, 2017 3:03 pm    Post subject:
Reply with quote

Sebastian,

After reading the OSG cookbook I understand what you mean: LineSegmentIntersector::Intersection is well equipped for selecting a single point on the model (p114 of the cookbook) but what I want to do is area selection of the model vertices.

In this context don't I need 2 models (a triangles model for display and a points model for picking)? What do you think now that this area selection thing is clarified?

Regards,

Antoine.
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Fri Sep 15, 2017 3:05 pm    Post subject:
Reply with quote

Sebastian,

After reading the OSG cookbook I understand what you mean: LineSegmentIntersector::Intersection is well equipped for selecting a single point on the model (p114 of the cookbook) but what I want to do is area selection of the model vertices.

In this context don't I need 2 models (a triangles model for display and a points model for picking)? What do you think now that this area selection thing is clarified?

Regards,

Antoine.
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 789

PostPosted: Sun Sep 17, 2017 9:48 pm    Post subject:
Display one scene, pick from another one
Reply with quote

Hi Antoine,
Quote:
Hello Sebatian,

I was finally able to test your suggestion and it does work fine except that it does return the primitives, not the vertices composing the primitives (triangles for me).

Of course you can retrieve the vertices from the primitives (which I am currently doing), but selecting primitives and selecting vertices is not exactely the same.
Simply use the Intersection::indexList. It contains the vertex
indices.The intersection has really all you'll ever need to select the
contributing vertices. See the osg-CookBook for a reference example.
Quote:

What I understand is that if I want to draw triangles but select exact vertices then I need to handle 2 different geometries, one with triangles for drawing and one with points for selection (and using your suggested technique with masks). Is that right?

No, you can use one graph and use a Polytope-intersector since
point-line collisions are rare to practically impossible. I simply
wanted to show an alternative, when using different pick/render-geometries.

Cheers
Sebastian

Quote:

PS: at the time being I can live with the primitives / vertices approximation, but I want to get to the bottom of it eventually.

Kind regards,

Antoine.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71724#71724









------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Tue Sep 19, 2017 12:24 pm    Post subject:
Reply with quote

Hello Sebastian,

I am afraid there is no such thing as PolytopeIntersector::Intersection::indexList you can only find indexList within LineSegmentIntersector::indexList. At least in the 3.4.1 version of the code I am currently checking...

I can live without for the time being, but that leaves the area selection of vertices open.

Kind regards,

Antoine.
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Tue Sep 19, 2017 12:24 pm    Post subject:
Reply with quote

Hello Sebastian,

I am afraid there is no such thing as PolytopeIntersector::Intersection::indexList you can only find indexList within LineSegmentIntersector::Intersection::indexList. At least in the 3.4.1 version of the code I am currently checking...

I can live without for the time being, but that leaves the area selection of vertices open.

Kind regards,

Antoine.
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 scene snapshot Trajce Nikolov NICK General 3 Wed Aug 30, 2017 6:39 am View latest post
No new posts multiple window pick incorrect robertosfield General 1 Fri Aug 11, 2017 6:45 am View latest post
No new posts MFC mdi child windows show the scene ... rposg General 1 Fri May 26, 2017 6:37 pm View latest post
No new posts scene object not receiving/casting sh... Meldryt General 0 Thu May 11, 2017 8:01 am View latest post
No new posts Crash on Windows 10 with a Display Li... efson General 2 Thu Apr 27, 2017 9:03 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