Bone merging / Animation retargeting

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


segfaulting
Gnoblar
Posts: 7
Joined: Wed Aug 21, 2024 6:54 pm
Location: Germany

Bone merging / Animation retargeting

Post by segfaulting »

Hi everyone, hope you're all doing well.

Is it possible to merge two armatures using ogre-next?

I have two models, a gun and a player model, the gun contains a subset of the player models bones (fingers, arms, etc. but not legs), with relevant animations (fire, reload, etc), now I intend to merge the two armatures together so I can play animations from a weapon directly on the player model, while also playing player animations, e.g. walking.

TagPoint seems unusable in this case as I can't attach a bone to a bone through these.
For addAnimationsFromSkeleton the documentation states

skelName skeleton must have the same structure (bone count, bone hierarchy) as this, otherwise it may output unexpected behavior or crashes.

which also makes it unviable, the weapon model may contain only a subset of the player models skeleton, and also contains additional bones for the gun itself.

Best regards

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 479
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 167

Re: Bone merging / Animation retargeting

Post by sercero »

Hello,

Here are some forum results that you can consult:

  • Animation blendmask not working correctly

You need to use ANIMBLEND_CUMULATIVE if you want to make use of blendmasks.
http://www.ogre3d.org/forums/viewtopic.php?t=76118

segfaulting
Gnoblar
Posts: 7
Joined: Wed Aug 21, 2024 6:54 pm
Location: Germany

Re: Bone merging / Animation retargeting

Post by segfaulting »

Hi sercero,

thanks for responding. I don't have an issue with animation blending it works perfectly fine.
My question is more rooted on the technical aspect whether it is possible to merge two skeletons alongside their meshes into one.

I've taken a deeper look into the documentation and couldn't find any partial solution to this, admittedly, niche problem.
I'm quite uneducated with the inner workings of ogre, and especially the mesh side of things, but is it possible to stitch two models together and merge their armatures at common intersections (i.e. merge bones with the same name)?
This would tremendously help me iterate on models, etc.

The only other perceived solutions to my problem I can come up with right now is baking the player model into each weapon file, which... well is quite subpar to say.
Or some sort of procedural animations with IK where possible, but this is finicky and adds another layer of complexity, to basically no merit if my original idea were to work.

Warmest regards

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 479
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 167

Re: Bone merging / Animation retargeting

Post by sercero »

Hello, now I understand.

Just an idea:
How about putting both meshes under the same node so that the human model player hands at rest are at the same position as the gun model hands which are animated (they would be in superposition).
And then you could use masks to hide the player hands and just show the gun "hands" that are animated.

Perhaps this would be easier to understand for people if you showed us screenshots of your models...

segfaulting
Gnoblar
Posts: 7
Joined: Wed Aug 21, 2024 6:54 pm
Location: Germany

Re: Bone merging / Animation retargeting

Post by segfaulting »

Sorry for the lack of image, I attached a view of the two models in question, I hope this makes it more clear:
Image

Image

How about putting both meshes under the same node so that the human model player hands at rest are at the same position as the gun model hands which are animated (they would be in superposition).
And then you could use masks to hide the player hands and just show the gun "hands" that are animated.

Well the issue is that the gun doesn't have hands, it just contains a subset of the players armature, same names, etc.
Preferably, I'd like to later on add multiple players models and make the player choose, this hinders exporting the gun models with hands.

Thanks for the reply!

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 479
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 167

Re: Bone merging / Animation retargeting

Post by sercero »

Another question.

Because I see that you are probaby making an FPS.

Is this standard industry practice?

I guess that at this point the FPS model is practically solved.

So is this the way that FPS games are made?

segfaulting
Gnoblar
Posts: 7
Joined: Wed Aug 21, 2024 6:54 pm
Location: Germany

Re: Bone merging / Animation retargeting

Post by segfaulting »

Is this standard industry practice?

I guess that at this point the FPS model is practically solved.

So is this the way that FPS games are made?

Quite frankly, I'm unsure, I'm not a professional game developer.
I had looked into different approached to this problem before, and they basically boiled down to:

  1. Bone sockets with generic animations that hopefully somewhat line up
  2. Procedural animations with IK
  3. This approach

I may be wildly incorrect here, but considering the up and downsides of each potential solution, this approach seemed the most reliable and extensible to me.