.obj file textures

I’ve had the same problem with JME3 for almost a year now. I cant seem to install ogreXML for blender even using the JME3 plugin so i’ve given up on that. I am trying to load .obj objects and set their textures directly using java code (this will suit my purpose better anyways). I would like to kno if this is possible at all and if not, what model format do i have to use in order to set textures.



here is a sample code of my most recent failed attempt:



Material mat_default = new Material(

assetManager, “Common/MatDefs/Misc/ShowNormals.j3md”);

mat_default.setTexture(“m_Color”, assetManager.loadTexture(“Textures/Sports_equipment/soccerFootball.jpg”));



this is part of the error I get:



Material parameter is not defined: m_Color.



Please i could really use some help on this and it will be greatly appreciated

try



[java]

mat_default.setTexture("ColorMap", texture);

[/java]



where texture is the Texture resource that you get from loadTexture.

check this link also:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:materials_overview



your material definition ShowNormals is for debugging and has no parameters.



instead of

“Common/MatDefs/Misc/ShowNormals.j3md”

try using this for unlit material

“Common/MatDefs/Misc/Unshaded.j3md”

and assign your texture to the “ColorMap” parameter

or for a properly lit material

“Common/MatDefs/Light/Lighting.j3md”

and assign your texture to the “DiffuseMap” parameter



e.g.

[java]

Material mat_default = new Material(

assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

mat_default.setTexture(“ColorMap”, assetManager.loadTexture(“Textures/Sports_equipment/soccerFootball.jpg”));

[/java]

Thanks for the quick reply guys. Although I have not been able to solve the problem, the information as been really helpful. am going to be working on something else and come back to this problem later. thanks for the help.