FXyz icon indicating copy to clipboard operation
FXyz copied to clipboard

FBX importer with animations

Open nlisker opened this issue 4 years ago • 11 comments

I'm willing to start working on an FBX importer for models with animations. As a starting point, I want to use the non-animating models importer from https://github.com/tesis-dynaware/fbx-importer. I have a couple issues:

  1. That project relies on Java8 and uses javah which has since been removed. I'm having trouble updating the build file to be in line with FXyz's.
  2. There could be licensing issues with using the fbx-importer project or the FBX SDK that is used to read the FBX files. I would like to make sure we can actually bundle an FBX importer in this project.

If someone can resolve these, I could start with updating the code to add animations.

nlisker avatar Apr 20 '20 07:04 nlisker

With respect to (1), I think javah functionality is now part of javac:

javac -h . ClassWithNativeCode.java

I just recently had to use it to build some C++/Java hybrid code, so would be happy to help with the process (while it's still fresh in memory 😄 )

AlmasB avatar Jan 04 '21 18:01 AlmasB

If you look at the linked project, its build file uses javah to allow loading the JFbxLib dll in de.tesis.dynaware.javafx.graphics.importers.fbx.JFbxLib.. If we can get that working, I will write the interface methods and implement it.

nlisker avatar Jan 06 '21 00:01 nlisker

The .cpp is linked against:

"$(FBX_SDK_HOME)lib/vs2012/x64/release" /libpath:"$(WIN_SDK_HOME)Lib/x64" AdvAPI32.lib libfbxsdk-mt.lib

I've skimmed through the Windows FBX SDK config and I can see the libfbxsdk-mt.lib file. So, I might be able to build a .dll from JFbxLib.cpp / .java

Another comment: given JFbxLib.cpp / .java was built 7 years ago and that the latest FBX SDK is 2020.2, there might be some missing / updated API issues. Maybe not, but just thought to mention it.

There could be licensing issues with using the fbx-importer project or the FBX SDK that is used to read the FBX files. I would like to make sure we can actually bundle an FBX importer in this project.

I've done a quick scan and cannot find their license. From what I've seen on their forums and other projects' issue trackers, one needs to obtain permission in order to bundle the importer. I wonder if we can find some open-source 3D asset loaders, then simply convert into FXyz/JavaFX 3D domain objects.

AlmasB avatar Jan 06 '21 21:01 AlmasB

I've skimmed through the Windows FBX SDK config and I can see the libfbxsdk-mt.lib file. So, I might be able to build a .dll from JFbxLib.cpp / .java

Do we include the dll in FXyz, or do we require the user to install the SDKs locally and build the dll themselves?

Another comment: given JFbxLib.cpp / .java was built 7 years ago and that the latest FBX SDK is 2020.2, there might be some missing / updated API issues.

I think that the basic API of reading a mesh and animations did not change much at this point. I will bridge the gaps.

I wonder if we can find some open-source 3D asset loaders, then simply convert into FXyz/JavaFX 3D domain objects.

I don't understand this idea. Convert from what?

nlisker avatar Jan 07 '21 12:01 nlisker

Yes we include our .dll with FXyz. As for their (FBX) .dll, this is where license comes in I think. If we ask users to download from the official site, then we should be fine. No building should be necessary from user side.

Re: open source loaders. I assume each loader loads into its own Vertex class or some other domain type. Then we could use their type and populate our own Mesh /MeshView data. Just a thought, I don't actually know of any open source 3D asset loaders in java, but pretty sure a few exist (maybe not FBX though).

On Thu, 7 Jan 2021, 12:16 pm nlisker, [email protected] wrote:

I've skimmed through the Windows FBX SDK config and I can see the libfbxsdk-mt.lib file. So, I might be able to build a .dll from JFbxLib.cpp / .java

Do we include the dll in FXyz, or do we require the user to install the SDKs locally and build the dll themselves?

Another comment: given JFbxLib.cpp / .java was built 7 years ago and that the latest FBX SDK is 2020.2, there might be some missing / updated API issues.

I think that the basic API of reading a mesh and animations did not change much at this point. I will bridge the gaps.

I wonder if we can find some open-source 3D asset loaders, then simply convert into FXyz/JavaFX 3D domain objects.

I don't understand this idea. Convert from what?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FXyz/FXyz/issues/106#issuecomment-756081338, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3NT5Q6T2FJLRLI23HI3ATSYWQYBANCNFSM4MMGOUXA .

AlmasB avatar Jan 07 '21 12:01 AlmasB

Re: open source loaders.

Oh, that's an idea. It implies that we need 2 steps conversion, but I assume we could slowly replace the original code with JavaFX code. I did a quick search:

nlisker avatar Jan 07 '21 13:01 nlisker

Has any progress been made on this? An FBX importer with animations is exactly what my project needs. I would like to import an animation where I can access (stop/start) the timeline. I know that this is possible with the .ma format, but as we work in Blender and don’t have a Maya license, that format is not accessible to us.

meghanEmbrace avatar Mar 25 '24 05:03 meghanEmbrace

No, the licensing issue is what I'm personally worried about here since the FBX format is proprietary.

The technical side has become easier now with JDK 22 where the FFM API has been released.

nlisker avatar Mar 25 '24 14:03 nlisker

As an alternative solution, could we explore supporting GLTF, which is similar to FBX but doesn't have the same licensing restrictions? We aim to utilize animations exported from Blender and import them as usable models in our application, enabling functionalities such as starting and stopping the animations.

meghanEmbrace avatar Mar 26 '24 13:03 meghanEmbrace

A google search shows that such attempts have been made already, like in https://github.com/NekoLvds/GLTFImporter and https://github.com/javagl/JglTF.

The difficulty in importers is managing the conversion between the format's data types and the language's/library's data types. Starting and stopping animations are already built into JavaFX, so it's not a functionality someone needs to support, it's already there.

In general, the more formats we can support, the better. It's just a lot of work to do and JavaFX can't support everything a format specifies because it's not a specialized 3D library, which requires figuring out how to best represent what the format specifies.

nlisker avatar Mar 26 '24 15:03 nlisker

I agree and understand. I was hoping for a solution where we could find a format that supports animation without being blocked by a hefty licensing fee. Most formats can be converted, so if just one animation format is not blocked by a licensing wall, files could then, be converted when necessary. In the meantime, I will explore the resources you suggested. Thanks.

meghanEmbrace avatar Mar 27 '24 05:03 meghanEmbrace