Wrong vertices in Makehuman exported .babylon models when using rig -- only in babylon 4.x

I just recently have gotten around to updating my game client to babylon.js 4 from 3, which pretty much entailed only removing workarounds for bugs that are no longer there. Almost everything now works better than ever, except for the following:

We use MakeHuman for modelling NPCs. Our workflow is MakeHuman (set all parameters, add rig “default no toes”) -> mhx2 -> blender (2.79) -> .babylon (using 5.6.4 exporter).

In babylon.js 3 we could use the resulting model and everything worked perfectly, including animations.
In babylon 4 however, we have this problem:


(sorry the lighting isn’t that great, but the wrong vertices should be visible)

Some vertices are simply rendered wrong. The same models are rendered fine in babylon.js 3.

Any ideas what might be going on? This problem only applies to models created with MakeHuman that have a rig set (but of course I need a rig for skeletal animations).

Things I tried:

  • Disabling texture storage of bones in the inspector (no difference)
  • Using the newest exporter with blender 2.80 beta (I get a python exception saying there is no attribute depsgraph, probably a breaking API change that has not been dealt with yet)

Other possible causes/solutions:

  • on my system (not the newest), babylon.js 3 defaulted to WebGL 1, but 4 now uses WebGL 2
  • maybe using Tower of Babel might fix it (edit: but I’d have to retool my whole loading code, that’s why I’d like to avoid it)
  • or using gltf. With gltf export from blender 2.80, animations and vertices are exported correctly (in fact the animation autoplays, but there is probably a flag somewhere to disable that), but no materials are exported (do you have to change everything to gltf shaders/PBR manually, or is there some automated way to do that?).

I have attached all the relevant files so you can try it for yourself.

makehuman_problem.zip (2.8 MB)

I am pretty bad with authoring tools but I bet @JCPalmer could potentially help here. He is our blender master :slight_smile:

1 Like

Maybe @gryff or @Vinc3r can help as well

1 Like

@earthendev : I took a look at your file and it has 137 bones - which is a lot! The “default rig with no toes”, I believe

So, I created a basic figure in MH1.1 to match it, then tried exporting it fro Blender (v5.4.0) and I get this in the log file:

Skeleton stats:
WARNING: Maximum # of influencers exceeded for 226 vertices, extras ignored
Total Influencers: 42480
Avg # of influencers per vertex: 4.3798
Highest # of influencers observed: 11, num vertices with this: 226
exported as 8 influencers

That maybe is your problem. You could delete the Pelvis.L and Pelvis.R bones - and see what you get.

Those 226 vertices mentioned could be the ones going adrift.

cheers, gryff :slight_smile:

2 Likes

yep I saw this in the log file long ago but it never caused any problems until now. Good catch! Will try with the game engine rig or something like that tomorrow, see if it changes things.

wrt deleting the pelvis bones: I will try it but it’s definitely not a permanent solution because then I can’t animate the legs.

Is there any way I can keep the “default rig with no toes”? I’m asking because I already have several animations for that rig.

1 Like

Thanks for reporting this. I have been easily reproducing this on my own. @gryff is sort of right for the real answer. All those face & finger bones are a real drag & have no effect once exported.

What I have been doing is working with MH 1.3 Alpha, with the new MH Blender plugin, on Blender 2.80, exporting using the 6.0 exporter, and running on BJS 4.0. I was assuming the problem was prior to actually running.

@earthendev, Are you saying that the identical .babylon file worked prior to 4.0, & this is the only change to break it. if yes, @Deltakosh are there any behavioral changes to matrix weights that you know of for 4.0?

1 Like

It should not be. We did not change anything on that. Only difference regarding matrices is the use of a texture instead of uniforms to store them for shaders

1 Like

@gryff, JCPalmer:

I fixed it! It turns out you nudged me in the exact right direction. Apparently you can delete bones very easily without affecting any of the ones deeper in the “hierarchy” and without disturbing animations. So I just deleted the two pelvis bones, root, spine05 and the two breast bones. Removing only the pelvis bones did not fix the problem, but everything together did. I have to tweak my animations very slightly, but it’s definitely easier than starting from scratch.

Thank you!

@JCPalmer:

The face and finger bones are actually needed in my game because it’s an RPG and in dialogs you have facial expressions, gestures and the like. They are also useful for stuff like holding a sword and so on. I haven’t animated them yet. Will I run into engine limitations when I try this (b/c you wrote they will have no effect)?

What I have been doing is working with MH 1.3 Alpha, with the new MH Blender plugin, on Blender 2.80, exporting using the 6.0 exporter, and running on BJS 4.0. I was assuming the problem was prior to actually running.

Did I understand this correctly, that the new exporter also produces an output that triggers the glitch?

BTW: How do you run the 6.0 exporter with the latest beta of blender 2.8? For me it always errors out with this:

  File "/home/***/.config/blender/2.80/scripts/addons/babylon_js/json_exporter.py", line 111, in execute
    mesh = Mesh(object, scene, self)
  File "/home/***/.config/blender/2.80/scripts/addons/babylon_js/mesh.py", line 170, in __init__
    mesh = bpyMesh.to_mesh(bpy.context.depsgraph, True)
ERROR:  'Context' object has no attribute 'depsgraph'

@earthendev, Are you saying that the identical .babylon file worked prior to 4.0, & this is the only change to break it.

Yep, exactly.

@Deltakosh:

Is this the setting that can be toggled in the inspector for rigs? That makes no difference at all. The glitch is always there.

Thanks a lot to all!

Yeah, Blender made a last minute API change that ends up throwing an exception. If your 2.80 is too new, you are screwed for the short term, see https://forum.babylonjs.com/t/do-not-refresh-with-a-new-version-of-blender-2-80-yet/3421/3

I have already fixed this, but I have a number of changes for the next version already started, so 6.0 will never be patched, sorry.

While the file could be big, could you post the file .babylon file somewhere, which has the problem only in 4.0? No textures should be needed to see the problem.

There’s a good change the model I posted here exhibits the problem too, but I can’t test this at the moment. The glitches were very similar for all my models. I’d rather not post them in a public forum. I can send you a dropbox link or something by PM if you want.