Importing material of ogexml

Hi I’m new in JME.

I’m trying to load a model from blender.



I made a basic 3D cube with blender (for testing purposes).

I changed the materials (The diffuse color only) to green.

But when I try to load the model with JME3 it loads but it’s red.

How can I import the Material as it is??

or can this be a lighting issue





the code:

[java]



public class HelloAssets extends SimpleApplication {



public static void main(String[] args) {

HelloAssets app = new HelloAssets();

app.start();

}



@Override

public void simpleInitApp() {







// Load a model from test_data (OgreXML + material + texture)

Spatial thing = assetManager.loadModel(“Models/Cube.mesh.xml”);

rootNode.attachChild(thing);



// You must add a light to make the model visible

DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

rootNode.addLight(sun);



}

}

[/java]



PS : Blender has created another file Scene.material



Thanks

Use UV textures as material, you cant use all the material types in blender for live rendering anyway.

change Scene.material to Cube.material see if that works

1 Like
wezrule said:
change Scene.material to Cube.material see if that works

Yes it works
Thank you