Old BVH bug workaround ?

Philemo_CarraraPhilemo_Carrara Posts: 1,175
edited December 1969 in Carrara Discussion

For a long time, I've given up using BVH in Carrara. Sometime it works, but more than often, there was strange behaviours (hip jumping with no reason, forearm stuck to the arm ...). In other products (poser, bvhplayer, bvhhacker), the problem wasn't occurring.

Anyway, for a current project, I needed mocap files, so I decided to give i a new try.

This time, I decided to check the maths and to benchmark Carrara with the BVH importer in CGKit (a python Library).

And I found something...

It seems that for the files with issues, Carrara is using the wrong rotation order (in the 'Motion' tab 'Motion' subpart).

If I change it from ZXY to XZY, the issue disappears... and the BVH works as advertised.

I've tested it with CMU (direct translation from ASF/AMC using
AMC2BVH and also Motion builder port in CGSpeed) and Mixamo bvh. For most of the files, the change was necessary.
I also use some BVH from Mocapdata or ACCAD, but it's working properly without changing it.

So, if it works, don't touch it :-). If not, you can try to change the angle order. Up to now, it worked for me.

Comments

  • RoygeeRoygee Posts: 2,247
    edited December 1969

    Very interesting discovery - this could be because Carrara uses Z for vertical and Y for depth and it is not translating correctly from the original, which probably used Y for vertical. When you encounter this problem, do you have to go through the whole armature, or only the bones that give the problem?

    Quick rule of thumb - the rotation order, from left to right is, first, the twist axis (in a leg that would be Z for Carrara and in an arm X), then the axis most likely to reach 90 degrees, then the one least likely to reach 90 degrees.

  • Philemo_CarraraPhilemo_Carrara Posts: 1,175
    edited December 1969

    For now, it was mainly necessary for hips, arm, forearm. I haven't tried to set it for all because it's a tedious work ;-) But I will.

    BVH is supposed to be Y up, Z forward while Carrara is Z up Y- forward. Carrara translates it correctly (Y become Z, -Z becomes Y).

    The angle order is given in the BVH file and Carrara also respects that.

    My guess would be data was exported from a left-handed coordinate system while carrara uses a right handed one. Doesn't show if you stay in Y up z forward, but only if you transcode to z up y- forward.

  • DUDUDUDU Posts: 1,945
    edited December 1969

    Hi Phil !
    I'm a large consumer of .bvh and I was seldom confronted with this problem.
    I always group the tree of my characters to move/rotate them how I want.
    It's very rare to have .bvh which work perfectly in Carrara, the majority work well with series 3 but there are almost always crazy keyframes that it is necessary to remove, why ?
    I work in 25 fps whereas they are in 24 fps. except those (perhaps) because they come from Switzerland : http://www.bond3d.byethost18.com/index.php?PHPSESSID=a8b0f6aebe1e54cf0ac2673eb0d07173&topic=237.msg1384;topicseen#new
    Not tested yet…
    I have always a lot of keyframes between normal place of keyframes, is it because of that ? I don't know.

  • Philemo_CarraraPhilemo_Carrara Posts: 1,175
    edited December 1969

    I think it's those crazy frames that I was speaking of.
    Could you PM me an example of a file with crazy frames ?

  • DUDUDUDU Posts: 1,945
    edited December 1969

    It is always when one seeks one of them that one doesn't find any…:roll:
    Here a short .bvh converted into .nla clip, I tested it with M3, you will see the arms which have keyframes in excess.
    http://mhdproductions.be/Carrarators/NLA.zip

  • RoygeeRoygee Posts: 2,247
    edited December 1969

    @Philomeno

    Where do you change the rotation order? The only place I can find is to convert from "Full" to "Ball", then the order beomes editable.

    Just tested a couple of the CMU hip corrected BVH files. Those that make a total mangled mess of M4 imported directly, work almost flawlessly after running through DS, then either exporting as BVH or as .pz2.

  • Philemo_CarraraPhilemo_Carrara Posts: 1,175
    edited December 1969

    @Roygee
    See the image

    @DUDU
    Changing rotation order to a figure (or par of it), except on hip, will mess up the skinning

    Actually, I'm importing BVH as new skeleton because I retarget animation from different skeleton.

    To do that, I resize the BVH skeleton so the legs have the same size (to avoid foot slippage) and I place target helpers in the source skeleton in hips, thighs feet, shoulder, hands and where the arms meet the spine. I move them to match the same position as in the target.
    On the target skeleton, I add 'inverse kinematic' modifier on the corresponding bone and use the target helpers as track source.

    It works (Carrara IK solver is great), but it's a bit tedious so I'm working on a plugin to automatize that process.

    If I get time, I may produce a more detailed tutorial

    Motion.PNG
    235 x 157 - 14K
  • DUDUDUDU Posts: 1,945
    edited December 1969

    Nice, a plugin !
    Why not a script ?

  • Philemo_CarraraPhilemo_Carrara Posts: 1,175
    edited December 1969

    Nice, a plugin !
    Why not a script ?

    Because I need to create new objects, attach them to bones, which is not possible with PyCarrara.
    Otherwise, I would do a script (far quicker)
  • RoygeeRoygee Posts: 2,247
    edited December 1969

    2Philomeno - thank you:) Very innovative solution - the BVH skeletons always work perfectly!

  • skydatskydat Posts: 25
    edited December 1969

    Philemo said:
    @Roygee
    See the image

    @DUDU
    Changing rotation order to a figure (or par of it), except on hip, will mess up the skinning

    Actually, I'm importing BVH as new skeleton because I retarget animation from different skeleton.

    To do that, I resize the BVH skeleton so the legs have the same size (to avoid foot slippage) and I place target helpers in the source skeleton in hips, thighs feet, shoulder, hands and where the arms meet the spine. I move them to match the same position as in the target.
    On the target skeleton, I add 'inverse kinematic' modifier on the corresponding bone and use the target helpers as track source.

    It works (Carrara IK solver is great), but it's a bit tedious so I'm working on a plugin to automatize that process.

    If I get time, I may produce a more detailed tutorial

    This is a great idea - wish I'd thought of it! It's the best way to get bvh working in Blender too, just set constraint to copy master rig - I have given up on the Blender built in rig retargeting add-on. I hope you can make a script or a dem of this.

    I assume by doing it this way it does not deform the target mesh? If I transfer BVH in Blender or Daz directly instead of via constraint , the result is always rubbish due mesh not deforming correctly. Anyway, I may go off and try it now, but as always the Devils in the detail. Cheers.

  • HeadwaxHeadwax Posts: 9,969
    edited December 1969

    Philemo, I used to bring them into truespace then export them and they would work well in Carrara, maybe did the same thing

  • Philemo_CarraraPhilemo_Carrara Posts: 1,175
    edited December 1969

    head wax said:
    Philemo, I used to bring them into truespace then export them and they would work well in Carrara, maybe did the same thing

    Thank you head wax,

    I will install it to try.

  • HeadwaxHeadwax Posts: 9,969
    edited December 1969

    pleasure

  • DondecDondec Posts: 243
    edited December 1969

    I'm also interested in your tutorial/plugin/script Philemo, or even a couple of pix of the process. I've done work with BVH files in IClone and downloaded some of the CMU files, but I gave up trying then in Carrara when I encounter the problems you mentioned. I assumed Carrara's import strategy was "old" and needed a software update or something.

    - Don

  • Philemo_CarraraPhilemo_Carrara Posts: 1,175
    edited December 1969

    Hi Don,

    It's really a tedious process. I'm working on a plugin to have instant retargeting on 2 clicks.
    If I cannot make it, then I'll post a tutorial. Meanwhile, I prefer to spend my (much too limited :-) ) time on the plugin .

    Philemo

    I'm also interested in your tutorial/plugin/script Philemo, or even a couple of pix of the process. I've done work with BVH files in IClone and downloaded some of the CMU files, but I gave up trying then in Carrara when I encounter the problems you mentioned. I assumed Carrara's import strategy was "old" and needed a software update or something.

    - Don

Sign In or Register to comment.