# How to do custom mocap importing? ( imperfect bone positions = incorrect bone sizes )

Hello everyone,

The manual is clear on how to generate Actors from scratch. My question is different.

I’m writing some code to acquire poses from custom DIY mocap system. I think my question is a more general one, though.

The issue is that the acquired positions and angles of each joint/bone are not too accurate, which means the generated bones and Actor joints will not have the correct length if there is a hierarchy in the skeleton which of course there is.

So I think the child bones somehow should be constrained by the already posed parent bones.

I’m wondering how this “averaged” and constrained child bone position and rotation value can be calculated by having the already applied position and rotation value of the parent bone and the unprocessed, raw position and rotation value of the child bone.

My understanding is that if a bone with fixed size is attached to a parent bone, there is a fixed sphere of possible positions for it, so the closest point on that sphere surface to the acquired raw position should be determined?
Is this what should be done? And how would you do it?

Thanks

Hmm… Perhaps for each armature you could capture a reference pose, manually adjust it, and then have all future poses with that armature only provide angles for the bones (and positions, in the case of detached bones), not sizes.

I think you misunderstood.
A motion capture system provides positions of each bone, some also rotations. The issue is these values are both not precise and not accurate. So if you have a 3d point for position of bone A and another 3d point for position of point B and use them without processing the data first, the child bone will move beyond a position it is allowed to be in while being attached to a parent bone. So either the parent bone will need to be modified (prohibited, changes parent bone size) or the data will need to be modified first. .

No, I think, at least, that I understand. (Although it’s possible that we’re looking at the problem from different perspectives.)

Consider: A bone that is a child of another, being placed in a given position, forms an angle with that other. If we presume that the bones do not change length, then they can notionally only rotate, and so only that angle is relevant. Thus we can compute a valid position for the end of the bone by applying said angle.

 Put another way, what I’m suggesting is that you take the positions provided by the motion-capture system, use them to calculate for each bone the angle between it and its parent, and then apply those angles to your armature.

I think the issue with that simpler approach is you use the unprocessed child bone position data to calculate the relative (to the parent) child bone rotation value, which should result in the relative rotation value also being less accurate.
If you instead process the position data to respect the parent bone’s position and bone length first, then I believe the child bone position value will change which will in turn also change the child bone relative rotation value.

It will indeed likely change. However, given that the source-data is inaccurate, is this processed version likely to be more accurate?

But maybe. In which case, performing the process that I described one bone at a time in a top-down tree-traversal might help: that way each parent-bone will have been processed to its proper length before you process the positions of its child-bones.

That’s a good point:

If we are “correcting” the position of the child bone based on the tracked position of the parent bone, but all bones have the same level of tracking inaccuracy and imprecision, does that give any advantage?
I don’t know, really.
I would think not, but maybe I’m wrong.

It might be worth experimenting with in order to find out, at least.

There’s really no way to get the ground truth data to comapre the results to. We can only compare the results between themselves but we don’t know which is more accurate.

An elaborate setup with the motion capture devices precision positioned at fixed distances from each other would be needed for getting the ground truth to compare to.

That is true, I do think. Still, we might however be able to eyeball which approach looks more convincing.

okay, thanks

1 Like