Vlog 02: FbxLoader Fixes: Mixamo models now loading in jME!
Hello everyone, I had an old score to settle with jME’s FbxLoader and wanted to figure out the bug that was preventing Adobe Mixamo models from loading. Unfortunately, when curiosity hits me, I have to go all the way. So I thought: there are plenty of online FBX viewers—why not see if I could fix it for jME too?
We live in interesting times for technology, and tools to inspect software are plentiful. After tons of debug prints and measurements of values and rotation angles, I finally pinpointed the problem.
The minimum goal was to load as many Mixamo models as possible and partially “even the score” with Unity, so that demo prototyping and animations could happen without relying on Blender or other converters. It’s worth noting that Mixamo provides almost exclusively 3D models in .fbx format and is widely used for creating character rigs and skeletons, making proper support crucial for animations.
The only “limitation” is that jME’s current FbxLoader uses the old animation system and legacy lighting/shading. With some time and patience, I might find a solution for that too.
For now, I’m enjoying a small victory:
Note: Interestingly, on the ZombieGirl model, FbxLoader even handles material transparency better than the glTF loader.
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
rootNode.addLight(dl);
rootNode.addLight(new AmbientLight());
assetManager.registerLoader(FbxLoader.class, "fbx");
ModelKey key = new ModelKey("Models/Mixamo/Swat.fbx");
model = assetManager.loadModel(key);
// AnimMigrationUtils.migrate(model);
FbxModelCorrector.centerSkeletonRoot(model);
model.setLocalScale(0.01f);
rootNode.attachChild(model);
// AnimComposer animComposer = model.getControl(AnimComposer.class);
// animComposer.setCurrentAction("mixamo.com");
AnimControl animControl = model.getControl(AnimControl.class);
animControl.getAnimationNames().forEach(System.out::println);
AnimChannel channel = animControl.createChannel();
channel.setAnim("mixamo.com");
channel.setLoopMode(LoopMode.Loop);
SkeletonControl skControl = model.getControl(SkeletonControl.class);
SkeletonDebugger debugger = new SkeletonDebugger("debug", skControl.getSkeleton());
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.getAdditionalRenderState().setWireframe(true);
mat.getAdditionalRenderState().setDepthTest(false);
mat.setColor("Color", ColorRGBA.Green);
debugger.setMaterial(mat);
((Node) model).attachChild(debugger);
Edit: Note: If you missed my previous vlog about particles, you can find it here (link), or just search for “Vlog 0”
Discussion in the ATmosphere