Hello Guest

Loading animated models with Assimp

  • 6 Replies
  • 5797 Views
*

Offline atom

  • *
  • 10
Loading animated models with Assimp
« on: August 24, 2017, 11:19:46 »
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.

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: Loading animated models with Assimp
« Reply #1 on: August 24, 2017, 11:45:15 »
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.

*

Offline atom

  • *
  • 10
Re: Loading animated models with Assimp
« Reply #2 on: August 25, 2017, 07:26:19 »
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 :

Code: [Select]
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)

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: Loading animated models with Assimp
« Reply #3 on: August 25, 2017, 14:18:33 »
Could you please share an MVCE and the full crash log?

*

Offline atom

  • *
  • 10
Re: Loading animated models with Assimp
« Reply #4 on: August 27, 2017, 15:58:40 »
Code: [Select]
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.

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: Loading animated models with Assimp
« Reply #5 on: August 27, 2017, 16:10:29 »
It crashes in Assimp, so indeed, its OpenGEX support is incomplete. Looks like Assimp 4.1 will do better.

*

Offline atom

  • *
  • 10
Re: Loading animated models with Assimp
« Reply #6 on: September 02, 2017, 08:29:27 »
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 :)