Trouble with Retarget BVH

Discussions about MHX2 and other plugins that are developed outside the scope of MakeHuman. Note that bug reports should go to the respective code projects and might go unseen here.

Moderator: joepal

Trouble with Retarget BVH

Postby tomcat » Sat Jul 30, 2022 8:59 am

In Blender 2.93 it gives an error when trying to assign animation from Bandai-Namco-Research-Motiondataset:

retarget-bvh_err_b2_93_Bandai-Namco.jpg
retarget-bvh_err_b2_93_Bandai-Namco.jpg (18.47 KiB) Viewed 13228 times


In the new version of Blender 3.2.1, the plugin, most unfortunately, just doesn't work:

Code: Select all
Python: [ERROR] mpfb.init ..............................: Unhandled crash
  File "C:\Users\Acer\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\retarget-bvh-master\utils.py", line 356, in execute
    self.run(context)
  File "C:\Users\Acer\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\retarget-bvh-master\retarget.py", line 552, in run
    info = self.retarget(context, filepath)
  File "C:\Users\Acer\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\retarget-bvh-master\retarget.py", line 577, in retarget
    info = self.retargetAnimation(context, srcRig, trgRig)
  File "C:\Users\Acer\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\retarget-bvh-master\retarget.py", line 331, in retargetAnimation
    scn.frame_current = frames[0]

bpy_struct: item.attr = val: Scene.frame_current expected an int type, not float

Traceback (most recent call last):
  File "C:\Users\Acer\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\retarget-bvh-master\utils.py", line 356, in execute
    self.run(context)
  File "C:\Users\Acer\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\retarget-bvh-master\retarget.py", line 552, in run
    info = self.retarget(context, filepath)
  File "C:\Users\Acer\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\retarget-bvh-master\retarget.py", line 577, in retarget
    info = self.retargetAnimation(context, srcRig, trgRig)
  File "C:\Users\Acer\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\retarget-bvh-master\retarget.py", line 331, in retargetAnimation
    scn.frame_current = frames[0]
TypeError: bpy_struct: item.attr = val: Scene.frame_current expected an int type, not float

Image
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 336
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: Trouble with Retarget BVH

Postby acassis » Sat Jan 28, 2023 7:58 pm

Hi tomcat,
I got it working!

Just edit your blender/3.x/scripts/addons/retarget-bvh/retarget.py converting frame from float to int: scn.frame_current = int(frames[0]) and scn.frame_set(int(frame))

BR,

Alan
acassis
 
Posts: 1
Joined: Sat Jan 28, 2023 7:53 pm

Re: Trouble with Retarget BVH

Postby tomcat » Sun Jan 29, 2023 8:52 am

acassis wrote:Just edit your blender/3.x/scripts/addons/retarget-bvh/retarget.py converting frame from float to int: scn.frame_current = int(frames[0]) and scn.frame_set(int(frame))

It works! Huge thanks!

But another problem arose:

Blender 3.4
retarget_3.4.jpg


Blender 2.93
retarget_2.93.jpg
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 336
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: Trouble with Retarget BVH

Postby DrHas » Wed Feb 01, 2023 5:09 am

I've never got BVH retarget addon to work beyond 2.93 LTS I think...what I tend to do is load animation in that version and continue work in the new version. The mocap animation works fine once you load the animation in 2.93. I'm working on a work around - using Auto Rig Pro.

Neb
DrHas
 
Posts: 28
Joined: Sat Nov 24, 2018 3:21 am

Re: Trouble with Retarget BVH

Postby tomcat » Wed Feb 01, 2023 7:07 am

DrHas wrote:what I tend to do is load animation in that version and continue work in the new version.

Well, yeah, it works… but returns us to the fact that this plugin can not be used in 3.x.

using Auto Rig Pro.

This option is unfortunately unacceptable. I try to use only free software… you can say it's like an experiment… but even if I want to buy a program I just can't do it… there is such a word "sanctions".
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 336
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: Trouble with Retarget BVH

Postby PayItForward » Tue Mar 07, 2023 8:49 pm

acassis wrote:Hi tomcat,
I got it working!

Just edit your blender/3.x/scripts/addons/retarget-bvh/retarget.py converting frame from float to int: scn.frame_current = int(frames[0]) and scn.frame_set(int(frame))

BR,

Alan

Just for your info. These lines of code don't exist in retarget.py anymore in the newer available addon versions 2.0.1 and 2.2.0
which can be found here:
https://bitbucket.org/Diffeomorphic/ret ... rc/master/
I tried this with 2.0, though, and it just gave me another error:

Code: Select all
Python: Traceback (most recent call last):
  File "/home/xxxxx/.config/blender/3.3/scripts/addons/retarget-bvh-master/retarget.py", line 561, in execute
    loadRetargetSimplify(context, self.properties.filepath)
  File "/home/xxxxx/.config/blender/3.3/scripts/addons/retarget-bvh-master/retarget.py", line 480, in loadRetargetSimplify
    time1 = time.clock()
AttributeError: module 'time' has no attribute 'clock'
Python: Traceback (most recent call last):
  File "/home/xxxxx/.config/blender/3.3/scripts/addons/retarget-bvh-master/retarget.py", line 561, in execute
    loadRetargetSimplify(context, self.properties.filepath)
  File "/home/xxxxx/.config/blender/3.3/scripts/addons/retarget-bvh-master/retarget.py", line 480, in loadRetargetSimplify
    time1 = time.clock()
AttributeError: module 'time' has no attribute 'clock'




tomcat wrote:But another problem arose:

Blender 3.4
retarget_3.4.jpg


Blender 2.93
retarget_2.93.jpg

Hey TC,
For me Retarget BVH "works" in all Blender versions (now 3.3) just the same. That is, I never get the CMU rigs correctly to work and neither the ACCAD male which looks seriously creepy. That said, your picture for 2.93 has already also distorted shoulders, and I get exact the same result in 3.3.

Image
ACCAD male horror
twitter.com/ChristophCrane_ (Indie author & game developer)
User avatar
PayItForward
 
Posts: 22
Joined: Thu Nov 03, 2022 8:23 pm

Re: Trouble with Retarget BVH

Postby tomcat » Tue Mar 07, 2023 10:07 pm

PayItForward wrote:That said, your picture for 2.93 has already also distorted shoulders

Nope. Retarget worked correctly in this case. This is a bug in the .bvh file itself. Here you can see that the shoulders are up:

retarget_bvh.jpg


ACCAD male horror

But it's easy to make monsters… there was a suggestion to add the ability to create monsters in the new version, but as can be seen, nothing needs to be done — everything is ready. :mrgreen:
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 336
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: Trouble with Retarget BVH

Postby PayItForward » Wed Mar 08, 2023 8:22 am

tomcat wrote:
PayItForward wrote:That said, your picture for 2.93 has already also distorted shoulders

Nope. Retarget worked correctly in this case. This is a bug in the .bvh file itself. Here you can see that the shoulders are up:


Oh, I see. Is it a CMU rig? I've found countless flaws in them. It's typically the shoulders and that strange sidewards bent of the head or neck. The top next issue is bone roll of the legs.

I have yet to come upon a single CMU BVH where this isn't the case so I always thought that CMU used just a a peculiar T-pose which doesn't "translate" well into other software. I tried to play a little with changing bone roll and such but I really don't understand much of it so no luck.

Monsters

The ACCAD rig has now the status of an officlal monster plugin
:D
twitter.com/ChristophCrane_ (Indie author & game developer)
User avatar
PayItForward
 
Posts: 22
Joined: Thu Nov 03, 2022 8:23 pm

Re: Trouble with Retarget BVH

Postby tomcat » Wed Mar 08, 2023 3:52 pm

PayItForward wrote:Is it a CMU rig? I've found countless flaws in them.

I use CMU's Motion Capture Database 2010 RE-RELEASE. All in all, it's one big, solid flaw. The only advantage is that it works with Retarget BVH. Unlike the others. The more motion-correct Bandai-Namco doesn't work, as I said at the beginning of the thread.

I have an idea to try to convert the sources, but I suspect it won't improve.

The top next issue is bone roll of the legs.

I use a translator and maybe that's why I don't really understand the meaning of the term. Can you clarify it?
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 336
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: Trouble with Retarget BVH

Postby PayItForward » Wed Mar 08, 2023 6:36 pm

Yeah, I had a look at CMU, Bandai and ACCAD, too, but for me only the ACCAD female BVH's worked. Even these BVH's had some minor issues, that is, they have basically more or less slightly distorted joints. I was able to fix that mostly by changing "bone roll".
Note, though, that I may be using the term here wrongly since Blender has a bone roll setting in armature edit mode where you can adjust the rotation of the bone around its axis. That is helpful in some cases but that's not what I mean, however.

But I think I can explain better with some pictures.

I used a CMU BVH here with a retargeted Makehuman CMU rig. It has the stereotypical upwards-angled shoulders and the bent head.

My suspicion was always that this not due to a faulty motion capture or a faulty rig but an incorrect translation of bone data. For example the RightShoulder and LeftShoulder bones are in my opinion both rotated approx. 30 degrees too much around the local Z-axis. (The upper arm bones follow that principle unfortunately and you have to adjust for that, too.)

Image

Nonetheless, you can do this quite efficiently in the animation tab's graph editor. Isolate the bone's Z-axis data in the editor window and look at the graph. At frame 0 you see the later added T-pose and it's obviously out of sync with the following data. Mark all keyframes except zero and bring them roughly in line with the T-pose's Z-data. Looks so much better now. You need to repeat this for the other shoulder bone and the upper arm bones but alas it's really not as clear what amount you need it to change.

My theory is that whoever converted the original motion capture data into these BHV's messed up when he later added the T-pose for compatibility reasons. I think Retarget BVH uses the "incorrect" T-pose in the first frame as a reference and applies its values to all the other frames, thus giving an incorrect result.
Maybe it would be a solution to get rid of the T-pose in the BVH's and then retarget the data without it.
I don't understand much of that, however, so I'm just speculating.


But wait? You work with a translator? For everything? I didn't notice that, at all.
twitter.com/ChristophCrane_ (Indie author & game developer)
User avatar
PayItForward
 
Posts: 22
Joined: Thu Nov 03, 2022 8:23 pm

Next

Return to MHX2 and other plugins developed outside MakeHuman

Who is online

Users browsing this forum: No registered users and 1 guest