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 Previous  1, 2
 
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: Tue Apr 04, 2017 4:18 pm    Post subject:
Reply with quote

I will try to give more information tomorrow. Thank you for your advices.
Back to top
View user's profile Send private message
YuraIU02
User


Joined: 31 Mar 2017
Posts: 20

PostPosted: Thu Apr 06, 2017 5:16 am    Post subject:
Reply with quote

When I put my nodes into subgroups, removeChild becoming fast and cull is faster. Thank you.
Is there any functions to make tree like structure of my group, or i must do it by hand?
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 10908

PostPosted: Thu Apr 06, 2017 8:12 am    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Hi Yura,

On 6 April 2017 at 06:16, Yura Ivanov <> wrote:
Quote:
When I put my nodes into subgroups, removeChild becoming fast and cull is faster. Thank you.
Is there any functions to make tree like structure of my group, or i must do it by hand?

For optimal performance a balanced quad tree is typically best for
scene graph applications, while groups containing a large number of
children breaks this efficiency forcing the traversals to visit all
children all the time.

The osgUtil::Optimizer::SpatializeGroupsVisitor can be used to
reorganize large flat groups of children into a quad tree. You can
call this visitor on it's own or as part of the wider
Optimizer::optimizer(Node*,int options) operation if you include the
osgUtil::OptimizeSPATIALIZE_GROUPS bit mask to the options parameter.
The class can be found in include/osgUtil/Optimizer.

Robert.


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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Fri Apr 07, 2017 8:09 am    Post subject:
Reply with quote

Hi,

How can I add children into already optimized group? Do I need to remove all groups created by optimizer, add child and then call optimize again?

Thank you!

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


Joined: 18 Mar 2009
Posts: 10908

PostPosted: Fri Apr 07, 2017 8:47 am    Post subject:
Fast move a lot of nodes to another group
Reply with quote

HI Yura,

On 7 April 2017 at 09:09, Yura Ivanov <> wrote:
Quote:
How can I add children into already optimized group.

An optimized group is no different to an non optimized group you can
add or remove children as you like. If the structure changes too much
then it may no longer be efficient.

Quote:
I need to remove all groups created by optimizer, add child and then call optimize again?

Why do you need to remove all the groups?

--

As a general note, I'll call back to my original suggestions, the way
you are tackling the tasks sounds inefficient, running tools like the
Optimizer can help hide this but in the end you're still using the
wrong tool for the job. You've never gone into the details of the
subgraphs to be able to give specific advice.

Robert.


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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Fri Apr 07, 2017 9:09 am    Post subject:
Reply with quote

Hi,

I just want to add new childs in a group and want group to be optimized. So if many elements changed, I need to remove all groups that created by optimizer, before call optimize again?

Thank you!

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


Joined: 18 Mar 2009
Posts: 10908

PostPosted: Fri Apr 07, 2017 10:05 am    Post subject:
Fast move a lot of nodes to another group
Reply with quote

On 7 April 2017 at 10:09, Yura Ivanov <> wrote:
Quote:
I just want to add new childs in a group and want group to be optimized. So if many elements changed, I need to remove all groups that created by optimizer, before call optimize again?

I can't work out what you mean.

The only thing I know is that you are almost certainly going the wrong
direction by trying to add and remove large numbers of objects from
the scene graph. It's a broken approach. I have suggested that you
provide the details so we can help you take a better approach.

It seems pretty pointless me trying to help you if you aren't open to
taking a step back and fixing the problem.

Others can pitch in, but for now I'm taking a step back.

Robert.


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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Fri Apr 07, 2017 11:22 am    Post subject:
Reply with quote

I am agree with you, that maybe I have bad structure. My program is just editor, where i must be able to see all 300k tiles of image at once, select, move and distort them. My current question was about optimizer. I will put it in another topic, if i will not success.
Thank you very much for your advices, they are very helpful for me.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 10908

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

On 7 April 2017 at 12:22, Yura Ivanov <> wrote:
Quote:
I am agree with you, that maybe I have bad structure. My program is just editor, where i must be able to see all 300k tiles of image at once, select, move and distort them.

Are the tiles just quads? Are the images all the same, or different
for each tile? Screenshot would be useful.


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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Mon Apr 10, 2017 8:25 am    Post subject:
Reply with quote

Hi,

Quads are unique and images are different.
Sorry but I cant make screenshot of real images because of author. It is just like big puzzle. This is editor, and user decides how many objects can be.
I am using PagedLods to draw images and have no problem with memory. I have problem with moving a lot of nodes by user input. If I put put them into matrix i can move only it. This is fast but i need to move nodes to another group. Maybe I can use NodeCallback?


Thank you!

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


Joined: 10 Sep 2013
Posts: 726

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

Hi Yura,
Quote:
Hi,

Quads are unique and images are different.
Sorry but I cant make screenshot of real images because of author. It is just like big puzzle. This is editor, and user decides how many objects can be.
I am using PagedLods to draw images and have no problem with memory. I have problem with moving a lot of nodes by user input. If I put put them into matrix i can move only it. This is fast but i need to move nodes to another group. Maybe I can use NodeCallback?

I think you need to think outside of the box here. There is more than
one way to draw a collection of quads. You could render them as a big
vertex array or even instanced and modify the sub-region of your vertex
buffer/instance matrices instead of moving individual nodes around. If
you need individual texturing, that still could be done via texture
arrays or atlas-texturing.

If you absolutely want to keep them in your tree-structure you can still
keep duplicates and simply turn them off by setting an appropriate
node-mask (copy them to the new transform and disable drawing in the
original group),
As a second step you could periodically sort the child vectors by the
nodemask and batch-remove non-drawn childs from it (this is faster,
since sorting doesn't need to resize the vector and removing a
contiguous number of elements from the end of a vector is essentially free).

You could also apply the sort-prune algorithm in a custom osg::Group
which will mark elements to be deleted instead of directly removing
them. In the update phase it then could efficiently batch-sort and remove.

Anyways, this all theory as it still unclear what you want to achieve
with your puzzle. We need more details or a small example to look at. If
you cannot present the work, try to create a minimal example to
demonstrate the problem (as a compilable example, so lazy people like me
will take an actual look at it)

Cheers
Sebastian



Quote:


Thank you!

Cheers,
Yura

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









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


Joined: 31 Mar 2017
Posts: 20

PostPosted: Sat Apr 15, 2017 4:24 pm    Post subject:
Reply with quote

Hi,

I created stateset with bool uniform to indicate that node is selected and mat uniform with current mouse transform. To select nodes, I set this uniforms to nodes and all transformation preforms in shader. On mouse release, all transform applies to nodes by calling setMatrix and mat uniform sets to identity. Everything works fast and after all I don’t have extra nodes and statesets. Maybe my approach in this task is wrong, but many editors, for example 3dsMax, can work with big number of objects. And bad structure of scene in this case is user problem.
Thank you very much, especially for optimize.

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


Joined: 10 Sep 2013
Posts: 726

PostPosted: Tue Apr 18, 2017 7:39 am    Post subject:
Fast move a lot of nodes to another group
Reply with quote

Am 4/15/2017 um 6:24 PM schrieb Yura Ivanov:
Quote:
Hi,

I created stateset with bool uniform to indicate that node is selected and mat uniform with current mouse transform. To select nodes, I set this uniforms to nodes and all transformation preforms in shader. On mouse release, all transform applies to nodes by calling setMatrix and mat uniform sets to identity. Everything works fast and after all I don’t have extra nodes and statesets. Maybe my approach in this task is wrong, but many editors, for example 3dsMax, can work with big number of objects. And bad structure of scene in this case is user problem.
Thank you very much, especially for optimize.

This will disable "native" picking of the nodes however. Also I wonder
why this should be more efficient than putting every node under a
transform in the first place.
What you're doing is effectively a poor implementation of instancing. A
better approach (if you want to use the uniform approach) is to setup a
uniform buffer object (see [0]) containing the matrices and to use the
draw-instanced version of your geometry to fetch it based on its
gl_InstanceId. A version that scales better is to use a texture object
to hold the matrices (see [1])


[0]
http://3dcgtutorials.blogspot.de/2013/09/instancing-with-openscenegraph-part-ii.html

[1]
http://3dcgtutorials.blogspot.de/2013/08/instancing-with-openscenegraph.html

Cheers
Sebastian

Quote:

Cheers,
Yura

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









------------------
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 Previous  1, 2
Page 2 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 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
No new posts Slow down with shared nodes Andre Normann General 18 Tue Mar 07, 2017 8:24 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