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

不想你离开。 提交于 2019-12-11 14:08:00

问题


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:

I use eclipse and the added files look like this:

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.


回答1:


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.



来源:https://stackoverflow.com/questions/11430062/enabling-materials-and-textures-for-ogre-3d-model-in-jmonkeyengine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!