Problem with loading models


I am a jMonkeyEngine newb, and i have some problems with loading models.

here is my code:[java] @Override

public void simpleInitApp(){

Spatial Terrain = assetManager.loadModel("Models/Plane.mesh.xml");

Material mat_terrain = new Material(assetManager,"Models/Plane.material");



DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));


}[/java]I am using jMonkeyPlatform and the files Plane.mesh.xml and plane.material are in the models folder of the assets. What am i doing wrong?

You don’t need to load the Plane.material, its done automatically.

Just use this for the loading code:


Spatial Terrain = assetManager.loadModel(“Models/Plane.mesh.xml”);



1 Like

Strangest error i evre had: the model is now red, and i had a green material…

How can i make it back green?

There’s an error in the log, the material probably cannot be found.

Make sure that your capitalization is correct, the material file should be called Plane.material not plane.material

I tried an other material: a texture, but it has realy uggly effects. what should i do?


Does your model have proper UV coordinates?

UV coordinates?


found it!

It looks like it has something to do with them. how do you set them?

I had the same problem when i started with jme two months ago, and was solved in this thread.

glaucomardano said:
I had the same problem when i started with jme two months ago, and was solved in this thread.

I tried everything in that topic and it won't work.
I tried rendering it in blender, and it looked fine, but in jmonkeyengine it looked uggly.

It’s because probably you don’t know how to use UV coordinates. The best way to create uv texture coordinates to 3d models is using a 3d modeller program. I guess you use blender ok? Then this tutorial will help you to create the uv coordinates. You have to create them before exporting your models. Good luck!

glaucomardano said:
Good luck!

Thanks, I'll need it ;)

I got another problem with a model:

I used the ‘ShowNormals’ material to make it better visible.

This should be hills, and a cave, but i see weird lines and small triangles. Is there something wrong with my model, or is it a bug in jMonkejEngine?

The model still looked normal in blender.

Hmm! This isn’t a bug. If you’re using blender materials don’t wait for multiple textures, this support just one texture. You should use j3m materials for multiple textures. Read the hello_material tutorial to learn how to use it. Good luck again :D.

Or better, see the material_editor video :

I just appleid that material to make everything good visible. The main problem is that some vertices of my model are on a wrong location.

Can you upload the print screen here?

the 2nd image

I can’t see any vertice on wrong locations at 2nd image. I just can see things very colorful.

is This a better screenshot?

an other screenshot:

Hmm! Might be duplicated vertices. Make sure you removed all duplicated vertices of your model before exporting it.