Fbx importer

Updates and fixes to FBX loader:

  • Fix using AssetManager.loadModel() with .fbx file (previously, you should use SceneKey to load fbx model, now you can use any ModelKey, but model will be loaded without animations)
  • Added loader for new file format .fba which is text file format to wrap .fbx file and animations mapping, sample is:
#Use "#" at the start of line to add comments
#Fist not commented line is always model name, will be resolved from .fba file location
my_model.fbx
#All other lines are animations in format "<start frame> <end frame> <animation name> [layer name]", quote string if using spaces
0 40 run "BaseLayer"

You can load .fba simply buy using loadModel() function in AssetManager, all listed animations will be imported, so this is universal format with no special code needed.

Pull request: Fix and extend FBX file loader by Eirenliel Ā· Pull Request #169 Ā· jMonkeyEngine/jmonkeyengine Ā· GitHub

I guess, some one should integrate it into SDK ā€” i donā€™t know how it is working, but changing jme3-plugins lib in sdk is not working ā€” still canā€™t import fbx (still uses blender) or fba files.

Nobody is getting the current SDK updates or uses the SDK as it is in trunk anyway, no need to rush there. First some people can test the importer via the engine.

Awesome news! :slight_smile:

Hi all,

do this plugin import FBX animations too?

if so, can Iā€™ve a snippet of code to work with; Iā€™m evaluating the tool and I need just a starting point to work, nothing more than this.

Thank you so much guy.

Yes it does, but it is a bit tricky. You need to create file .fba with format i described 4 posts above, and simply load it as any other model by calling AssetManager.loadModel(ā€œpath/to/model.fbaā€).

Weā€™re girls, actually :wink:

1 Like
@Eirenliel said: Yes it does, but it is a bit tricky. You need to create file .fba with format i described 4 posts above, and simply load it as any other model by calling AssetManager.loadModel("path/to/model.fba").

Weā€™re girls, actually :wink:


By the way, have you heard about this project?

It converts FBX models to another format which is much easier to read. It does this via the official Autodesk FBX SDK. If youā€™re having issues loading some models, you can try to compare your results with this tool to see if thereā€™s any difference and why.

1 Like
@Momoko_Fan said: By the way, have you heard about this project? https://github.com/libgdx/fbx-conv

It converts FBX models to another format which is much easier to read. It does this via the official Autodesk FBX SDK. If youā€™re having issues loading some models, you can try to compare your results with this tool to see if thereā€™s any difference and why.


We are almost satisfied with export in YAML/JSON.

@Eirenliel said: We are almost satisfied with export in YAML/JSON.

You mean you are using that library or have something custom? The library looks pretty interesting.

@pspeed said: You mean you are using that library or have something custom? The library looks pretty interesting.
We are using simple converter from json to yaml to see structure and MAYA for testing. I think @tort32 will use more tools if required. Any way, we heard about that converter.

Hi,
I would just like to mention that the FBX importer is undergoing a lot of work at the moment. The objective is to be able to support all features exported by Blender. If Blender can export it, jME3 will support it.

The number of features and stability of the FBX content pipeline will be much greater than that of the existing OgreXML pipeline.

Originally this work was supposed to go into jME 3.2 but due to delays with the 3.1 release, this may end up falling into 3.1 instead. Weā€™ll seeā€¦

8 Likes

Hi there! Itā€™s been a while.

I have seen long ago some one refactored our FBX importer and even added few features it it. Itā€™s cool.

I have been working on our importer for past two years too and implemented, like, dozens of features and fixes, including animation support and stuffā€¦ So, i have been thinking to contribute all this changes, but the thing isā€¦ It is based on the old codeā€¦ I did a lot of refactoring, ofc, but itā€™s still have no common code with current FBX importer in JME, so the only way I can commit it is to replace our old code with new one, making it yet again second FBX importer in JMEā€¦ And it can go on foreverā€¦

Well, the question is pretty tough: what should I do?

I donā€™t even know, is this even needed to someone?

And I donā€™t know what features are present in the new importer, I added this in past two years:

  • Implemented support to up to 8 UV layers
  • Load face culling
  • Support of axis signs
  • Loading animations from FBX without any additional data (multiple animations can be loaded from different animation layers)
  • Implemented loading of per-polygon materials
  • A LOT OF FIXES
6 Likes

Very Cool
Great job . Thanks so much
Wish you can add it to JME soon . :grinning:

Please can we get this if proven to be a proper solution.

Thatā€™s great! I think we should add both importers and try to merge them, thus having the feature set combined. The importer which I wrote does not have skeletal animation support, and this is definitely the killer feature which is needed for our FBX import right now.

Cool. I will send pull request after I implement proper transformation loading and acquire some free time. Like, all that pre- and pos-rotations, it just happens to be very much required for me now and a total mess :frowning:

By the way, what features are supported in your importer that are not present in mine? I would love to ā€œstealā€ 'em :smiley: but itā€™s not easy to see them in the codeā€¦

4 Likes

Primarily I wanted to support loading models from Blender, so I try to support whatever Blender can export. Of course skeletal animation importing is not something I was able to get to work yetā€¦

1 Like

I donā€™t know which functions are supported in Blender \ o /

Iā€™m refactoring the code now, will post it soon. Got some hard time debugging animations~

1 Like

So, I made it. Here is the pull request: Reworked original FBX importer by Eirenliel Ā· Pull Request #488 Ā· jMonkeyEngine/jmonkeyengine Ā· GitHub

Changes from original version:

  • Load animations without any additional data (no SceneKeys or fba files) ā€” animations are loaded from separate animation layers (currently not supported by Maya)
  • Huge code refactoring. It is possible to work with now and add new features (looks like @shadowislord 's :))
  • Added support for not baked transformations (like pre/post-rotations/translation/scale and pivots), all euler rotation orders are implemented too
  • More accurate bone animation
  • Up to 8 UV-layers
  • ByPolygon material data is loaded correctly (without buffer overhead too)
  • Textures are loaded by name from the same folder, if present and no better way found
  • Added support of FaceCullMode.Off
  • Support of axis signs
  • Fixes, tons of them!

Important thing and potential problems:
Iā€™m working with very outdated JME version, so some things might have changed in current version and iā€™m doing them wrong (like Image creation, AlphaTesting etc).
I also use Trove collection to store most of importer data and have change them to JRE collections while transferring code, I hope i didnā€™t broke something on a way.
I canā€™t test it in JME, so please :3

(I will add a video showcase tomorrow, just for fun)

8 Likes

Oh wow canā€™t wait to test it! :smiley:
This would save so much time, effort, and open so many doors :chimpanzee_surprised: