Hi
Have several questions regarding this topic.
I have about 4000 nodes in my game and each one is defined as a child of another in sequence. Randomly chosen Objects are moving sequentially and initiating same moves in all the childnodes sequentially. But I am afraid that when for example node 24 is moving the rest is not following its motion correctly. Is my System to big ? what is a limit for making this thing work properly ?
In case if I make my system instead of following move of the parentNode to do separate about 4000 moves (I am rotating them) to make it work more precisely, will it make my simulation much more slow ?
And the last question:
I want first to assign position to the SceneNodes and then declare them as a childnodes. But I did not find way how to do it properly.
First you have to declare Root node and then childnode that is dislocated with some displacement with respect to the rootsceneNode or has same position as root node.
Can somebody tell me please how can I assign first fixed position to my SceneNodes and then declare them as a childnodes to one another.
Many Many Thanks
levan
Childnodes
- spacegaier
- OGRE Team Member
- Posts: 4304
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 135
- Contact:
Re: Childnodes
What do you mean "you are afraid"? If all are in one linear hierarchy, all child nodes will move accordingly. Did you make a different observation?levan wrote:But I am afraid that when for example node 24 is moving the rest is not following its motion correctly. Is my System to big ? what is a limit for making this thing work properly ?
Why? What is your issue with first creating the new node as a child of the previous one, then settings its position relative to the parent? If you know the desired absolute position and you know which node is the parent you can figure out the relative difference.levan wrote:I want first to assign position to the SceneNodes and then declare them as a childnodes. But I did not find way how to do it properly.
First you have to declare Root node and then childnode that is dislocated with some displacement with respect to the rootsceneNode or has same position as root node.
Can somebody tell me please how can I assign first fixed position to my SceneNodes and then declare them as a childnodes to one another.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
-
- Halfling
- Posts: 41
- Joined: Sun Oct 27, 2013 11:57 pm
- x 1
Re: Childnodes
Indeed I am figuring out the difference and then assigning it but it would be much more easier just to set the positions for all the nodes (positions I have in the files) and then assign them as a children to one another. Once I have 4000 objects its time consuming to assign differences for all of them.spacegaier wrote:What do you mean "you are afraid"? If all are in one linear hierarchy, all child nodes will move accordingly. Did you make a different observation?levan wrote:But I am afraid that when for example node 24 is moving the rest is not following its motion correctly. Is my System to big ? what is a limit for making this thing work properly ?
"Well there are some math calculations between every move, and they are still run on CPU once I dont have GPU libraries yet ready, and graphics kind of cant chase actual calculations properly, it is just an excellent like it is to leaving it in a linear hierarchy of childnodes, I am not totally sure but the results that I am getting from the simulations should be a bit different. If I make separate rotational moves for all the 4000 nodes instead of just leaving it as it is that will make things work properly for sure but will it make things much more slow ?? "
Why? What is your issue with first creating the new node as a child of the previous one, then settings its position relative to the parent? If you know the desired absolute position and you know which node is the parent you can figure out the relative difference.levan wrote:I want first to assign position to the SceneNodes and then declare them as a childnodes. But I did not find way how to do it properly.
First you have to declare Root node and then childnode that is dislocated with some displacement with respect to the rootsceneNode or has same position as root node.
Can somebody tell me please how can I assign first fixed position to my SceneNodes and then declare them as a childnodes to one another.
Thanks a lot for help
-
- Halfling
- Posts: 41
- Joined: Sun Oct 27, 2013 11:57 pm
- x 1
Re: Childnodes
"Well there are some math calculations between every move, and they are still run on CPU once I dont have GPU libraries yet ready, and graphics kind of cant chase actual calculations properly, it is just an excellent like it is to leaving it in a linear hierarchy of childnodes, I am not totally sure but the results that I am getting from the simulations should be a bit different. If I make separate rotational moves for all the 4000 nodes instead of just leaving it as it is that will make things work properly for sure but will it make things much more slow ?? "levan wrote:Indeed I am figuring out the difference and then assigning it but it would be much more easier just to set the positions for all the nodes (positions I have in the files) and then assign them as a children to one another. Once I have 4000 objects its time consuming to assign differences for all of them.spacegaier wrote:What do you mean "you are afraid"? If all are in one linear hierarchy, all child nodes will move accordingly. Did you make a different observation?levan wrote:But I am afraid that when for example node 24 is moving the rest is not following its motion correctly. Is my System to big ? what is a limit for making this thing work properly ?
"Well there are some math calculations between every move, and they are still run on CPU once I dont have GPU libraries yet ready, and graphics kind of cant chase actual calculations properly, it is just an excellent like it is to leaving it in a linear hierarchy of childnodes, I am not totally sure but the results that I am getting from the simulations should be a bit different. If I make separate rotational moves for all the 4000 nodes instead of just leaving it as it is that will make things work properly for sure but will it make things much more slow ?? "
Why? What is your issue with first creating the new node as a child of the previous one, then settings its position relative to the parent? If you know the desired absolute position and you know which node is the parent you can figure out the relative difference.levan wrote:I want first to assign position to the SceneNodes and then declare them as a childnodes. But I did not find way how to do it properly.
First you have to declare Root node and then childnode that is dislocated with some displacement with respect to the rootsceneNode or has same position as root node.
Can somebody tell me please how can I assign first fixed position to my SceneNodes and then declare them as a childnodes to one another.
Thanks a lot for help
- spacegaier
- OGRE Team Member
- Posts: 4304
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 135
- Contact:
Re: Childnodes
One quick note: Translations of the child nodes are no issue. Rotations might, since the order plays a role as they are not cumulative (not an expert on all those mathematical / theoretical topics).
Also, if you get slight differences and depending on your scales, you might experience floating point precision issues. In that case, you can compile Ogre with a special mode (see the CMake options) so that it will use 'double' instead of 'float' internally.
Also, if you get slight differences and depending on your scales, you might experience floating point precision issues. In that case, you can compile Ogre with a special mode (see the CMake options) so that it will use 'double' instead of 'float' internally.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
-
- Halfling
- Posts: 41
- Joined: Sun Oct 27, 2013 11:57 pm
- x 1
Re: Childnodes
spacegaier wrote:One quick note: Translations of the child nodes are no issue. Rotations might, since the order plays a role as they are not cumulative (not an expert on all those mathematical / theoretical topics).
Also, if you get slight differences and depending on your scales, you might experience floating point precision issues. In that case, you can compile Ogre with a special mode (see the CMake options) so that it will use 'double' instead of 'float' internally.
Thanks a lot spacegaier
just one more questions. If you know how much slower it will be if I implement every rotation in subsequent manner rather then rely on automatic rotations inherited from parent to child. I mean if you know does it take in ogre longer to do particular independent operation rather then do it by following inheritance root. Or may be it will be even faster ?
I have to redo all my code so good to know if its worth of doing that.
all the best
levan
- spacegaier
- OGRE Team Member
- Posts: 4304
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 135
- Contact:
Re: Childnodes
Regardless of the performance, this is a design question: Do you want that childnodes are updated based on the parent? Then there is no other way if you don't want to do it "manually" than to use one deep hierarchy. If that update makes it harder for you and you would rather set the individual manipulations on the nodes directly with absolute values, then one root node with X single level children is what you need.
Unless I am misunderstanding your question...
Unless I am misunderstanding your question...
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
-
- Halfling
- Posts: 41
- Joined: Sun Oct 27, 2013 11:57 pm
- x 1
Re: Childnodes
spacegaier wrote:Regardless of the performance, this is a design question: Do you want that childnodes are updated based on the parent? Then there is no other way if you don't want to do it "manually" than to use one deep hierarchy. If that update makes it harder for you and you would rather set the individual manipulations on the nodes directly with absolute values, then one root node with X single level children is what you need.
Unless I am misunderstanding your question...
Thanks,
Well yes there is a bit of misunderstanding and its difficult for me to explain correctly what I am doing. I was just interested in something like following:
For example we have a node A and node B that is a child of node A. We made some specific rotational method and applied it to the A, so B is rotated as well (B is following rotation of A). But if we apply this rotation to A and B sequentially we will get the same result. So if A and B are not child and parent to one another and we rotate them sequentially will it be faster or slower ?
best
levan
- spacegaier
- OGRE Team Member
- Posts: 4304
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 135
- Contact:
Re: Childnodes
I really cannot say . Best to give either approach a quick try yourself and make some performance traces (and let us know please afterwards). I would suspect doing it "manually" on your own might be a bit faster, because this is how I see it (assuming I understood you correctly now ):
If you have a node hierarchy you will only trigger the special rotation (not really sure what you mean by that) for the first node and all attached child nodes get correctly updated accordingly. Internally Ogre passes the request for an update upwards the chain to the parent to later update the involved children. If the list is very long, that request passing gets done many, many times and might cost a bit of performance the longer the chain grows (and you said you want to chain several thousand objects):
If you would however not use any hierarchy you would simply have to loop over all other nodes yourself and apply the rotation, without notifying all other thousand nodes (except the parent node).
Again, this is not tested by me and just a guess and only a very quick look at the Ogre source!
If you have a node hierarchy you will only trigger the special rotation (not really sure what you mean by that) for the first node and all attached child nodes get correctly updated accordingly. Internally Ogre passes the request for an update upwards the chain to the parent to later update the involved children. If the list is very long, that request passing gets done many, many times and might cost a bit of performance the longer the chain grows (and you said you want to chain several thousand objects):
If you would however not use any hierarchy you would simply have to loop over all other nodes yourself and apply the rotation, without notifying all other thousand nodes (except the parent node).
Again, this is not tested by me and just a guess and only a very quick look at the Ogre source!
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...