Android load glb model

The model looks very black.
DirectionalLight and AmbientLight have been set.

  AmbientLight ambientLight = new AmbientLight(new ColorRGBA(ColorRGBA.LightGray));

  DirectionalLight sun = new DirectionalLight();
  sun.setDirection(new Vector3f(-0.5f,-0.5f,-0.5f).normalizeLocal());

Does anyone know how this happened? Do I need to set anything else?

Yes, you need to add a light probe to the scene. You can use a pre-made probe or generate one with LightProbeFactory.

You can use this pre-made one here:jmonkeyengine/jme3-testdata/src/main/resources/Scenes at master · jMonkeyEngine/jmonkeyengine · GitHub

Node probeNode = (Node) assetManager.loadModel("Scenes/defaultProbe.j3o");
        LightProbe probe = (LightProbe) probeNode.getLocalLightList().iterator().next();

See this example for how to generate one for your scene.

Related topics:

1 Like

Note, PBR material might be heavy for Android devices so if you do not require PBR material I would suggest converting them to the Phong material (Lighting.j3md).

There is also an optimized version of PBR developed for mobile in case you want to check:

1 Like

Thank you very much for your help.