Fbx importer

Hi! We are currently finishing binary fbx importer for our project (will finish in few days), and we want to share our code with jME community (as far as i know, no one succeeded before), but your contribution guides is not enough clear to understand what we should do.

Few questions:

  • There are two people working on it, can we contribute in two or three commits?
  • Should we put importer in jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx? (we have other code structure, and i’m not familiar with right ways to do it)
  • Importer supports most of fbx features (i could post list when it’s done), but it is very complex format, so we can’t make support for all its functions. If it won’t be full, is it ok? As i can see, ogre importer is not full too.
  • Could we add it to default Desktop.cfg configuration for asset manager?

Sorry, if i’m doing it all wrong, just tell me, i’ll fix :slight_smile:

13 Likes

Pretty cool, that’s a most wanted feature!! Of course it’s ok if it’s not complete, as long as it loads a subset of models.
You can do a pull request on github Pull requests · jMonkeyEngine/jmonkeyengine · GitHub. The package and folder are ok (except the last folder should be fbx not jbx but I guess that’s a typo)
And yes add it to the Desktop.cfg.
Really looking forward to this contribution, thanks a lot.

1 Like

Thanks! There lot typos in post as english is not my native lang and i cant edit my post.

yeah buggy forum is bugged…
Here, this should help http://hub.jmonkeyengine.org/forum/topic/fbx-importer/edit/

1 Like

Cool. Does it support more features than the current fbx importer in the SDK (which uses blender)? Like animation?

I have not seen any importers in SDK which could load fbx. May be i have old SDK. Any way, our importer does support animation (at least, it will in few days, now it loads skeleton without animation).

@normen said: Cool. Does it support more features than the current fbx importer in the SDK (which uses blender)? Like animation?
I see, it uses blender with python scripts. Sorry, I'm not familiar with this way and don't know, what features it have. I just know that our parser is written in pure java without any third programs or SDKs.
@Eirenliel said: I see, it uses blender with python scripts. Sorry, I'm not familiar with this way and don't know, what features it have. I just know that our parser is written in pure java without any third programs or SDKs.

Well fbx still has the same limitations as any external format so using it in the distribution games still is the same two-edged sword. Even with the fbx importer I’d still suggest converting the models during development in the SDK, not on the users machine.

And re: the blender importer supports only basic meshes, no animation, thats why I was asking for that specifically.

Hm cool this might make loading fbx way easier as blender is not good in that aspect.

This is a feature I also have been waiting for, for a long time now.
Good job and I can’t wait to see it in action.

=D

@normen said: Well fbx still has the same limitations as any external format so using it in the distribution games still is the same two-edged sword. Even with the fbx importer I'd still suggest converting the models during development in the SDK, not on the users machine.
I know. Actually, we are writing converter for our project, but it loads model before converting :)

We just can’t force our artists to use some bad ways as converting their files through third tools before importing models, and we want to give easy way for players to import their models in game using most popular format.

So it doesn’t support animation?

@normen said: So it doesn't support animation?
I already answered: it does support skeletal animation (at least, it will support today or tomorrow, as we are finishing it).
@Eirenliel said: I already answered: it does support skeletal animation (at least, it will support today or tomorrow, as we are finishing it).

Ah, thanks, didn’t see that first one of the double-post. You can import fbx in the SDK just by using the importer an selecting a fbx file… Or by double-clicking it in the assets folder.

blender fbx importer now supports animation. But it’s still WIP.

Hi folks,
I’m actually the person who implements fbx loader for JME. And I got hopeful update :roll: Here the list of fbx loader features:

We try to focus on latest version 7.3 or even 7.4 ( = FBX 2013/2014).
Load multiple meshes with normals, tangents, binormals and a single uv textcoords.
Multiple vertex mapping supported (ByVertice and ByPolygonVertex for normals/tangents/binormals, IndexToDirect reference mapping for UV textcoords).
Edges and smoothing are ignoring for now cause normals are presented by vertex (not faces).
But it can be required to build sharpen edges (set different normals directions for the same source vertex). This feature is not supported for now.
Multiple materials per mesh is not supported (you have to split the mesh in this case).
Vertex indexing supports triangles and quads. But not mixed polygons (use triangulate option at export in this case).
Nested nodes are supported but not tested so can be buggy. Also binding poses are applied to scene nodes.
Materials supports Ambient, Diffuse and Specular (with Power = Glossiness = Shininess exponent) colors.
Diffuse and Specular can be overridden by textures. Also NormalMap texture (in tangent space) is supported. Diffuse alpha channel can be used as Opacity map.
External textures are loading from by absolute or relative path. Loading textures from embedded content (byte stream inside FBX file) is also supported.
Light and cameras are not loaded. Don’t forget to add some lights after loading since ‘Common/MatDefs/Light/Lighting.j3md’ is used for material shading.
Skeleton (limb joints) supports up to 256 or no more than 128 bones. There is still indexing by signed byte issue in SkeletonControl.applySkinningTangents :stuck_out_tongue_winking_eye:
Skinning data (Deformers) is supported but limited by 4 bone per vertex influence.
Animation curves is supported for bones Translation, Rotation, Scale vectors.
To access skeletal animation via AnimControl some data (animation name, and start/end frames) should be passed into custom AssetKey used by FBX loader.
Multiple animation intervals can be cut from the source scene. In the case of multiple animation layers, source layer name can be defined for this data as well.
Animation curves keyframes should be time aligned ( = have the same set of keyframes) for all animated components of bone (Translation/Rotation/Scale).
So animation baking is optional but presents only linear interpolation of a curve. So use baking to minimize error tolerance.

I guess we will make pull request soon. After get rid from our project specific containers in the loader sources.

And I want to thanks Blender Foundation for this article http://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure
This investigation results really helps me with some intricated stuff :slight_smile:

6 Likes

@tort32, do not rush, we’ve got some more things to do :wink:

@tort32 said: There is still indexing by signed byte issue in SkeletonControl.applySkinningTangents ;-P Skinning data (Deformers) is supported but limited by 4 bone per vertex influence.
Not sure what the issue is, but maybe I can help on that, what's the exact error?

OK we talked about the issue and it appears this had been fixed in applySkinning but not in applySkinningTangents
I committed a fix Fixed issue in SkeletonControl applySkinningTangents where weight dat… · jMonkeyEngine/[email protected] · GitHub

Pull request ready: Implemented FBX model loader by Eirenliel · Pull Request #167 · jMonkeyEngine/jmonkeyengine · GitHub
It can be not formatted as other jme code or can be incompatibles with java 1.5 or 1.6, please check if it is important.

We will update importer if implemented new features.

1 Like