Skip to content

jMonkeyEngine SDK: Importing and Viewing Models

For new projects, export and import glTF models directly in Java with AssetManager. The optional SDK can also preview supported models and convert them to .j3o; conversion is not required to use glTF.

The following SDK-specific reference describes its model viewer and conversion workflow. When packaging assets, verify model paths and accompanying textures.

Using the model files directly

jmonkeyplatform-docu-2.png

  1. Create a separate folder for each model in the assets folder of your project.

  2. Export the model created in Blender to the asset folder of your project,

  3. Make sure all textures used in the .blend file are in the assets folder of the project.

  4. Double-click the model or right-click and select “Convert to JME binary” from the context-menu.

  5. In the Projects Explorer Assets node you should see your model j3o file.

  6. Double-click it to view it in the SceneViewer.

  7. Click on the lightbulb to turn on the light if you cannot see your model.

Note

It is important that you export the model file and its textures to the correct assets folder before creating the j3o file because the paths for textures (and possibly other things) will be stored as absolute (to the assets folder root) when you convert that model. This means the texture location should not change after the import.

Note

If the SceneViewer doesn’t work refer to Troubleshooting jMonkeyEngine3 SDK.

Working With a Model

  • Open Windows``SceneExplorer to view sub-nodes of the model.

  • Open Windows``Properties to view the properties of the model’s nodes.

  • Click the cube button in the SceneViewer to toggle between Wireframe mode and Textured mode.

  • Click the lightbulb to view Materials that require a light source

Notes About Model Assets

The SDK can convert imported models to .j3o. When using that workflow, verify which source files and textures are included in the packaged assets. Current projects generated by the Initializer can also package and load glTF directly; conversion to .j3o is optional.

About the SceneViewer and SceneExplorer window

The SceneViewer and SceneExplorer windows are shared among plugins to save system resources. This means that you will have to keep an eye on what plugin is using the scene right now and what you are actually modifying in these windows.

Most plugins will deliver their own UI elements to modify the scene so the SceneExplorer is more of a global tool. The simple SceneComposer however heavily relies on its functions as other plugins might too in the future.

About the projects AssetManager

Each jMonkeyEngine SDK project has its own internal AssetManager that has the projects assets folder registered as a FileLocator. When the project is run, the assets folder is compressed into a jar file and added to the projects main jar classpath. This way the editors in jMonkeyEngine SDK and the running game have the same asset folder structure.

You might wonder why jMonkeyEngine SDK requires you to copy the model that is to be converted to j3o into the assets folder before. The Model Import Tool also copies the model and associated files to the project directory before converting. To load the model it needs to be in a folder (or jar etc..) that belongs to the projects AssetManager root. To load a model from some other folder of the filesystem, that folder would have to be added to the AssetManager root. If every folder that contains a model was in the root of the AssetManager, all textures named “hull.jpg” for example would be the same for the AssetManager and it would only deliver the texture of the first model folder that was added.

To have a valid jME3 object, the paths to textures and other assets belonging to the model have to be read with the correct, final path that can then be stored in the j3o object. The j3o object will use those paths when it is loaded with the AssetManager and it requires the AssetManager to deliver the assets on those paths, this is why the folder structure while converting has to be the same as when loading.