I have more than 10 000 objects that move around in my application. After trying different optimization methods (LOD, GeomBatch, etc) BatchNode was the best method to use that gave me the best results. I batch all the objects and get a significant fps improvement compared to not optimization. Of course I lose the benefit of culling which is my dilemma now.
In my application/game, I tend to zoom in a lot and noticed that zooming in without optimization is much better than optimizing with batchnode. So what’s the recommendation from the experts? Is there anything I could do in the middle? Note that all the 10,000 objects move around.
To summarize:
1- if I optimize with batchnode I get better fps when fully zoomed out which is relatively low compared to a zoomed in view without any optimization.
2- if I don’t optimzie, it’s fine when I zoom in, but when I zoom out the fps drops significantly (down to 1 sometimes)
It looks to me afterall that using LOD where I have VERY low quality objects and regular objects might be the way to go as I realy need the culling benefits here. Doing a quick test, I replaced my objects with red boxes and that improved my fps dramatically.
@pspeed I thought of that already but unfortunately my objects move around and at some point they’ll be all over the place (which defied the purposes of having different batch zones)
@garnaout said:
@pspeed I thought of that already but unfortunately my objects move around and at some point they'll be all over the place (which defied the purposes of having different batch zones)
What zarch said is exactly what I was thinking.
I always hesitate to wade into these threads because usually you’ve already decided the way you are going to go and all of our advice only results in denials on why it won’t work rather than further questions. It would save us a lot of time if you could just tell us how you are already proceeding and then we can comment on the merits rather than the other way around.
Maybee you should also tell us why exactly you need 10k objects in the scene? Maybee there are some tricks to keep that count down that work differently
absolutely guys and thanks again for all the help, your advice is always essential as you’re the experts here and not me.
1- I need 10,000 objects because my app is really a computer model of a warehouse with 10,000 things moving around.
2- the way things move are really random and outside my control. In other words, object A need to go and meet object B in a random fashion and both of them could be on opposite side of the warehouse map (that is quite large)
3- For simplification if let’s say I had 20 zones, object A, at the end of the model’s life, could really have traversed ever single zone.
“Object A” is a “game object” (for sake of this discussion I’m using the word “game”). A “game object” can exist anywhere in the world at any time. It is not part of the scene graph.
A Spatial is not a game object. A spatial is a visual representation of a game object. The game object’s Spatial is in the scene graph.
Every frame, check the locations of your game objects and see if they are in a different zone than they were before. If so, then the game object’s Spatial needs to be moved from one batched zone to another. Basically, you’d have a batch node per zone.
Or have one object that represents a “stack of objects in the warehouse” that you grow/shrink as required. As objects are moving around remove them from the stack, have them a standard object until they reach their destination then add them to that stack.
not ignoring your advice, and I know jMonkey devleopers prefer BatchNode over LODs but can you explain to me why you wouldn’t prefer using LODs in this case? seems to me that it would be simpler to implement rather than having to follow each spatial around to see which zone they go in no?
If so, I am using j3o objects and not OGreXML, is it possible to load two separate j3o versions of the same spatial (e.g. LOD0 and LOD1) whenever the cam gets closer/farther from the map? I know there’s already an LOD example in the wiki, but that uses OgreXML files to do automatic LOD
10,000 objects + LOD is still 10,000 objects. It’s the object count that will kill you the most.
Batching is the only thing that can lower objects counts.
Regarding zones, most games with this many objects would have already been using zones from the beginning. This is just one of many reasons why I think teaching people to treat Spatials as “game objects” is a disservice to the community. It’s quick and easy but is only suitable for a certain type of particularly small game.
And to answer your other question, moving a node from one batch to another is not free… but relatively speaking should happen rarely. Certainly when compared to having to render 10,000 objects 60 times every second.
10,000 objects + LOD is still 10,000 objects. It’s the object count that will kill you the most.
true but I already did a test when I replaced all my 10,000 spatials by 10,000 boxes (way lower vertices) and that did it for me.
That’s probably because all of those boxes were sharing the same Box mesh.
Even if not, draw dispatch will be cheaper per object on something with 24 vertexes… even though it’s still way way way more expensive than one object with 24,000 vertexes.