I want to improve the performance of my game. I find it costs a lot to do animation in pstats.
The time consuming to do animation consists of two part: Box and Card. The Box is loaded from box.egg, and card is generated by card generator.
Therefore, I’d like to know how to optimize this and improve the performance.
PS: What is the difference between this animation and actor animation?
What do you mean by “this animation”? What kind of animation are you using atm?
Actor animation is actualy skeleton-based animation.
I only find one animation in panda3d’s manual. It is what you mentioned above, the skeleton-based animation. But there are no any actor models in my game. The scene in my game consists of static box.egg model and static 2-d card. Therefore, I am confused about where is the animation from.
Just to check, if I may: is the car a 2D card, then, with a texture applied to give the impression of a 3D car? And is the environment–the road, etc.–then “box.egg”?
Thanks for your quick reply! The car is a gltf model applied to BulletVehicle chassis. The road surface and lane-line are 2-d Card, and box.egg is used to create the side walk. Textures are set to them for realism. When I click the “animation” in pstats, it will show two part: Box and 2-d Card. And when I detach all boxes(box.egg), the animation time in pstats only comes from 2d-Card (detach all 2-d card will get similar result). Therefore, I can not understand why a static box and 2-d card are animated. FYI: box.egg is from the bullet-sample
oh, I find the reason of animation time consuming. The shadow calculation for 2d-Card and box model will increase the time used to do “animation” in pstats. I remove the direction light, and get a very high fps. Maybe I should set a drawmask for them to decrease the shadow calculation, which called “animation” in pstats.
Aah, yes, that would make sense: shadows tend to be expensive. I don’t know why it falls under “animation” in PStats, but I’m glad that you discovered that it does, and thus the presumed source of your problem!
Your environment is pretty flat, so removing it from shadow-casting should have fairly limited effect, making it a fairly safe thing to do so with.
Shadows shouldn’t cause a significant increase in CPU time, beyond a doubling of the scene traversal time. Anything more than that is just weird.
What do you see when you zoom into the Animation category?
Are you using the RigidBodyCombiner? That system uses CPU animation and is very expensive.
yes, rdb, you are right! I use the RigidBodyCombiner in a wrong way. It seems that the the call to the collect function of my RigidBodyCombiner Node makes the DrawMask under the node invalid. Thus the shadow calculation is applied to all models and 2-d cards. When I zoom into the Animation category, I find “box” and card category there and they cost a lot. But when I set a camera mask for the RigidBodyCombiner node, this problem is solved. (BTW, I love this method and flatten strong, by using them I got an amazing performance)