[2.2] Enabling pose animation with Item

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
User avatar
cc9cii
Halfling
Posts: 99
Joined: Tue Sep 18, 2018 4:53 am
x 20

[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
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [2.2] Enabling pose animation with Item

Post by sercero »

Hello,

Are poses supported in Ogre v2 Item?

Because when exporting a model with shape keys (blender2ogre), if there is a <poses></poses> entry in the .mesh.xml then OgreMeshTool will fail to write the binary .mesh file and return with non-zero value.

This works OK:

Code: Select all

OgreMeshTool.exe -e -O puqs -v1 Cube.001.mesh.xml
This does not finish OK:

Code: Select all

OgreMeshTool.exe -e -O puqs -v2 Cube.001.mesh.xml
This has been reported as a blender2ogre issue but is seems to be a problem with OgreMeshTool.
https://github.com/OGRECave/blender2ogre/issues/78

Best regards.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.2] Enabling pose animation with Item

Post by dark_sylinc »

Poses are supported in v2 items but it is not thoroughly tested.

It is HW acceleration only (no sw blending) which means right now only up to 4 concurrent shapes are supported per item (a compute shader based approach should fix it, but it hasn't been written yet)
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [2.2] Enabling pose animation with Item

Post by sercero »

Thanks,

And what about pose animation?

Is it also supported?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.2] Enabling pose animation with Item

Post by dark_sylinc »

I can't remember because pose animation was a contribution.

However it shouldn't be too hard to add, because morph animation is just a collection of poses. The only problem is that if the morph animation requires more than 4 poses (or you activate more morphs which together combined need more than 4 poses) then that can't be played out correctly.

Checkout the Samples/2.0/ApiUsage/MorphAnimations sample to quell your doubts.
Post Reply