Directional Lighting on Android

Hello all,

I am using Directional light with a common lighting material.

Ambiant works fine but directional is not showing at all.

I am using 3.1 beta. Is directional light even supported on android?

(works fine on desktop)

    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);

    Material mat = this.assetManager.loadMaterial("Materials/blueOre.j3m");        
    geom.setMaterial(mat);

    rootNode.attachChild(geom);
    
    DirectionalLight l = new DirectionalLight();
    l.setColor(ColorRGBA.White.mult(3));
    l.setDirection(new Vector3f(0.5973172f, -0.16583486f, 0.7846725f).normalizeLocal().negate());
    //l.setDirection(new Vector3f(-1, -1, -1));
    rootNode.addLight(l);
    
    AmbientLight al = new AmbientLight();
    al.setColor(ColorRGBA.White.mult(6));
    rootNode.addLight(al);

And the material:

Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {        
    Specular : 1.0 1.0 1.0 1.0
    Diffuse : 1.0 1.0 1.0 1.0
    UseMaterialColors : true
    ParallaxHeight : 0.05
    Ambient : 0.2 0.2 0.2 1.0
    Shininess : 30.0
    DiffuseMap : Flip Repeat Textures/Blue Ore/12529-diffuse.jpg
    SeparateTexCoord : false
    VertexLighting : false
    EnvMapAsSphereMap : false
    SteepParallax : false
    NormalMap : Flip Repeat Textures/Blue Ore/12529-normal.jpg
    SpecularMap : Flip Repeat Textures/Blue Ore/12529-specstrength.jpg
}
AdditionalRenderState {
  FaceCull Back
  Wireframe Off
  DepthWrite On
  PolyOffset 0.0 0.0
  AlphaTestFalloff 0.0
  Blend Off
  PointSprite Off
  ColorWrite On
  DepthTest On
}

}

Same problem here. Is there an issue on Lighting.j3md on Android?

Im not an android developer, but I’m quite certain whomever does help would like to know the android version and most likely the phone/emulator ROM you are using.

Does your model work with lighting on the desktop?

1 Like

All my models work very well on the desktop, but on Android only ambient lights make some difference. Point lights and directional lights don’t work.

1 Like

I’ve got new info on this topic.

The first device I deployed my app was a Motorola Moto G4 Play with Android 6.0.1. All my models was invisible, but the particle system worked perfectly.

I decided to try it on another device and see what happens, so I deployed it to an older smartphone Sony Xperia S with Android 4.1.2. I can see the models and the particle system on this device. Why it didn’t work on the newer one?