Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBX Importer fixes and updates #591

Closed
wants to merge 3 commits into from

Conversation

Eirenliel
Copy link
Contributor

Here is the original topic: https://hub.jmonkeyengine.org/t/fbx-importer/30309

Changes:

  • Added support of FBX 2016-17 (7.5)
  • Fixed rotation orders (reverse the order, use only for Lcl Rotation)
  • Fixed animations transformation (proper conversion from parent space to bone space, proper use of rotation order and other transforms)
  • Implemented Segment Scale Compensate property from Maya (most cases) aka InheritType
  • Implemented loading bind pose from frame 0
  • Properly load all animations from animation layers
  • Reworked units size (still no program uses it properly to test)
  • Tons of testing with animations and different models

- Fixed rotation orders (reverse the order, use only for Lcl Rotation)
- Fixed animations transformation (proper conversion from parent space
to bone space, proper use of rotation order and other transforms)
- Implemented Segment Scale Compensate property from Maya (most cases)
aka InheritType
- Implemented loading bind pose from frame 0
- Properly load all animations from animation layers
- Reworked units size (still no program uses it properly to test)
@JavaSaBr
Copy link
Contributor

JavaSaBr commented Jan 2, 2017

Cool!

@Ali-RS
Copy link
Member

Ali-RS commented Jan 2, 2017

Awesome 😃

@bensku
Copy link

bensku commented Jan 3, 2017

Awesome!

Is FBA still needed for animations?

@empirephoenix
Copy link
Contributor

Does anyone of you uses FBX, and can validate that it does not break existing stuff badly? Since I'm not using FBX, I'm a bit carefull with directly merging it.

@Eirenliel
Copy link
Contributor Author

@bensku no, it's not since previous version

@bensku
Copy link

bensku commented Jan 4, 2017

Oh. Didn't notice that. Very good!

@bensku
Copy link

bensku commented Jan 5, 2017

java.lang.NullPointerException
at com.jme3.scene.plugins.fbx.mesh.FbxMesh.applyCluster(FbxMesh.java:127)
at com.jme3.scene.plugins.fbx.mesh.FbxMesh.toJmeObject(FbxMesh.java:213)
at com.jme3.scene.plugins.fbx.mesh.FbxMesh.toJmeObject(FbxMesh.java:58)
at com.jme3.scene.plugins.fbx.obj.FbxObject.getJmeObject(FbxObject.java:113)
at com.jme3.scene.plugins.fbx.node.FbxNode.toJmeObject(FbxNode.java:399)
at com.jme3.scene.plugins.fbx.node.FbxNode.toJmeObject(FbxNode.java:71)
at com.jme3.scene.plugins.fbx.obj.FbxObject.getJmeObject(FbxObject.java:113)
at com.jme3.scene.plugins.fbx.node.FbxNode.createScene(FbxNode.java:496)
at com.jme3.scene.plugins.fbx.node.FbxNode.createScene(FbxNode.java:503)
at com.jme3.scene.plugins.fbx.node.FbxNode.createScene(FbxNode.java:503)
at com.jme3.scene.plugins.fbx.node.FbxNode.createScene(FbxNode.java:503)
at com.jme3.scene.plugins.fbx.FbxLoader.constructSceneGraph(FbxLoader.java:406)
at com.jme3.scene.plugins.fbx.FbxLoader.load(FbxLoader.java:126)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:416)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:420)
<redacted my application's stack trace>
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:251)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:281)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:236)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:193)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
at java.lang.Thread.run(Thread.java:745)

This happens when trying to load one rather complex scene exporter from Blender 2.7.8. It happens with older version too, though.

@Eirenliel
Copy link
Contributor Author

Eirenliel commented Jan 5, 2017 via email

@Eirenliel
Copy link
Contributor Author

Eirenliel commented Jan 5, 2017

@bensku you're testing the wrong importer ;)
This patch is about com.jme3.scene.plugins.fbx.SceneLoader

@bensku
Copy link

bensku commented Jan 6, 2017

Oh, that explains a lot :) No wonder why it didn't work...

I guess I need to register SceneLoader to be associated with FBX manually.

@Eirenliel
Copy link
Contributor Author

@bensku you can just edit Desktop.cfg

@JavaSaBr
Copy link
Contributor

JavaSaBr commented Feb 2, 2017

Are you going to merge it? :)

@Nehon
Copy link
Contributor

Nehon commented Feb 2, 2017

@shadowislord Could you review this?

@Ali-RS
Copy link
Member

Ali-RS commented Feb 2, 2017

Yesterday I grabbed a few fbx model, I want to test this new fbx loader.
A bit hard to copy paste the code from here to my fork, so will appreciate you if you can merge this commit into a temporary branch (like NewFBXLoader) so I can build from it locally.
Thanks

@empirephoenix
Copy link
Contributor

You can just clone https://github.com/Heatherglade/jmonkeyengine (see the line with the link above the all checks passed)

@Nehon
Copy link
Contributor

Nehon commented Feb 2, 2017

A pull request is essentially a branch, you just have to pull it
https://help.github.com/articles/checking-out-pull-requests-locally/

@empirephoenix
Copy link
Contributor

So nay news on testing this?

@Ali-RS
Copy link
Member

Ali-RS commented Apr 4, 2017

Sorry for late reply
Finally I found some time to test new fbx loader.
I tested an animated fbx model which exported from blender. (fbx binary 7400 version) but the animation was broken. (the animation was stretched on arms and legs).
I do not use Maya, so I could not test it.
@Eirenliel have you tried an fbx model exported from blender ?

@Eirenliel
Copy link
Contributor Author

@Ali-RS we are not working with Blender, we are working with Maya. I also do know that some stuff Blender imports from FBX wrong, but not necessary this case.

We recently made another giant update for FBX importer, i will share it a bit later, so this pull request can be just closed. Also can you send the file you are talking about for us to test in the new version?

@empirephoenix
Copy link
Contributor

Ok, closed as per request, 👍 for next request :)

@Ali-RS
Copy link
Member

Ali-RS commented Apr 6, 2017

Also can you send the file you are talking about for us to test in the new version?

Yes, you can get it here :
https://drive.google.com/open?id=0B35eWZpi0dBoZmtwNjdRUGp6Skk

@Ali-RS
Copy link
Member

Ali-RS commented Apr 6, 2017

Also, what bone rotation mode does your fbx loader support ?
Quaternion(WXYZ) or XYZ Euler or ... ?

@Eirenliel
Copy link
Contributor Author

@Ali-RS i've never seen quaternion rotation in real files, so i don't think it supports it now. I will check the provided file.

@Ali-RS
Copy link
Member

Ali-RS commented Apr 7, 2017

Okay.
Can you please test these two fbx files also : https://drive.google.com/open?id=0B35eWZpi0dBoVTZ1MlVBTTZpaUE

I have followed this tutorial for exporting them from blender : http://digitalrune.github.io/DigitalRune-Documentation/html/6f749972-9cb2-4274-b283-c327ba45e379.htm
in one of them i enabled !EXPERIMENTAL! Apply Transform when exporting and in the other one not.
I am getting diffrent result for each one in jme.
I hope they play fine in your code :)
Thanks so much

@Eirenliel
Copy link
Contributor Author

@Ali-RS all of this files have problems when importing. We will see why when we have time, thanks :)

@Ali-RS
Copy link
Member

Ali-RS commented Apr 7, 2017

Thank you.

@the-brickster
Copy link

@Eirenliel I seem to be getting an issue with the animations not playing properly, I have a model created in MayaLT with a walk animation.
Here it is in MayaLT:
mayawalk_2017_05_08_14 37 18

When I import the model with Jmonkey I get the following:
jmonkey_2017_05_08_14 37 22

Here is the model in question:
https://drive.google.com/file/d/0B24ekh4abl8CTEhYeVFmZDZfTWM/view?usp=sharing

@Eirenliel
Copy link
Contributor Author

@deltasquad451 thank you, we will test it. We are working on fixing importer for our game on a daily basis, but it's an active development, so i don't know when we will be ready and have time to try to move it to JME, but it will happen any time soon :)

@Pilvinen
Copy link

@Eirenliel Any news on the above with deltasquad451? This is currently a major blocker for our project and has been for quite some time. We were already considering switching to Unity because we haven't found a way to get our models working. But we really don't want to do that if there's a possibility to get things working.

@JavaSaBr
Copy link
Contributor

@Pilvinen I think you can open .fbx in Blender and then save it like a .xbuf file which has good support from jME :)
https://github.com/xbuf/xbuf
.xbuf have no problems with animation on jME.

@Eirenliel
Copy link
Contributor Author

@Pilvinen sorry we currently can't make necessary checks and prepare commits in jME.

@Pilvinen
Copy link

Pilvinen commented Jul 12, 2017

@JavaSaBr Unfortunately it's not possible. Blender messes up the rig on import when importing FBX. The FBX support in Blender is horribly outdated and buggy. And on the other hand Maya LT doesn't support exporting as .xbuf AFAIK. But thanks for the tip anyway.

@Eirenliel Give me an estimate so I can make educated decision where to take my project to which I've invested considerable amount of time and money. 1 months, 2 months, 4 months, 6 months, 12 months, 24 months, never?

@JavaSaBr
Copy link
Contributor

@Pilvinen do you think we have no any format which has good support for both programs?

@Pilvinen
Copy link

Pilvinen commented Jul 12, 2017

@JavaSaBr Unfortunately Maya LT supports only .OBJ, .FBX and .mayaLT. It's Autodesk's way of saying "screw you" to indie developers who can't afford Maya full.

.blend support is good in Jmonkey but this whole Maya <--> Blender and Jmonkey <--> Maya inoperability has really screwed us over. We've tried all kinds of magic tricks for several months and we simply don't have a way to get our rigged and animated models to Jmonkey.

Had we known this would be such an huge issue from the start we might have chosen differently, but we're now one year into development and frankly I'm at the end of my wits with this issue.

FBX in a very unfortunate closed format industry standard - but the situation is what it is. Most of the animators out there use Maya or some other Autodesk product - and you guessed it - they all export FBX. Importing to Blender is a no-go otherwise we would simply do it like that and export .blend from Blender.

I don't know what to do.

EDIT:
The only thing I want to do is to get a pipeline, any pipeline, working which would allow us to:

  1. Make 3D models with Maya LT and Blender
  2. Make animations in Maya LT
  3. Export FBX from Maya LT
  4. ???
  5. Import to Jmonkey

@JavaSaBr
Copy link
Contributor

@JavaSaBr
Copy link
Contributor

@the-brickster
Copy link

@JavaSaBr Does the Bos FBX support animations though?

@JavaSaBr
Copy link
Contributor

@deltasquad451 I don't know

@Pilvinen
Copy link

@JavaSaBr This happens with Blender. Unfortunately it's not only the mesh but as you can see the bones are all messed up too, scale and everything. It's hopeless.

@deltasquad451 did play around with BOS FBX but was unable to get it working with that either. It was some time ago so I can't remember all the details of what happened.

Growlybearproductions link I haven't seen before but it seems he only had problems with the mesh orientation and scale - and if you take a look at the screenshot I provided from my Blender FBX import adventures you can see it's hopelessly messed up and not just rotation and scale issue. The animation is there but it's... very funky.

@JavaSaBr
Copy link
Contributor

@Perjin my artist who works in Blender have advice:
https://help.sketchfab.com/hc/en-us/articles/206223646-Blender-Animation#fbx

@Eirenliel
Copy link
Contributor Author

@Pilvinen again all i can say is sorry, we are pretty swamped right now and if i try to give any estimate on plans, it might be wrong by any magnitude...

@Eirenliel
Copy link
Contributor Author

@Pilvinen but i tested the file you send and it does have some issues with animation. Sadly, we have no time to investigate it further :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants