I am digging the performance issues we hav and I found very strange results.
Basically, we are rendering a city with over 10k objects.
The FPS is as we expected poor when we look at the city as a whole.
But looking down and therefore seeing only 10 or 20 objects, doens’t really improve the FPS and that is strange.
The last screenshot is “looking down” and its results are very strange.
I have a hunch that the “cached transform states” is not very good but I don’t know what the number should be.
Any idea ?
Thanks, I’ve turn on the task Profiling.
But The task profile is very strange…the “General” task takes 100ms…the rest are negligible …
See Below :
What is this General Task ?
Wow, you have quite some tasks.
I have no clue what “General” is. Maybe someone else can give clarifications on that?
Besides that, did my other suggestion(s) work?
I think the “General” was created by you. And you are doing lots of computation in that time frame. Too much. You either need to rewrite your algorithm, do it less often, or resort to C++ (which is not that hard.)
@treeform : it is a bit strange, the task is not present anymore in svn. I suppose someone from the team have seen my post and discretely removed it.
@pro-soft : thanks for the tip but I cannot use it as is. the building in the city are constantly destroyed/created. So, if I flatten I need to have a way to rebuild the hierarchy, and keep the ability to destroy only what needs to be destroyed.
in this case you can simply keep a copy of your city. use a working-copy where you build/destroy. and a render-copy which gets updated everytime you destroyed or build something and then flattened again.
geomipterrain’s autoflatten works simmilar.
could you elaborate a bit ? i am not sure I completely understood what you said.
A copy of the whole scene graph is hidden, and when a building is added, this copy become the real scene graph which is flattened, is that it ?
you basically have the following:
- your city like you have it right now, each building a seperate node.
- some code which creates a copy of this city , or parts of if and flattens those copies.
only the flattened nodes of number 2 will be rendered. number 1 is not rendered at all.
this way you can send fewer,larger chunks of data to your graficcard which can improve preformance a lot. and still beeing able to manipulate each and every single building.
oh and don’t worry about updating your “copy 2”. flatten really is a fast operation
for a city you could flatten several blocks of houses together. or maybe even larger regions, depending on your game. just experiment a little. you should aim for less than 300 geoms/geomnodes on-screen. overall-count doesn’t really matter that much.
i have a suggestion which i dont know if it works for your application.
you seperate the graphics changes from the gamestate changes (save that a change happened, but dont show it). You only update the parts of the graphics changes that are in or close to the camera’s lens frustum. And/Or if every building is changed every frame, only update it every 2nd frame etc (aka split the scene into 60 chunks, update 1chunk per frame).
And another hint: look at sim city, i would not suspect that every building is updated every frame. This also can cause problems, think of a building having 2 states (like poor/well going) and due to some factors these inputs create a change every frame. If you update the graphics every frame you would have flickering objects, while if you update only every second (or even less) it would look normal.