Loading animated models with Assimp

Started by atom, August 24, 2017, 11:19:46

Previous topic - Next topic

atom

Hello,

I have a simple blender model, a human body, i rigged it, and animated it (a bit). My goal is to import that model, with its actions into my game engine, and later to write my own binary asset format.

Right now i need to find a proper workflow to be able to manage blender models with skeletal animation.

If i export my model from blender to collada, the mesh is ok, but the animation is not (my 60 frames test action in blender becomes a 3 frames animation), and the action name disapears (seems to be a blender collada export bug), so collada isn't suitable for my purpose.

If i export my model from blender to fbx, the animation is ok, the names are ok, but the mesh isn't, all my bones seem to root at the same point (well, not all, the torso and head bones seem ok, but arms, legs and their children aren't). If i use a much simpler model, say a cube with a spike on its top, rig it with a root bone and a spike bone, animate it, everything is ok, so i think there may be a problem with my way of managing bones while importing the fbx.

If i try to import the blender file directly, actions aren't imported at all (or not properly, still not sure right now).

So, what should be the proper way of doing that? I think the best of the best would be to be able to use the blender files directly, and build my own format with that, but maybe i should stick to fbx which gives me the best results for now (and would allow people not using blender, but cinema4D or whatever to make assets for my engine)?

Here is a picture of my model (and my beautiful green clear color :) ) to describe my problem, left is collada, right is fbx.

spasi

It's hard to be helpful on such issues, the problem could be anywhere in the pipeline from Blender to vertex shader.

I just wanted to share something I was reading earlier: OpenGEX comparison. There's a Blender plugin for it and Assimp seems to support it.

atom

Thanks for your answer. ogex seems very promising.

For now Assimp says it has partial support and through lwjgl, i have an error, with vm crash and coredump :

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.system.JNI.invokePP(JJI)J+0
j  org.lwjgl.assimp.Assimp.naiImportFile(JI)J+7
j  org.lwjgl.assimp.Assimp.aiImportFile(Ljava/lang/CharSequence;I)Lorg/lwjgl/assimp/AIScene;+22


(with lwjgl 3.1.2, maybe i'll try the nightly build later)

spasi

Could you please share an MVCE and the full crash log?

atom

import static org.lwjgl.assimp.Assimp.aiImportFile;

public class Crash {

	public static void main(String[] args) {
            aiImportFile("models/Puppet/Puppet.ogex", 0);
	}

}


and the crash log

The same code with Puppet.dae (same blender model exported in collada) returns no error.

spasi

It crashes in Assimp, so indeed, its OpenGEX support is incomplete. Looks like Assimp 4.1 will do better.

atom

I found some kind of workaround to be able to use collada. As i don't want to interpolate between keyframes myself, i have to bake animations into blender. But the names of the actions still disapear, so i bake all my actions into one animation and use only the frames i want in lwjgl.

I'll look into ogex when assimp is upgraded :)