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 

Fast move a lot of nodes to another group

Goto page 1, 2  Next
 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
YuraIU02
User


Joined: 31 Mar 2017
Posts: 20

PostPosted: Fri Mar 31, 2017 8:05 am    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Hi,
I need to move a lot of nodes from Group to MatrixTransform to translate them into new position by user input, and then move them back into Group with new position. Call addChild and removeChild for each node is slow because of removeChild. Also I cant use removeChildren to remove all nodes at once because my node list is not continuous.



Thank you!

Cheers,
Yura
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 799

PostPosted: Tue Apr 04, 2017 8:11 am    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Hi Yura,
Quote:
Hi,
I need to move a lot of nodes from Group to MatrixTransform to translate them into new position by user input, and then move them back into Group with new position. Call addChild and removeChild for each node is slow because of removeChild. Also I cant use removeChildren to remove all nodes at once because my node list is not continuous.
You could use the replaceChild like this: (assuming node is the Node to
move and group its current parent)

transform = new MatrixTransform
transform->addChild(node);
group->replaceChild(node, transform);

This way the child list (implemented as a vector) is not changed in size
for every operation.

Cheers
Sebastian
Quote:




Thank you!

Cheers,
Yura

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









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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Tue Apr 04, 2017 8:45 am    Post subject:
Reply with quote

Hi,

How can I move to "transform" next node of "group" without calling group->removeChild? I need only one "transform" after all.

Thank you!

Cheers,
Yura
Back to top
View user's profile Send private message
wernerM
User


Joined: 06 Feb 2013
Posts: 66

PostPosted: Tue Apr 04, 2017 9:33 am    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Hi Yura,

just make the transform node a permanent member of your scene and
let it be identity or your specific transform as needed.

- Werner -

Am 31.03.2017 um 10:05 schrieb Yura Ivanov:

Quote:
Quote:
Hi,
I need to move a lot of nodes from Group to MatrixTransform to translate them into new position by user input, and then move them back into Group with new position. Call addChild and removeChild for each node is slow because of removeChild. Also I cant use removeChildren to remove all nodes at once because my node list is not continuous.



Thank you!

Cheers,
Yura

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





_______________________________________________
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

--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)

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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Tue Apr 04, 2017 10:33 am    Post subject:
Reply with quote

I already have such transform to move all nodes in a group. But I need to move nodes selected by user.
Back to top
View user's profile Send private message
wernerM
User


Joined: 06 Feb 2013
Posts: 66

PostPosted: Tue Apr 04, 2017 10:37 am    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Ah OK,

so why not adding them as children into 2 switch nodes and just switching them an and off as needed.
It should not really be an overhead since the pointers are shared and disabled nodes are ignored.

- Werner -

Am 04.04.2017 um 12:33 schrieb Yura Ivanov:

Quote:
Quote:
I already have such transform to move all nodes in a group. But I need to move nodes selected by user.

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





_______________________________________________
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

--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)

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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Tue Apr 04, 2017 12:05 pm    Post subject:
Reply with quote

Hi,

So i a have 300k nodes, I should add 300k switch into a group and 300k into transform. I will try and see how fast it will be.

Thank you!

Cheers,
Yura
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11278

PostPosted: Tue Apr 04, 2017 12:17 pm    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Hi Yura,

On 4 April 2017 at 13:05, Yura Ivanov <> wrote:
Quote:
So i a have 300k nodes, I should add 300k switch into a group and 300k into transform. I will try and see how fast it will be.

With this number of nodes one has to wonder if using nodes is the
appropriate approach at all, perhaps there is a better way to manage
your scene graph. Could you take a step back and tell us what you are
trying to do with this part of your scene graph? For instance what do
the subgraphs below group/transform represent?

Robert.


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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Tue Apr 04, 2017 12:52 pm    Post subject:
Reply with quote

I have 300k nodes, and i must have ability to see them all at once and select any part of them to drag by mouse. I looks like big puzzle.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11278

PostPosted: Tue Apr 04, 2017 1:28 pm    Post subject:
Fast move a lot of nodes to another group
Reply with quote

On 4 April 2017 at 13:52, Yura Ivanov <> wrote:
Quote:
I have 300k nodes, and i must have ability to see them all at once and select any part of them to drag by mouse. I looks like big puzzle.

What are the subgraphs composed of? Repeating geometries? Unique
geometries? What about state? Do they share textures etc?

A screenshot would help get an idea.

The reason why I'm asking all these questions is that knowing what you
are trying to achieve will narrow down what type of techniques are
best to address the problems you are trying to tackle.

Robert.


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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Tue Apr 04, 2017 1:53 pm    Post subject:
Reply with quote

Nodes are unique quads with editable geometry. I had no problem with performance exept removeChild when i tried to move them into transform matrix.
I would be nice if osg will have function to move node to another group whithout internal std remove and erease.
P.S. Sorry if my english is bad.
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 799

PostPosted: Tue Apr 04, 2017 1:59 pm    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Am 4/4/2017 um 3:53 PM schrieb Yura Ivanov:
Quote:
Nodes are unique quads with editable geometry. I had no problem with performance exept removeChild when i tried to move them into transform matrix.
If you're actually holding all the childs in a single group, the remove
will become horribly expensive (due to removal somewhere in the vector).
Try to restructure your group to have a tree-like substructure
(basically a quad-tree) to have smaller sets to work with.

Quote:
I would be nice if osg will have function to move node to another group whithout internal std remove and erease.
P.S. Sorry if my english is bad.

Cheers
Sebastian
Quote:

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









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


Joined: 18 Mar 2009
Posts: 11278

PostPosted: Tue Apr 04, 2017 2:25 pm    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Hi Yura,

On 4 April 2017 at 14:53, Yura Ivanov <> wrote:
Quote:
Nodes are unique quads with editable geometry. I had no problem with performance exept removeChild when i tried to move them into transform matrix.
I would be nice if osg will have function to move node to another group whithout internal std remove and erease.
P.S. Sorry if my english is bad.

The OSG isn't design for large scale changes in the scene graph
structure at runtime, what you are attempting to do is pretty non
standard in terms of usage. If you really really want to do something
that the OSG core doesn't specifically optimize then you can always
subclass from osg::Group and do what you want.

However, the basic scene graph structure sounds horribly inefficient,
which is why I'm flagging up that you are likely to tackling the
problem in the wrong way. My guess is tackling the problem in a
different way will provide *massively* better performance all round.
When I say massive I'm tackling 100's of times improvement of
performance may well be achievable. Having hundreds of thousands of
OSG nodes to draw simple geometry is always going to bad way to do
things.

When you say the geometry is editable, what exactly do you mean?
Again a screenshot would be useful.

Robert.


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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Tue Apr 04, 2017 3:03 pm    Post subject:
Reply with quote

I tried to subclass osg::group to implement my own removeChildren, but i cant call some osg::node functions because my class was not friend of osg::node. Implementing move of node is more difficult.
Noded unique because User can move vertex of each node.
Maybe I should made one node and work with geometry but 300k is maximum and performance is fine.
I cant make screenshot now because I am not near computer. The goal of program is build one image from it parts.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11278

PostPosted: Tue Apr 04, 2017 3:53 pm    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Hi Yura,

On 4 April 2017 at 16:03, Yura Ivanov <> wrote:
Quote:
I tried to subclass osg::group to implement my own removeChildren, but i cant call some osg::node functions because my class was not friend of osg::node. Implementing move of node is more difficult.
Noded unique because User can move vertex of each node.
Maybe I should made one node and work with geometry but 300k is maximum and performance is fine.

If it was completely fine you wouldn't have started this thread :-)

You haven't provided enough information to suggest specific approach
but from what you have written so far I don't think your current
approach is the best way to tackle the problem, and would recommend
changing the approach rather than trying to workaround the performance
issues you've seen.

Once you've provided a clear enough picture of what you are trying to
achieve it should be straight forward to recommend a good way forward.

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
Goto page 1, 2  Next
Page 1 of 2

 
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 Custom data within nodes or drawables arennuit General 2 Thu Aug 24, 2017 9:52 am View latest post
No new posts osg::Group Child Problem Latha Rani General 4 Tue Jun 13, 2017 1:16 pm View latest post
No new posts Render Geographic/Projected coordinat... Bruno Oliveira General 0 Mon Jun 05, 2017 2:58 pm View latest post
No new posts Removing stateset for all assoc nodes... YuraIU02 General 1 Wed Apr 12, 2017 12:10 pm View latest post
No new posts ref null pointer in Group::traverse Meldryt General 1 Thu Mar 16, 2017 3:06 pm 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