Menu

#458 Incorrect handedness on B3D models

current stable SDK
open
nobody
None
4
2022-10-12
2022-10-10
viwrap
No

B3D models are imported with their bones mirrored. Although animations work, attaching a node to a bone on a B3D model mirrors it.

Reproduction is easy:
Export a B3D model from any capable software, load it into Irrlicht, then attach a node to any animated bone.

Discussion

  • Michael Zeilfelder

    I tried with ninja.b3d from Irrlicht media folder anad getJointNode(1).
    Setting that as parent to another node did not cause any mirroring.
    So please post a model like that and give me the bone id which goes wrong. Then I can debug if it's a problem with the model or if there is some other reason.

    Also Irrlicht svn trunk added recently (~2 weeks ago) a new function setUpdateAbsolutePosBehavior to ISceneNode. Setting that to ESNUA_TRANSFORM_POSITION will allow you to attach nodes which only use the transformed position of parent nodes but ignores any transformations. Which can be pretty useful for such situations.

     
  • viwrap

    viwrap - 2022-10-11

    Hey, I tried with that patch you've described, it didn't to much if not nothing in my case... sorry!
    Here's the model I'm testing with.

    In my app I simply mount cubes generated with ISceneManager::addCubeSceneNode on every bone, and it very noticeably mirrors the skeleton starting from the hip level.

     
  • Michael Zeilfelder

    I see - not the attached node is mirrored, but the positions themself (in which case my patch can't help).
    But the model is animated correctly (I assume), so the bone positions shouldn't be wrong. It's like the skeleton and the model are not above each other. Which could be the case if you have some transformation going on in the modeling tool (thought very unusual).
    I just tried the same with the ninja model from Irrlicht and all bones there are fine and as expected.
    Which tool are you using? And any chance to see the original model (I can't help if it's Max or Maya, but with Blender I could check the .blend file).

     
  • viwrap

    viwrap - 2022-10-11

    I did try with the ninja.b3d model, it does animate bones and attachments correctly.... but not my models!

    I do use Blender fortunately, here's the 2.79b blend file (art assets not packed in, might appear pink but everything else, including the animation, is there):

     
  • Michael Zeilfelder

    Thanks, looks indeed good in Blender. Can you also tell me which exporter you are using? Maybe some link or maybe you can even copy it here. Sadly my last link with a working b3d exporter for Blender > 2.5 is no longer working (older SuperTuxCart had one...).

     
  • viwrap

    viwrap - 2022-10-11

    Sure, this is what i'm using to export those .b3d models on 2.79b

     
  • Michael Zeilfelder

    Thanks again. Somehow not the exact same results when I export it (even different number of joints), but I can still reproduce it.

    Haven't found the reason yet, but looks like an Irrlicht problem. The absolute transformations are correct . node->setDebugDataVisible(scene::EDS_SKELETON) shows it for example. But relative transformations are messed up for some reason. Which is strange as absolute transformations are calculated from relative ones - so maybe something like a corner case for CMatrix4<t>::getRotationDegrees instead.</t>

    But my suspects so far all turned out to be wrong, so can't tell yet what's going on. Bone hierarchy is rather deep (something like 7 bones involved to calculate one of those going wrong), so slightly hard to debug. I'll have to see if I can simplify it a bit.

     
  • Michael Zeilfelder

    r6438 has a fix which seems to work for your case. Things might get rewritten again if I find some time as I didn't really find the real reason for the bug yet (just avoided it for now, thought the new solution would be faster, so hopefully can keep it). So keeping bug a bit longer open.

     
  • viwrap

    viwrap - 2022-10-12

    Thank you so much for your time, I will try this patch later today!

     
  • viwrap

    viwrap - 2022-10-12

    Seems to work like a charm!!! Both ninja.b3d and my models work, thank you!

     
  • Michael Zeilfelder

    No problem. I'm glad I got a working export solution for animations from Blender again. I used GaNDaLDF's script in Blender 2.49 and even had modified it a bit back then to split model and animation export, but never updated it when the 2.5 interface broke it. Thought I guess it'll need another update for Blender 3. Plus another nice test model :)

    Well, still trying to find out what actually caused the bug, might have another problem hidden there.

     

Log in to post a comment.