OgreXML models exported from Blender can't load textured materials?

Hi everyone,

Been getting into JMonkeyEngine3 for the last week - and it’s a lot of fun. Everything has been going extremely well and I’m really impressed with just how amazing and well-designed v3 is. I’ve come across a problem that I’m having difficulty working out, though…

I’m using Blender 2.63 to create a simple model, which I want to export into OgreXML format to load into JME. I’ve installed the latest OgreXML exporters, both using the JME SDK and the project at http://code.google.com/p/blender2ogre/. By deselecting “separate materials” on the export screen, I can load the model successfully with unshaded materials that match the diffuse colours set in Blender.

However I can’t seem to load a textured material at all. When exporting I get materials defined like the following:

// blender material: Material.002
material Material.002
receive_shadows on
pass Material.002
ambient 0.800000011920929 0.5183919072151184 0.6339618563652039 1.0
diffuse 0.6400000190734865 0.4147135319518078 0.5071694926495773 1.0
specular 0.5 0.5 0.5 1.0 12.5
emissive 0.0 0.0 0.0 1.0
alpha_to_coverage off
colour_write on
cull_hardware clockwise
depth_check on
depth_func less_equal
depth_write on
light_clip_planes off
light_scissor off
lighting on
normalise_normals off
polygon_mode solid
scene_blend one zero
scene_blend_op add
shading gouraud
transparent_sorting on
texture Pond.jpg
tex_address_mode wrap
scale 1.0 1.0
colour_op modulate

This is the model that I am trying to render: (Rendered by Blender)

And this is the result in my SimpleApp:

Pond.jpg is also exported to the same directory as the material. I've also tried changing the path to a project-relative path, e.g. Textures/Terrain/Pond/pong.jpg.

I've tried registering the Blender asset loader and loading the .blend file that way; it didn't crash, but it didn't load anything into my scene, either. I also can't use the JME SDK to convert a .blend file (e.g. into a j3o/etc file) because it is throwing the "Unknown data type: uint64_t" error when trying to import/export a model.

Any ideas? I'm new to both JME3 and Blender so is there something simple that I'm missing?
1 Like

The texture has to be UV mapped.


Thank you! Success!

I found it extremely difficult to find a tutorial covering UV mapping for dummies in Blender 2.63, so I found this video which covers everything: http://www.youtube.com/watch?v=NpkG6ygVals

Basically, you need to:

  • Add a new UV mapping window in Blender by splitting the view
  • Cut the polygon up using seams (this is called a UV mapping) in the object window using edit mode
  • In the UV mapping window, export the UV layout to an image (.png)
  • Edit the exported image to apply your textures
  • In the Properties window, add a new material to the object
  • In the Properties window, add a texture to the object, and set the texture type to Image or Movie, and load the textured UV layout PNG
  • In the UV mapping window, apply the texture to the UV mapping by selecting the image icon (next to UVs menu), check that the texture is applied correctly
  • In the Properties window, set the texture Mapping to UV (not Generated)
  • Press F12 to render and test the mapping and make sure it is correct
  • To apply the texture to the main Blender window: In the Object window, press N, and set “Shading” to GLSL, and enable “Textured Solid”
  • You can now export the model to OgreXML (make sure you disable Separate Materials)

    Easy. :stuck_out_tongue_winking_eye:


    (Curiously, I can’t find any differences between the material or scene files between my two attempts.)

The uv mapping will be inside the mesh/geometry data I expect as it’s per-vertex information.

1 Like