Importing a model in jme


I’ve recently discovered a great online resource for ogre3d models named worldforge. The database can be used with svn and the link . Now after I’ve waited hours for the data to be downloaded I would like to use a few models in my jme project. The problem is: I can’t figure out how to import them. The import model button froze after I chose one of the ogre3d meshes. I also tried pasting a mesh in my models folder and converting it to j3o but naturally all the textures were lost. Copying the texture folders to the asset folder didn’t cure the problem. What shall I do ?


This is part of the output if I try to convert a model to j3o. I copied the models folder to Models and the textures folder to Textures.

Cannot locate Models/models/monster_skeleton/monster_skeleton.material for model Models/models/monster_skeleton/monster_skeleton.mesh.xml

Material /global/environment/petrified not found. Applying default material

When you use the SDK, you can simply go to the “AssetPack Browser” and download the whole WorldForge model pack. Then all models appear in the AssetPack browser and you can add them to your scenes and projects. Apart from that if you want to use them manually you have to use the MaterialExtension facilities of the OgreXML importer (see javadoc).

Can I tell the assetpack browser to look in my local folder ? I won’t have internet for a while and can’t download everything again.

I’ve searched the javadoc for anything like ogrexml, xml, importer, … but only found a ModelConverter that didn’t look useful. The default import button doesn’t offer anything like material settings. What do you mean ?

Assetpacks are a special format, if you create a new project you can copy the world forge models into the project and create a description file by right-clicking the project and “scanning for world forge models” but its not very user-friendly, I mainly did it so I could import the WorldForge models and upload the asset pack.

Importing models will probably never yield the material results you expect (e.g. the OgreXML exporter cannot export normal maps etc), so you’ll probably have to edit the material of the model afterwards anyway (again, see the manual (press F1 key) on that)

This is from the javadoc of the MaterialExtensions, you have to use code:

com.jme3.scene.plugins.ogre.matext allows loading of more advanced

Ogre3D materials that use “base” materials to abstract functionality.

E.g. example of an Ogre3D material instance:

import * from “materials/baselighting.material”

material MyMaterial : BaseLightingMaterial


set_texture_alias MyTexture textures/mytex.png



Example code of loading the above material:

MaterialExtensionSet matExts = new MaterialExtensionSet();
MaterialExtension baseLightExt = new MaterialExtension("BaseLightingMaterial",
baseLightExt.setTextureMapping("MyTexture", "m_DiffuseMap");

OgreMaterialKey matKey = new OgreMaterialKey("materials/mymaterial.material");
MaterialList ogreMats = assetManager.loadAsset(matKey);

You said

copy the world forge models into the project and create a description file by right-clicking the project and “scanning for world forge models”

I copied the models folder to the Models folder and did the same for the textures.Then I searched unsecessfully for the option “scanning for world forge models” . Where exactly is it?

Creating a special material for each model is not very appealing to be honest. I tried to use these assets because I wanted to concentrate on programming. This smells like work and would surely add a lot of boilerplate code. Nevertheless thank you very much for the advice. I’d just appreciate a more comfortable solution as I’m a chronically lazy person…

a) An AssetPack project, there is no such thing as a “Models” folder for them.

b) Creating a model always involves work and theres no difference in the artist putting the finishing touches to it in the SDK or in blender. You can do what I explained using the SDK UI.

In 4 out of 5 attempts to add the folder plants to the assets folder of the assetpack the jmonkeyplatform froze. The fifth time I could copy the plants folder into the assetpack and let the engine search for worldforge content. It didn’t find any !

What do you mean by b) ?. I know the basics of blender although I couldn’t create a good model on my own. Still it’s a mystery to me, how to apply the finishing touches in the SDK UI.

You have to convert the models to xml before (also an option in the project menu). b) Is explained in detail in the wiki, check the blender export tutorials.

I thought the models were already in the right format. They are ogre mesh files. If I copy one of the meshes into the models folder directly it can be converted to a j3o file without problems. It’s just that the textures are missing.

The assetpack project didn’t like that I just added a part of the worldforge files. Now I’ve copied the major part of the data and it is at least searching for worldforge content. Previously it immediately protested that there were no worldforge files. Now it is working for over 1 hour. Besides that this process is slowing down the entire platform. The ide takes about 10 seconds to be rendered properly after being minimized and then maximized again… I don’t think it’s just straining to cope with the immense amount of files. Now the assetpack contains ~10 times more data than before and the working time has increased from half a second to over an hour. Hopefully something is going on in the background…


Sorry, I’ve been wrong. The files weren’t in the right format. I killed the jme process because it didn’t respond anymore and after a restart checked the options again. Now I’ve converted the meshes and again started the search for worldforge content. Although there’s no result yet at least jme runs smooth


Now there’s a strange error message saying something like

Error in scene: String index out of range.

Since then jme’s been busy analysing a file named fishing_hook.mesh.xml. At least that’s what the little green animated progress bar shows. Maybe the bar isn’t constantly updated but this still seems curious.

Really, in the time we solve this you could download the assetpack 2-3 times probably…

I’m using an umts stick. The download rate is horrible and as there’s a traffic limit the bandwith is already reduced. Another download is really no option. Moreover in a professional engine it should be possible to use models you’ve stored on your hdd.

Thank you for the time you’re investing in this.

My dear friend, I set up probably everything you have been using up until now and made it available to your for free. Maybe you try and load the models into blender and see what happens. The issue is that the models are using quite a special setup, they are not just some ogre models… I posted the code that allows you to load them, a professional programmer should be able to load the model using that.

I didn’t mean to offend you or criticise your work. Right now I’m on vacation and would like to make some progress with my hobby project. The worldforge assets seemed like a huge relief meaning that I could just code my way through programmatical obstacles and forget about modeling. Sorry that it wasn’t as easy as this. I came from Unity3d and don’t look back but the support for models was better. Sure, Unity3d is a commercial product so a feature comparison is somewhat unfair. Still jme has to stand some looks sideways and what I’ve experienced today was not encouraging. Once again: I appreciate your help and the time you spend for me.

Nevertheless: I hope that jme is not only meant to be used by professional programmers. Everyone starts from zero.

If you say that these are not just some ogre models I guess we’d better just leave it at this. For now I’ll work with placeholders and selfmade models and turn to assets when I got fast internet access again.

jME3 will always require programming skills, its not a one-trick-pony like Unity. How you design your game code wise will always be up to you. Unity has it easier to be pleasant at the UI level because it has less diversity on the engine level. There isn’t even the logic of a “character” or “unit” in jME3, you have to define what that means. At any instance, when you import the model it should probably work for the mesh but the material will be a basic red. You can then copy the textures to your project too and create a new material from them (New File->Material) that you assign to the models geometries.

yeah, unity 3d is a engine for 3d modelers :roll: . Java script AI :roll: .

jME3 doesn’t support all features of Ogre3D materials (of which there are far too many). Instead limited support is available so that importing Ogre3D models from modelling tools such as Blender is possible. A game like WorldForge uses specialized material files that were designed to work specifically with the game’s shaders, and specifically with the Ogre3D engine, this is why there’s such difficulty in getting them to work. For that reason, the jME3 team makes available a WorldForge AssetPack that can be downloaded with all the models already pre-converted to the jME3 preferred J3O format.

Those models were imported by using the “com.jme3.scene.plugins.ogre.matext” API, see the example in the package javadoc on how to use this API.

Right, actually they are not pre-converted but the mat ext loader is used when they are loaded from the assetPack.