.obj Models imported look wierd

I have a treasure chest I created in Blender. It looks like this:


Rendered, it looks like this:


I export it as a .obj file to assets/Models/ and, just to test it out, load one up and attach it to the player_node.


Spatial player_avatar = assetManager.loadModel(“Models/chest.obj”);

Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”); // default material

mat.setTexture(“ColorMap”, assetManager.loadTexture(“Models/walnut_dark.jpg”));


player_avatar.setLocalRotation(new Quaternion().fromAngleAxis(90*FastMath.DEG_TO_RAD, new Vector3f(1,0,0)));



I get this:


I’ve gotten this in blender 2.63 and 2.62. I’ve tried to get OgreXML import working but the tutorial is not a tutorial, it’s a vague checklist and some pictures which do not seem to refer to either of the versions of Blender I’ve used. I’ve installed the CommandLineTools and the exporter script, but exporting just gives me a pile of errors:


I’d like to get one of the two working, either the .obj or the OgreXML approach, but right now neither of them work.

Have you tried the blender importer built into the SDK?

When I try to import blender 2.62 files I get an error

Loading obejct: Camera
Camera created (W: 640, H: 480)
Loading obejct: Cube
Importing mesh.
Loading material.
Reading texture from file: //......Models..AlexiosassetsModels......Modelswalnut_dark.jpg
Trying to write asset failed, asset data null!
Import failed?

When i try to import blender 2.63 files I get a .j3o file with no object or mesh or whatever in it. The scene viewer just shows the reference arrows with no object or wireframe visible.
@michaellinke said:
When i try to import blender 2.63 files I get a .j3o file with no object or mesh or whatever in it. The scene viewer just shows the reference arrows with no object or wireframe visible.

U turned on the light and looked at the SceneExplorer?


When I run the game with a .j3o made from a blender 2.63 file, the chest does not appear.

I’ve figured out part of the problem. The holes in the model were because certain polys were facing inward. I flipped those. The texture is still borked and actually flickers if I move around.

I had the same. It was caused by the texture location in Blender. Mosty likely, you have Blender save the .blend file somewhere, then you copy it to your projects assets, right?

What you should do (at least that worked for me) is the following:

In Blender, save the .blend file into your /assets/models folder. Also, save your texture ‘Modelswalnut_dark.jpg’ in the same folder. Now in Blender, you will have to reload your texture file , but now from the /assets/models folder (make sure yo do this in Blender in both the UV/Image editor as well as in the textures menu).

As you can see in the error, ‘Readding texture from file: //……Models…AlexiosassetsModels……Modelswalnut_dark.jpg’, the importer tries to load the txture from a strange directory. When you do it like I suggested, the location of the texture in the texture menu of Blender will look like this: //Modelswalnut_dark.jpg.

If you want to store the .blend file somewhere else then in your /assets folder, this should be possible, as long as you make sure the texture file is in the same folder, and when importing into JME, put the texture file in the folder where the model goes upfront.

The board interpreted the slashes. The texture is at /Models/walnut_dark.jpg, the same folder as the .blend file. ((And it doesn’t work))

Are you using multiple separate meshes in Blender? If so, create a material and texture file for each mesh (all with there own UV-maps and UV-textures). And in JME, create a j3m for each material and set it to the individual objects…

I was initially using multiple textures, but after failing to get ogre to work, I simplified to a single material, single texture version The top three screen shots above are one material, one texture.

When I export a .obj, blender also gives me a .mtl file which I can’t seem to import or convert into anything in jme.

To better illustrate what’s going on with the textures, I changed to the following texture:


Blender renders it like this:


The game renders it like this:


The flickering can be seen here:


There are some reference frame type glitches in the floor and background on the avi file, but the object in question, the treasure chest, is always centered and IS NOT glitched in the video compression process. This is exactly how it looks.

You have to create your own j3m file in which you set the texture to the DiffuseMap. Then set this material to the .obj. If I remember correctly, there was no need for this .mtl file in JME.

yea you should make j3m file, and for sure make textures repeat.

i have models with mirror and using j3m files i dont have problems.

Your UV mappings look pretty scrambled to me. Have you tried:

  1. Applying all the modifiers in blender before export (save the pre-applied model before doing this)
  2. Updating to Nightly (see below)
  3. Importing using the blender importer
  4. (optionally)Applying your own created material with the texture in it

    Please note that blender 2.63 has a completely different internal format to store meshes which breaks a lot of tools. The latest nightly SDK has a blender importer that fixes support for 2.63 meshes and also at the same time some uv and normal mapping problems I was seeing.