Its a MacBook Pro 2.4ghz, drivers I haven’t checked… Will update that. Any ideas about the doAutoMove code though? Why its expensive, that shouldn’t be affected by graphics card performance at all. It should be purely cpu bound.
400 sheep is a lot of individual objects to draw, though I’m surprised I’m not seeing that count in the PStats (it only shows 73 Geoms in your scene). So either we are not seeing all of your sheep onscreen at once, or you are doing something like a RigidBodyCombiner to flatten them together.
18ms to compute 400 sheep means only 0.05ms per each sheep. That function could easily consume 0.05ms (actually, I’m surprised it’s not much higher). To reduce the cost of the function, you can either vastly simplify this function, or reduce the number of times you have to call it (for instance, stagger it per sheep so that you only call it once every five frames for each sheep).
You have a lot of vertices in your scene: 228 thousand. I guess your sheep have a lot of vertices in each one? Normally, vertex count doesn’t matter that much, but perhaps this is a key factor here. What happens to your frame rate if you use a simpler model for your sheep?
The reason its showing 73 is probably because I was not zoomed out all the way so not all were visible. I am not doing any flattening. I am using the default panda model that comes with the demo, it has about 2000 triangles though none of them are in a strip.
Ralph model that comes with the ralph tutorial has on an average I think 3500 triangles.
I am using a 256*256 height map for GeoMipTerrain with a block count of 32.
Will try and stagger the updates and see if that helps
Hmm, I am horrible with blender:-. These were the two models I could find that came with Panda itself:). Is there a simple model that you can point me to that I can just plug in. How do I make say a character out of a simple say box model? When I try to load the box model as an actor panda complains its not a character.
Further, the Mac Build seems to be broken, quite a lot of utilities complain about missing dynlibs because the rpath in the binary is not set correctly. punzip refuses to work. If i try the latest snap the utilities work but panda breaks:-.
Much easier to use an LODNode, which is exactly for this purpose. You can take your two different models and parent them both to the LODNode, and then set the switch distance appropriately. But note that billboards can be expensive too; it might be better just to have a lower-polygon model.
This is, of course, assuming that the vertex count really is the issue. It’s worth some tests to prove this first.
I do not think Vertex count is the main issue but more like the culling+just rendering of 400 individual models has too many state changes maybe? I ran it on windows while watching the graph view of pstats and here’s what i observed.
My app would spend about 17-20ms per frame.
When zoomed in cull/window times would be in the few ms totally.
As I zoom out cull/window times would go up almost 1:1, so my time would be split like 20-30ms app/20-30 cull/20-30 window.
If anyone is interested in playing with the code and seeing I can upload a tar of the code.
Right, if you have a high Cull time, you probably have too many individual nodes, with too many transforms, and a too-flat hierarchy.
400 sheep moving around independently is going to cause you this kind of trouble. You can reduce this by grouping some sheep together under a common node, according to their proximity; but it will still cause the same problems when you zoom out to see the whole scene. Unless you can then use LODNodes to render a particle system or something that resembles sheep from a distance, instead of an actual cluster of individual sheep.
Hmm maybe not a bad idea. Will give that a shot. Thanks for your suggestions. Though I still need to figure out a way to cut down the cpu time for a the move function. Given that I am having trouble with just a simple move taking so much time with 400 actors. I wonder how it will scale for a large scale RTS where I have to do much more than just move randomly.
The category is called “Cull” in PStats, but it’s misnamed. It’s not just time spent culling the scene; that’s trivial. The time spent in Cull is time spent visiting all of the nodes, discovering what is to be rendered, accumulating state and transforms, building up the render list in order, and generally doing all of the work on the CPU that must be done before geometry can be rendered. It’s not optional.
You can disable culling, but that won’t have much impact on the “Cull” time in PStats. (In fact, disabling culling often increases the “Cull” time, because it means more nodes must be visited.)