Animated meshes and fps
Animated meshes and fps
Have 1 character animated mesh and 5 enemies
the same animated meshes (800 poly-count each mesh) in my mobile game.
When only 1 character loaded I have fps = 17 - 21 and 13500 poly - count for entire map.
If 6 meshes loaded fps = 13 - 15 and 18500 poly - count.
If I make 5 meshes invisible poly - count = 13500, but fps = 14 - 17.
What's wrong?
Thank you!
the same animated meshes (800 poly-count each mesh) in my mobile game.
When only 1 character loaded I have fps = 17 - 21 and 13500 poly - count for entire map.
If 6 meshes loaded fps = 13 - 15 and 18500 poly - count.
If I make 5 meshes invisible poly - count = 13500, but fps = 14 - 17.
What's wrong?
Thank you!
Re: Animated meshes and fps
Not sure but my first guess would be that the anims are still calculated independently from the model being visible or not.
beer->setMotivationCallback(this);
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
Re: Animated meshes and fps
Transformations and such have to be calculated even if they're off screen to at the least tell if they are. This could be a cpu bottleneck, though I doubt it with so few meshes
-
- Posts: 288
- Joined: Wed Apr 16, 2008 1:45 am
- Contact:
Re: Animated meshes and fps
if you are worried about it simply tell it to stop animating when you set it to invisible? that should make it so it has very little effect on the application speed (will always have a little since it must check if the node is visible or not among other things that will happen just because the scene node has been created and you can only stop those by removing the node)
Re: Animated meshes and fps
Animations are not calculated when the nodes are invisible, transformations are still needed. Although those are usually not so expensive. But you can also remove nodes completely from the scenegraph. Just put them into some other structure which contains 2 ISceneNode pointers. One for the parent and one for the node. Grab them both and then you can remove the node with remove() or by setting the parent to 0. So you still have it in memory but no longer in the scenegraph. To put them back you just have to set the parent again (and drop pointers again for correct ref-counting).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Animated meshes and fps
Thank you very much to all!
Re: Animated meshes and fps
CuteAlien, could you give me some code snippet where I can see correct node management as you described above.CuteAlien wrote:Animations are not calculated when the nodes are invisible, transformations are still needed. Although those are usually not so expensive. But you can also remove nodes completely from the scenegraph. Just put them into some other structure which contains 2 ISceneNode pointers. One for the parent and one for the node. Grab them both and then you can remove the node with remove() or by setting the parent to 0. So you still have it in memory but no longer in the scenegraph. To put them back you just have to set the parent again (and drop pointers again for correct ref-counting).
Thanks, in advance.
Re: Animated meshes and fps
Why don't you try it yourself? I help if you get stuck and have specific questions.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Animated meshes and fps
Ok.CuteAlien wrote:Why don't you try it yourself? I help if you get stuck and have specific questions.
So, I create two nodes
ISceneNode* parent = smgr->addEmptySceneNode(0, 100);
IAnimatedMeshSceneNode* child = smgr->addAnimatedMeshSceneNode(smgr->getMesh(workingDirectory + modelPath), parent);
I want to remove animated node from the scene graph while it's not necessary.
parent->grab();
child->grab();
parent = 0;
Nodes are removed.
How can I add them again to the scene graph without mesh loading?
Thank you.
Re: Animated meshes and fps
You don't remove a node from the scene by setting a pointer to 0 (all you do by that is filling the place in memory holding the pointer with 0, the object the pointer points to is not affected by that). If you want to remove a node from the scenemanager you use the remove function for the node. Doing a grab() first is there to ensure you still can access that memory as it would be deleted otherwise if the scenemanager is the only object with a reference to the node. And then you should just keep it around in some structure - a struct with a pointer to the object (and to be safe to it's parent although you maybe don't even need this if you have a flat scenegraph).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Animated meshes and fps
I'm sorry, but my last question was
"How can I add removed node to the scene graph again without mesh loading?"
How can I return saved pointer (*IAnimatedSceneNode) to the scene graph?
"How can I add removed node to the scene graph again without mesh loading?"
How can I return saved pointer (*IAnimatedSceneNode) to the scene graph?
Re: Animated meshes and fps
You just restore the parent. The parent is still in the scenegraph (supposedly - otherwise you wouln't know how to add it anyway) so when you set it as parent the node is back in the scenegraph. So node->setParent( oldParent ).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Animated meshes and fps
Ok!
Now it's clear.
Thank you very much!
Now it's clear.
Thank you very much!