Android graphic glitches

Hello to everyone,
I’ve some problem integrating JME in my Android project. I’ve imported JME model in Android Studio copying entire libs folder from an Android project created in JME SDK, and creating manually an activity that extend AndroidHarness. In this activity I load data to animate model from file and then start the animation. I copied every lines from the main activity created by JME SDK.
The problem is when the activity is loaded the model appear like this:

After I played the animation once the model is:

During the second playing (at the start):

During the second playing (towards the end)

I’ve tested my app on a Nexus 7 (Nvidia Tegra, OpenGL ES 2.0) and on a OnePlusOne (Qualcomm Snapdragon 801,OpenGL ES 3.0). Any ideas??

Thanks in advance… :pensive: :pensive: :pensive:

1 Like

First of all this model looks like it has way too many vertices for an android device. Second, does it happen on desktop too (e.g. when running the animation in the SDK scene composer or when running as a desktop game)?

On PC, if I play as a desktop game, it has a normal behavior, no glitch
appears.
For the model, I made it with MakeHuman because some age ago I was looking
for a 3d human model, but no one was simple as I’m looking for, and on this
forum an user told me to try that software. I’m not so good with blender
and other 3d modelling software, so I was looking for something simple to
use; I only need a 3d model with human limb, also a skeleton is good, if
possible with a T position.

MakeHuman has a model preset more suited for live rendering in games.

If the vert count is to high, you can also apply the decimate modifier in blender to reduce it. Not sure if that’s the problem though. And you should probably use the game rig for the bones in makehuman.

The only setting about “game” is for the choice of the rig preset, and I’ve already selected the game rig. Do you know any other setting about rendering in games??

EDIT: Ok, I found a setting in Topology section with some presets to export human model with a lower number of polygon, and after have recompiled the project nothing is changed. On PC no glitches, but on mobile the problem is still there. Any idea?

EDIT 2: I really don’t know why but if I try to execute on a Motorola Moto E (Qualcomm Snapdragon 200, OpenGL ES 3.0) everything works like a charm, also with the high poly model.

Just found this post @BigBob and I were looking for a solution to this issue. I’ll state that this issue has nothing to do with poly count or model format my model only has 664 triangles. I am running my application on a Samsung Galaxy S4.

I’m searching for a solution to this issue too. My model has only 240 vertices and appears with glitches only on Android. Could anyone help us?

I think i tracked the issue down to the Skinning.glsllib I am working on creating an android safe material and shader.

EDIT:
what I am meaning to say is OpenGL ES uses (ESSL) or (GLSL ES) witch is based on GLSL 1.20 so all shaders should be written to that spec. Now I haven’t done much with shaders so this will be a learning experience for me.

If animation isn’t playing, spatial doesn’t has glitches. When I convert spatial from blender to .j3o jme3 shows a warning like this “cube xxx has vertices with more than 4 weights assigned. The model may not behave as it should.”. Is there a workaround?

I get that error as well, but what I found was OpenGL ES Shading Language under the “Limitations for ES 2.0” section. What I plan to do is compare Skinning.glsllib and see if there is anything that is being used that is not required in an implementation of OpenGL ES 2.0.

This wasn’t very clear from the first post … Does the animation work fine in the SDK or on desktop? Or does it look wrong on both desktop and Android?

1 Like

The animation only looks wrong on certain devices desktop if fine from what I have seen. Try running animation on a Galaxy S4 and see what I mean.

EDIT:
Actually it might just be anything with Adreno 320 GPU this is just a guess from all the devices I have seen reported on the forms with the issue.

@Momoko_Fan in my case, on desktop animations works fine. The problem is on android platform. Loaded spatial works fine without animation on android, but with animations spatials look with some glitches. I’ve created several spatials with blender. Only 4 of 10 display fine on android when animated (in those cases i started to build spatial from a metaball / they are not textured too). It’s a big problem for me.

@skidrunner , my device is a note 3 (with Adreno 330 GPU).

@Momoko_Fan could you suggest us a guide for blender to build without problems animated models with uv textures? I followed the jme3 guide for blender without success (on android platform). Which version of blender is the best to build android models?

From what I have seen on the web the 320 and 330 are referred to together like 320/330 I know this is not really our issue but Forums - Adreno 320/330 Texture problem there is a comical statement here…

The interesting thing is that it works with this small change, it seems glsl compiler doesn’t like long computing lines. divide the long line into small lines works. So, we guess this is compiler issue?

This is my animated model on Android Device… It’s only an example. @skidrunner how could I apply the patch you suggested?

well to test it you would need to create a simple j3md vert and frag now to quote myself

So what I plan to do is create my own based off Skinning.glsllib, Unshaded.j3md, Unshaded.frag, and Unshaded.vert. I don’t exactly know how to do this but this is exactly why programming is fun right :stuck_out_tongue: there are problems and we have ideas how to solve them.

That being said @Momoko_Fan feel free to let me know if you have any ideas or solutions.

First of all, you didn’t mention if this happens in jME 3.0 or 3.1 - that’s kind of important to diagnose issues like this. Second, you didn’t mention whether you are using hardware skinning.

With hardware skinning, there’s a limitation on how many bones you can have on Android. It is around 30 bones for most devices. Theoretically, going above that should be detectable by jME3, but this depends on the OpenGL driver in use. It might be that Qualcomm’s drivers accept the model with the large number of bones, without reporting it to jME3, and then fail to actually run the shader. The only solution in this case is to use 30 bones or less on all models.

It should be possible to “prune” any unused bones from the model. In many models there are so called “control” bones which don’t do anything, i.e. they don’t animate any part of it, or have no animation tracks associated with them. Removing those bones is essential to maintain a low bone count.

2 Likes