简体   繁体   中英

Importing animated 3D models in JavaFX

I am currently working on creating a 3D scene using JavaFX. In the scene I would like to show some more complex 3D models. I, therefore, used the InteractiveMesh importers for importing some OBJ/STL models, which worked fine. I would also like to include an animated model (walk cycle). I found the JavaFX sample application 3DViewer which includes a Maya-Importer. As I am not that familiar with Maya and 3D modelling in general I tried to find some free models, which are animated or at least rigged, online. Unfortunately, I could not find a single model, neither suitable for creating an animated walk cycle (rigged) nor already animated, I could successfully open in 3DViewer. The import usually fails due to Nullpointer- or IndexOutOfBoundsExceptions while loading the Maya model.

I am now wondering if somebody has already managed to open an animated Maya model in 3DViewer? I highly appreciate references to models, which can successfully be imported.

Additionally, are there other ways of importing animated 3D models (not necessarily Maya models) into JavaFX?

You can have a look at this project: https://github.com/jperedadnr/RiggedHand

It is not exactly doing what you want (import an animated 3D model), but it manages to animate a given 3D model, in this case using Leap Motion.

You can have a look at the result on this video .

If you check HandImporter class, it is based in the creation of a SkinningMesh , as it is defined under the 3DViewer project you already mentioned. This will contain the 3D mesh for the hand, the weights and the tree of joints.

RiggedHand

This is the same technic as the one used for the Duke chess animation :

RiggedDuke

Additionally, are there other ways of importing animated 3D models (not necessarily Maya models) into JavaFX?

and the bounty's

I would like to see a solution for importing any readied animated 3D model into JavaFX.

It appears that the 3D viewer 's support for .ma files is the only readily available way to import 3D animated models.

InteractiveMesh's importers do not import animation, as well as Tesis Dynaware's FBX importer .

Edit:

OpenJDK lists that it will not provide importers:

Loader support

  • Many 3D file formats exist, such as:
    • Obj, Maya, 3D Studio Max, Collada, KRML
  • We will not provide a loader as part of the JavaFX runtime
  • We will make sample code available for one or two popular formats

See the comments there as well as this enhancement request .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM