JME 3.1 cannot work fine in Android 7

This is my code

    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(-1, -2, -3));

    Box box = new Box(1, 1, 1);
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    mat.setBoolean("UseMaterialColors", true);
    mat.setColor("Diffuse", ColorRGBA.Red);
    mat.setColor("Specular", ColorRGBA.White);
    mat.setFloat("Shininess", 64f);
    Geometry geom = new Geometry("Box");
    geom.setMesh(box);
    geom.setMaterial(mat);

    rootNode.attachChild(geom);
    rootNode.addLight(sun);

    Spatial model = assetManager.loadModel("Ninja.mesh.xml");
    model.setLocalScale(0.02f);
    model.setLocalTranslation(0, 0, -4f);
    Node node = new Node();
    node.attachChild(model);
    rootNode.attachChild(node);

In Android 5 and 6, the box and ninja can be shown, but in Android 7, only the box is shown, the ninja is broken
I tried two android 5 phones, all work fine, and then I tries two android 7 phones, both of them cannot show the ninja
Here are screenshots:
Android 5 or 6: http://file.hamastar.com.tw/laugher/android5.png
Android 7: http://file.hamastar.com.tw/laugher/android7.png
Does anyone know how to fix this? Thanks

1 Like

Have you tried converting the ninja to .j3o?

1 Like

I did, but android 7 still can’t load the ninja model

1 Like

Is this a lighting issue or the model?

Can you remove the light and you give the models an unshaded material and see if it shows up differently?

1 Like

Could you try to disable hardwareskinning on the ninja?

ninja.getControl(SkeletonControl.class).setHardwareSkinningPreferred(false);
3 Likes

This would my next guess as well.

1 Like

Thanks for your help, but it is still the same

1 Like
ninja.getControl(SkeletonControl.class).setHardwareSkinningPreferred(false);

awesome! that works, can I know the reason?

1 Like

Well; it’s not that good a news :stuck_out_tongue:
It means that there is a problem with hardware skinning in the shader. Can be a lot of things, but it can be related to the array of matrices we pass to the shader.

Hardware skinning handles transforms of the mesh in the shader, software skinning handles it on the CPU (in the java code).

Do you have an opengl error in the log by any chance?

1 Like
07-01 22:23:19.702 21567-21567/com.example.jmonkeyvr D/ContextRelationMgrBrdg: loadKlass() : caller=com.samsung.android.bridge.multiscreen.common.ContextRelationManagerBridge.<clinit>:28 android.app.LoadedApk.makeApplication:840 
07-01 22:23:19.728 21567-21567/com.example.jmonkeyvr D/AndroidHarness: Resolution from Window, width:1440, height: 2560
07-01 22:23:19.764 21567-21567/com.example.jmonkeyvr I/com.jme3.system.JmeSystem: Information Running on jMonkeyEngine 3.1-stable
                                                                                             * Branch: HEAD
                                                                                             * Git Hash: af04bf9
                                                                                             * Build Date: 2017-02-13
07-01 22:23:19.769 21567-21567/com.example.jmonkeyvr I/com.jme3.system.android.OGLESContext: Information Android Build Version: 24
07-01 22:23:19.809 21567-21567/com.example.jmonkeyvr D/InputTransport: Input channel constructed: fd=65
07-01 22:23:19.810 21567-21567/com.example.jmonkeyvr D/ViewRootImpl@6dd0cbc[MainActivity]: setView = DecorView@b67e445[MainActivity] touchMode=true
07-01 22:23:19.972 21567-21595/com.example.jmonkeyvr I/OpenGLRenderer: Initialized EGL, version 1.4
07-01 22:23:19.972 21567-21595/com.example.jmonkeyvr D/OpenGLRenderer: Swap behavior 1
07-01 22:23:19.976 21567-21595/com.example.jmonkeyvr D/libGLESv1: STS_GLApi : DTS is not allowed for Package : com.example.jmonkeyvr
07-01 22:23:19.977 21567-21595/com.example.jmonkeyvr D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1440x2560]-format:1
07-01 22:23:19.982 21567-21594/com.example.jmonkeyvr D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1440x2560]-format:2
07-01 22:23:19.987 21567-21594/com.example.jmonkeyvr I/com.jme3.renderer.opengl.GLRenderer: Information OpenGL Renderer Information
                                                                                                       * Vendor: ARM
                                                                                                       * Renderer: Mali-T880
                                                                                                       * OpenGL Version: OpenGL ES 3.2 v1.r12p1-03dev0.92cea07ab1b80f9f42b782b097e01409
                                                                                                       * GLSL Version: OpenGL ES GLSL ES 3.20
                                                                                                       * Profile: Compatibility
07-01 22:23:19.997 21567-21594/com.example.jmonkeyvr W/com.jme3.asset.AssetConfig: Warning Cannot find loader com.jme3.cursors.plugins.CursorLoader
07-01 22:23:20.003 21567-21594/com.example.jmonkeyvr W/com.jme3.asset.AssetConfig: Warning Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
07-01 22:23:20.017 21567-21594/com.example.jmonkeyvr I/libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
07-01 22:23:20.022 21567-21594/com.example.jmonkeyvr W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 1, track 44100 Hz, output 48000 Hz
07-01 22:23:20.023 21567-21594/com.example.jmonkeyvr D/AudioTrack: Client defaulted notificationFrames to 590 for frameCount 1772
07-01 22:23:20.031 21567-21594/com.example.jmonkeyvr I/com.jme3.audio.openal.ALAudioRenderer: Information Audio Renderer Information
                                                                                                         * Device: OpenAL Soft
                                                                                                         * Vendor: OpenAL Community
                                                                                                         * Renderer: OpenAL Soft
                                                                                                         * Version: 1.1 ALSOFT 1.16.0
                                                                                                         * Supported channels: 64
                                                                                                         * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFTX_device_clock ALC_SOFTX_HRTF ALC_SOFT_loopback ALC_SOFTX_midi_interface ALC_SOFT_pause_device
                                                                                                         * AL extensions: AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_block_alignment AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length
07-01 22:23:20.032 21567-21594/com.example.jmonkeyvr I/com.jme3.audio.openal.ALAudioRenderer: Information Audio effect extension version: 1.0
07-01 22:23:20.032 21567-21594/com.example.jmonkeyvr I/com.jme3.audio.openal.ALAudioRenderer: Information Audio max auxiliary sends: 4
07-01 22:23:20.459 21567-21572/com.example.jmonkeyvr I/art: Do partial code cache collection, code=26KB, data=25KB
07-01 22:23:20.459 21567-21572/com.example.jmonkeyvr I/art: After code cache collection, code=26KB, data=25KB
07-01 22:23:20.459 21567-21572/com.example.jmonkeyvr I/art: Increasing code cache capacity to 128KB
07-01 22:23:20.792 21567-21567/com.example.jmonkeyvr D/ViewRootImpl@6dd0cbc[MainActivity]: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
07-01 22:23:20.792 21567-21567/com.example.jmonkeyvr D/ViewRootImpl@6dd0cbc[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
07-01 22:23:20.792 21567-21567/com.example.jmonkeyvr V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@4367368 nm : com.example.jmonkeyvr ic=null
07-01 22:23:20.792 21567-21567/com.example.jmonkeyvr I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
07-01 22:23:20.805 21567-21580/com.example.jmonkeyvr D/InputTransport: Input channel constructed: fd=80
07-01 22:23:20.808 21567-21567/com.example.jmonkeyvr D/ViewRootImpl@6dd0cbc[MainActivity]: MSG_RESIZED: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
07-01 22:23:20.808 21567-21567/com.example.jmonkeyvr V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@cc90381 nm : com.example.jmonkeyvr ic=null
07-01 22:23:20.846 21567-21594/com.example.jmonkeyvr I/com.jme3.animation.SkeletonControl: Information Hardware skinning engaged for Ninja-ogremesh (Node)
07-01 22:23:20.976 21567-21572/com.example.jmonkeyvr I/art: Do partial code cache collection, code=62KB, data=58KB
07-01 22:23:20.976 21567-21572/com.example.jmonkeyvr I/art: After code cache collection, code=62KB, data=58KB
07-01 22:23:20.976 21567-21572/com.example.jmonkeyvr I/art: Increasing code cache capacity to 256KB
07-01 22:23:22.770 21567-21572/com.example.jmonkeyvr I/art: Do full code cache collection, code=125KB, data=115KB
07-01 22:23:22.771 21567-21572/com.example.jmonkeyvr I/art: After code cache collection, code=74KB, data=68KB
07-01 22:23:23.621 21567-21567/com.example.jmonkeyvr D/ViewRootImpl@6dd0cbc[MainActivity]: ViewPostImeInputStage processPointer 0
07-01 22:23:23.621 21567-21567/com.example.jmonkeyvr W/System: ClassLoader referenced unknown path: /system/framework/QPerformance.jar
07-01 22:23:23.622 21567-21567/com.example.jmonkeyvr E/BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]]
07-01 22:23:23.622 21567-21567/com.example.jmonkeyvr V/BoostFramework: BoostFramework() : mPerf = null
07-01 22:23:24.078 21567-21567/com.example.jmonkeyvr D/ViewRootImpl@6dd0cbc[MainActivity]: ViewPostImeInputStage processPointer 1

The above log is printed from android 7
It seems no error log

1 Like

I wonder how do u run your program on your phone? can u run it with Android device as config?

1 Like