Animation performance problems

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
jhooks1
Gnoblar
Posts: 12
Joined: Mon Jul 04, 2011 8:36 pm

Animation performance problems

Post by jhooks1 »

Hello,

I am a developer from the openmw project, an open source reimplementation of the game "The Elder Scrolls 3: Morrowind". Our project website is www.openmw.org

I have been working on NPC animations and things seem to be working correctly but we have a major performance problem. For example, when I try to animate 10 npcs inside an interior cell, the fps goes down to 8fps. If only one npc exists in a cell performance is a lot better (approximately 40fps).

The way our npcs are animated is we have a base_animation file. We bind different body parts to the base, body parts can be skin, clothing, or armor. We animate the npc by manual moving the bones (ogre's animation system didn't work out for us).

Before all body parts were bounded to the base entity by using attachObjectToBone(). Performance with this method of operating was pretty good, around 37fps in the 10 npc cell. I came to realize though that certain body parts (chest, tails, beast feet, and hands) have multiple bone assignments, and in order to animate them correctly we could not use the attachObjectToBone() function. I decided to make each base animation unique (added a 4digit number onto it) and part submeshes are now actually added inside the unique base animation at the end of the loadResource() function. Also with every frame hardware buffers for each skinned part need to be updated. After doing things this way tails were swinging correctly and hands were opening and closing (new features that were not happening before). After doing this we also introduced the major slowdown as mentioned before.

Is there a more efficient way of doing things that could improve performance?

Thanks.

Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 997
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 48
Contact:

Re: Animation performance problems

Post by Crashy »

You could try to use hardware skinning, it should reduce the cpu load a lot, especially if you've a lot of characters simultaneously.
Follow la Moustache on Twitter or on Facebook
Image

jhooks1
Gnoblar
Posts: 12
Joined: Mon Jul 04, 2011 8:36 pm

Re: Animation performance problems

Post by jhooks1 »

Is there a tutorial out there on how to implement hardware skinning?

User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 217
Contact:

Re: Animation performance problems

Post by Jabberwocky »

To start, you need to specify includes_skeletal_animation true in your vertex program declaration.
See http://www.ogre3d.org/docs/manual/manual_18.html#SEC109

There are examples of this that come with Ogre. In Ogre v1.7, you can look at Examples.program at any of the vertex programs with "HardwareSkinning" in their name. Search for "HardwareSkinning" or "includes_skeletal_animation" inside that file, then have a look at the corresponding shader code.
Image

Post Reply