Blender, Ogre Export and JMonkey import

Hello all.

I’ve been struggling the past week or so in getting an exported Blender scene/model to import correctly into JMonkey. I have not been able to rule out which environment is presenting the biggest problem. I’ve tried many variations in both programs to varying degrees of success.

I am attempting to import a house model with a couple collections of meshes (wall, roof, fireplace, etc…). I have primarily just been trying to get the wall material and texture to import and be shown in JMonkey (after which I’d work on the rest).

Here are the things I have tried in Blender:

  • Alpha channel wood texture with blended diffuse shaders (with color) to get the color and effect
  • Regular jpg texture mapped directly to the mesh
  • Mark seam/unwrap
  • Camera vector prior to unwrapping

Here are the things I have tried in JMonkey:

  • Generating the j30 both from the ogre export and from the .blend file directly
  • Putting the .blend in the textures directory and moving the j3o to the models directory
  • Placing the used texture in every path conceivable that I have com across (same dir as .blend, Textures etc…)
  • Creating j3m file with color map to texture, separate texture coordinates checked, color defined as well (when alpha channel texture didnt work)
  • Assigning unshaed, lighted and custom material to imported model

Now it’s obvious that either I have done any or all of these things incorrectly or have not done something crucial for this to work.

Here is my house model setup in Blender

Here is my JMonkey code for model loading

Finally here is the result of the model import (with the custom material applied)

It’s strange because when inside the house certain triangles get a warped texture applied but generally it’s just brown (probably because the color was set to brown in the custom shader).

If anyone can point me in the right direction I’d appreciate it. I’ve been searching and scouring for videos or articles of how to do this but generally they seem to not be helpful or I am doing them wrong. At this point, since I’m not sure where the problem is (though I did get a simple cube model to import using the same material just fine) I’m not sure what I should be focusing on.

Hi there!

I’ve been recently trying to overcome my noobishness and just finally got blender and ogre to work properly.

I believe all meshes have to be UV mapped. Try unwrapping your house with the UV editor and then using the UV Map image to texture your house.

Then exporting with ogre with the UV map as the material should allow it to go directly into JME through its import feature. Just open the model and it will convert directly to a .j30 and go nice right into your models folder!

Did you need to set a custom material on the jmonkey end (on the imported model)? Or did you use one of the stock ones like Unshaded or Lighted?

You should be able to set a material within blender.

You would be able to set your UV map as a texture then by applying that texture it will become the items material.

When you export with Ogre you will get a .scene file.

This file will tell JME to include all files that Ogre exported including the UV map you’ve created.

If you are doing simple models without animation, like buildings, then you can just import the .blend file and by doing that you will get an easily created .j3o in your projects model folder.

Well, are you suing uv only between 0 and 1 ? else you might be simly need to set the texture WrapMode to Repeat. Anyway I can at least assure you that a properly uv mapped model in blender works with the direct import usually.

It might be worth a try to throw the entire material stuff from blender out, and just use a plain diffuse texture in the old way (material->texture->image/movie) Might be that the importer gets stuck at that somewhere.