OnPostRender slow, manageing thousands of Scenenodes...

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
eis_os
Posts: 12
Joined: Sun Apr 18, 2004 12:40 pm

OnPostRender slow, manageing thousands of Scenenodes...

Post by eis_os »

Hi

Currently with my octree culling scenenode I manage to have 90000 Objects without a lockup ~4fps and display ~ 200 triangles that are in the frustum.

The really big problem I have it's the rather slow OnPostRender function. Currently the analyse shows it's 53% the time of running in it. Overloading it with a dummy function results in a framerate of 85fps with ~ 200 triangles My question is how to workaround the problem, the functions always calcs every frame the updateAbsolutePosition :(
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

I think it should be easily possible to change that so updateAbsolutePosition is only called for a node when setPosition() or setRotation() are used on it. Since few nodes will move every frame that should yield a speed increase. Only potential pitfall is if a node has two movement animators on it, thus it updateAbsolutePosition would be called twice per frame. That situation is fairly unlikely though, at least I can't think of when it would be likely to be used.
Another solution, which would help the last unlikely sceneario would be to set a flag on the node when it's transformation changed. OnPostRender would call updateAbsiolutePosition only of the flag was set true, then would clear the flag regardless
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Captain_Kill
Posts: 124
Joined: Sun Jun 27, 2004 11:02 am
Contact:

Post by Captain_Kill »

Nice :D :D :D Will try that flag idea Electron... I think you're right with that too so i'll give it a shot and see what happens.
2.8GHz P4 with HT - 512MB DDR - ATI Radeon 9600XT 256MB - Windows XP - VC++ 6 and VC++ 2003

Dark Reign 3 Home Page: http://darkreign3.notwhatyouthink.org/
Dark Reign 3 Forums: http://notwhatyouthink.org/darkreign3bb/
Post Reply