Im just experimenting here, so dont judge my method lol!
I have used a for loop to populate a small 40x40 area with 20 1x1 textured .j3o meshes. Some are ‘lit up’, and some are not. There is no obvious pattern to which are lit. If a directional light works how I think it works, then all of them should be lit on the same side, and dark on the other. This is not the case. I suspect [Spatial].clone() has something to do with it.
ninja edit : After staring at this for a bit longer, I bet I know whats going on. Cloning creates a copy, shading included. Am I on the right track?
[java]
Spatial flower = assetManager.loadModel(“Models/test1.j3o”);//newly working! GJ JME team!
for(int a = 0; a < 20; a++) {
Spatial f2 = flower.clone();
float sca = (float)Math.random() +.25f;
f2.scale(sca, sca, sca);
f2.rotate(0f, (float)Math.random() * (float)Math.PI, 0f);
f2.setLocalTranslation((float) Math.random() * 40f - 20f, 1f, (float) Math.random() * 40f - 20f);
rootNode.attachChild(f2);
}
//no difference whether ambient is here or not :
AmbientLight ambient = new AmbientLight();
ambient.setColor(ColorRGBA.White.mult(3f));
rootNode.addLight(ambient);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
rootNode.addLight(sun);
[/java]
I made some changes in SVN. I noticed it fixed weird lighting in your test case so I hope that was it
Sorry, no dice.
http://i.imgur.com/j1hfy.jpg
http://imgur.com/j1hfy&DytwQl&RSk6L
http://imgur.com/j1hfy&DytwQ&RSk6Ll
Ive tried it with the .obj version and the .j3o version of the same mesh. Same results.
Ive tried it with ambient and no ambient.
mtl file :
Blender MTL File: ‘ball1.blend’
Material Count: 1
newmtl Material.001_brass.jpg
Ns 96.078431
Ka 0.300000 0.300000 0.300000
Kd 0.800000 0.800000 0.800000
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd /home/jason/jMonkeyProjects/game12/assets/Models/brass.jpg
Not a huge issue at this time, just a minor mystery.
I tried the material file you provided and it still works for me.
Can you provide the j3o file?