[2.2] Enabling pose animation with Item

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
User avatar
cc9cii
Halfling
Posts: 91
Joined: Tue Sep 18, 2018 4:53 am
x 19

[2.2] Enabling pose animation with Item

Post by cc9cii »

Hi,

Progress
=======

I've been busy converting v1::Entity to Item objects in order to increase performance as per my previous post in this sub-forum. Most of the time was spent on trying to allow both v1::Entity and Item to co-exist since I have some objects that make use of vertex animation (and some have node animations at the same time). There is much code duplication so it isn't ideal but at least things are working.

For now I'm making use of Mesh::importV1() but I've noticed that it takes a while. Over time I'll have to move over to creating v2 mesh directly. One tricky part is to determine whether the mesh has any vertex animation. On-demand loading means v1::Mesh was being loaded during importV1() which is too late. So as a workaround I'm resorting to loading v1::Mesh at the beginning of the code block.

There is a subtle fragility with the current implementation I think. If a mesh is set with a skeleton name before the skeletal animations are created (e.g. in order to specify blending weights), then it will continue to use the version of skeleton without the animation. Unfortunately I didn't keep detailed notes since I was in a rush to just get things working - If I get some time I'll try to produce an example. From memory it is in SkeletonManager::getSkeletonDef() where it finds an old one.

The good news is that the performance is better. While there is still no improvement with Intel iGpu, using Nvidia dGpu it is about 10% - 15% faster than using Ogre 1.10.11 / D3D9. MyGUI continues to take between 40% - 50% of frame time just to render a few HUD overlay items (according to NSight). So if that issue can be resolved then we might be looking at 50%+ performance gain as long as dGpu is used. It is still much less improvement than what others are finding, so I'll have to keep looking where performance is being lost.

Issue
====

One issue that I cannot find a workaround is the head/ear/mouth/teeth meshes with poses for emotions, speech (i.e. mouth shapes when NPCs talk). Normally these use shareSkeletonInstanceWith() with the v1::Entity that represents the skeleton of the NPC. This skeleton "knows" 50+ animations such as run, walk, idle, turn left, block, cast, etc, etc. The same skeleton is also used for all NPC of the same type, e.g. human has one type, and khajiit another (end-users can also supply their own custom skeletons using MODs)

Using Items now I have Animation/SkeletonInstance and have to use useSkeletonInstanceFrom() but it only accepts Item and not v1::Entity (these objects can't be Item because they have vertex animations i.e. poses).

One crazy workaround might be to have both SkeletonInstance and v1::OldSkeletonInstance for each NPC at the same time. But that means doubling the number of skeletons to animate in a scene not to mention all the code duplication with only minor differences (Bone to v1::OldBone, etc). There might also be slight delay between one skeleton being updated a frame or two before the other.

So I think I have no choice but to try to implement supporting poses with Items.

Question
========

What would be the best way to go about supporting poses with Items? I thought about a couple of possibilities:

1. create a special kind of Item that supports software blending
2. modify Hlms (or create a new one) that supports poses (but there are 50+ poses per object)

I have no idea what/where to start. Any help or inputs will be much appreciated.

EDIT: here is a screenshot from Remotery - am I interpreting correctly to think that GPU is not keeping up with CPU here?

Image

Post Reply