3dtexturesogrejmonkeyengine

Enabling materials and textures for OGre 3D model in jmonkeyengine?


I downloaded models from WorldForge and I can introduce the mesh of a goblin to my scene but the texture and material won't render:

enter image description here

I use eclipse and the added files look like this:

enter image description here

The way I add the goblin in the code is this

Spatial model3 = assetManager.loadModel("objects/creatures/goblin/goblin.mesh.xml");
model3.setLocalTranslation(-30.0f, 4.5f, 0.0f);
rootNode.attachChild(model3);  

Can you help me how I improve the goblin? There are several textures and materials definition in the files but it seems like only the goblin.mesh.xml is loaded by my scene.

Any help is greatly appreciated.


Solution

  • I am not sure if this will help, but take a look here: http://jmonkeyengine.org/wiki/doku.php/jme3:external:blender, especially at the code sample where soldier is being added to scene.

    I think you have to explicitly declare material in your code, and then attach it to the Spatial representing your goblin. So far you imported only mesh, it seems to me you also have to import material somehow.