HI folks, in my testing I discovered what I think is bug…
Essentially if I have this material defined:
Material My Material : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
VertexLighting : true
UseVertexColor : true
Diffuse : 0.50974435 0.5132341 0.64000005 1.0
Specular : 1.0 1.0 1.0 1.0
Ambient : 0.0 0.0 0.0 1.0
Shininess : 20.0
}
}
On the desktop this renders just fine.
On android it renders essentially black…(in my test which is just a bunch of spheres all rotating around about y), one of spheres (closest to teh camera) shows up with rendering glitches ('its as if the part of the edges are showing up with ‘random’ colors).
I noticed that if I redefine the material (without UseVertexColor), it renders just fine. (is this …expected behavior?).
My Platform: Asus Transformer 300, running android 4.03
Test code is shown below: (where the x.j3m if just reference to material above, with UseVertexColor=true).
[java]
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Sphere;
public class Main extends SimpleApplication {
Sphere sphere = new Sphere(32, 32, 1.0f, true, false);
int bricksPerLayer = 5;
int brickLayers = 6;
static float brickWidth = .75f, brickHeight = .25f, brickDepth = .25f;
float radius = 3f;
float angle = 0;
Material mat;
Material matFloor;
Node parentNode;
public static void main(String args[]) {
Main f = new Main();
f.start();
}
@Override
public void simpleInitApp() {
System.out.println("=======================================");
flyCam.setEnabled(false);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.3f, -0.7f, -0.8f));
sun.setColor(new ColorRGBA(1f,0.6f,0.6f,0f));
System.out.println(“Adding light”);
rootNode.addLight(sun);
parentNode = new Node();
parentNode.setName(“parentNode”);
rootNode.attachChild(parentNode);
System.out.println("
");
initTower();
initFloor();
System.out.println("
");
this.cam.setLocation(new Vector3f(0, 25f, 18f));
cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
cam.setFrustumFar(80);
}
public void initTower() {
double tempX = 0;
double tempY = 0;
double tempZ = 0;
angle = 0f;
for (int i = 0; i < brickLayers; i++){
// Increment rows
if(i!=0)
tempY+=brickHeight*3;
else
tempY=brickHeight;
// Alternate brick seams
angle = 360.0f / bricksPerLayer * i/2f;
for (int j = 0; j < bricksPerLayer; j++){
tempZ = Math.cos(Math.toRadians(angle))*radius;
tempX = Math.sin(Math.toRadians(angle))*radius;
Vector3f vt = new Vector3f((float)(tempX), (float)(tempY), (float)(tempZ));
// Add crenelation
if (i==brickLayers-1){
if (j%2 == 0){
addGeometry(vt);
}
}
// Create main tower
else {
addGeometry(vt);
}
angle += 360.0/bricksPerLayer;
}
}
}
public void initFloor() {
Box floorBox = new Box(Vector3f.ZERO, 10f, 0.1f, 10f);
Geometry floor = new Geometry("floor", floorBox);
matFloor = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
matFloor.setColor("Color", new ColorRGBA(0.2f,0.2f,0.8f,0f));
floor.setMaterial(matFloor);
floor.setLocalTranslation(0, 0, 0);
this.rootNode.attachChild(floor);
}
public void addGeometry(Vector3f ori) {
Geometry ball_geo = new Geometry("cannon ball", sphere);
mat = assetManager.loadMaterial("Materials/x.j3m");
ball_geo.setMaterial(mat);
ball_geo.setLocalTranslation(ori);
parentNode.attachChild(ball_geo);
}
public void simpleUpdate(float tpf) {
float speed = 0.2f;
parentNode.rotate(0,speed*tpf,0);
}
}
[/java]