Android development workflow?

Hi,

I’m developing simulations for android. However I have noticed whatever that runs on PC doesn’t many times run on android. So now I’m forced to adopt a development methodology to check each major change, whether it works on android or not. It takes a lot of time.

Is there any shortcut or rules of thumb so that I can eliminate checking some changes on android. I have read that jME doesn’t support shadows or some shaders for android. I’m not messing with them voluntriliy. However I have found that all of a sudden after adding some models or doing some code changes, android throws a exception, one of them is

com.jme3.renderer.RendererException: openGL Error 1280.
Enable error checking for more info

Exception thrown in Thread[GL Thread 201,5.main]
com.jme3.renderer.RendererException: openGL Error 1280.
Enable error checking for more info
at com.jme3.renderer.android.OGESShaderRenderer.
onFrame (OGESShaderRenderer.java:559)
at com.jme3.renderer.android.OGESShaderContext.
onDrawframe (OGESShaderRenderer.java:334)

PS: This application runs perfectly in computer.

How can I diagnose what is causing this problem and when should I check whether my code is still compatible with android or not?
Any other general advice on android is also welcome.

Hello simar.i3r

I’ve similar problems with a game that I’ve developed for android: Tic Tac Toe - Revolution!
In fact it’s a very simple game but at the beginning I used Lighting.j3md textures in my models. It didn’t work in most devices due to the problems related with shaders.
So I decided to change my models to Unshaded textures and bake in Blender the textures with shadows (bake full render) and use UV maps.
Most of the problems dissapeared and the models looks fine. I also experienced a speed boost in the aplication performance.
Other common issue is to have too many objects in the scene.
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:optimization
Use these tips for optimize the number of objects in scene.

After following this tips, my application runs fine most of the times in both PC and Android, unless the Android phone have 4 cores but this issue is going to be solved in the next jmonkey update (yeeeeaaaahhhh!!).

Hey thanks a lot!!!
I will try that and get back.

However in my case I dont apply any materials and textures, I simply import models generated and colores/textured in google sketch.
It would be awesome if you could give some code example how you exactly import meshes and apply texture and materials.

One more question, is this problem arising due to my device or is it due to jmonkey. I mean if I had been using unity, would I have got this problem.??

I haven’t worked with google sketch so I don’t know how it works but I’m sure that your models should have some kind of material applied.
Probably one that uses shades. If you need to put a light in your scene to see your models, then you are using models with shades (bad for android).
Do you convert your models to j3o models? If yes, you can select your model and then use the Edit in SceneComposer button to change the material applied to the model (at least in my case). If not, you should convert your models.

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_asset For import meshes and apply texture and materials. It’s in the very basic tutorials, you must read them!!!

This is for Blender but maybe can help you.
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender

I haven’t worked with Unity so I have no idea how it works. In any case, if Unity use some shades not supported by android (by using opengl libraries) the problem will appear.

I now understand shaders, materials and textures better for this discussion.
Using unshaded.j3o makes the models look blunt and dull. I guess baking is the workaround.
I would be glad if you can provide me some nice quick way to do baking in sketchup or blender.

I have one doubt left for which I don’t want to start a new thread, so i will ask here.
If I turn my directional light off, so there will be no shading even for lighting.j3o.
So is it possible to simply turn the directional light off and use whatever material sketchup exports models with. Will I get the same performance as using unshaded.j3o…???

As I said before, I have never work before with sketchup. Maybe you can import your model from sketchup in blender.

Once in blender:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Bake

Is easy but at the first time is a bit tricky.

You must read about uvMaps and how to make a “Bake: full render”.

I have no idea if turning your light off will solve your problems. Without a light your model will not be visible, so you still have a problem. And if you can not see your models, the question about performance has no sense. In any case I think that you will have better performance with the unshaded option. Think that let the model with some kind of material that you are not using is a waste of resources.

Good luck!!

<cite>@galvez6000 said:</cite> As I said before, I have never work before with sketchup. Maybe you can import your model from sketchup in blender.

Once in blender:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Bake

Thanks, these will be very helpful…

Is easy but at the first time is a bit tricky.

You must read about uvMaps and how to make a “Bake: full render”.

I have no idea if turning your light off will solve your problems. Without a light your model will not be visible, so you still have a problem. And if you can not see your models, the question about performance has no sense. In any case I think that you will have better performance with the unshaded option. Think that let the model with some kind of material that you are not using is a waste of resources.

Basically I’m talking about turning directional light off while keeping only ambient light. Otherwise unshaded material is visible in no light as well.
Further I have found that turning the directional light off does not cause exceptions in android.
It causes as soon as I turn it on. Probably due to turning off directional light turns off shaders as well…

Good luck!!

Unshaded material is always visible, thats the key point about unshaded :wink:. You don’t need any kind of lights to make it visible. If you asing a UVmap to it with a full bake, it seems that there is some kind of light in your scene, but the thruth is that you don’t need any.

I think that if you use ambient light, you are using shaders. Maybe you android device support that number of shaders, but that is not an indicator that your game will work in all devices.

Only to be sure that I’m right, could you add more ambient lights to your scene? Only to see if your have an error with a certain number of ambient lights.

I do get exceptions with ambient lights alone but that happen rare. However i have two points that I would like to discuss with you

  1. When I turn on directional light additional detail appear in models. With ambient light alone models look as if they are just like unshaded textured.
  2. The moment I turn on direction light, android throw exceptions. ie it doesnt run at all…

i guess your conclusion is right ambient light does require some shaders which show exception only at certain inoppertune times.

Secondly, I only managed to get fps of [15, 20] with my models that use lightening.j3m, I’m presently trying to learn baking and using unshaded to get better performance. Just curious whats the fps that you get.

One last thing is fps a good metric to measure performance on my android device??

If directional light changes the way the models look then they are using the lighting shader and not unshaded.

@pspeed said: If directional light changes the way the models look then they are using the lighting shader and not unshaded.

i know that and it is…
My question is that when I turn off directional light, is it equally good as using unshaded texture. They look similar to unshaded when I turn off directional light.

@simar.i3r said: i know that and it is... My question is that when I turn off directional light, is it equally good as using unshaded texture. They look similar to unshaded when I turn off directional light.

No. The lighting shader is doing lots of work regardless. Unshaded is doing almost no work at all.

Ok got it, Thanks a lot…
pspeed: can you comment on measuring(quantifying) performance on android using fps??
Is it good enough or are their some other parameters as well.

Basically I want to figure out how much performance is lost when I add a specific model etc??

The answers are not so simple. Memory limits, cpu limits, and gpu limits will all affect you in different ways. 50 models off screen won’t tax the GPU at all and barely tax the CPU but may really tax memory limits.

Average FPS can be an ok measure but it’s deceiving. Initial performance drops will seem huge even when they really aren’t.

Others may have better android-specific advice.

Thanks,
That was really helpful…

@simar.i3r said: Thanks, That was really helpful....

Just to be a little clearer on what I meant by frame drops being initially deceptive… it helps if you reverse the math into time per frame to see things more clearly.

A 10 FPS drop from 60 to 50 means you are only taking an extra 4 ms to render a frame.
(16 ms per frame up to 20 ms per frame.)

A 10 FPS drop from 20 to 10 means you are taking an extra 50 ms to render a frame.
(50 ms per frame up to 100 ms per frame.)

hmm…
That helped more… Got it

In my game I must load 30 40 models which the user has to arrange by dragging. I understand that this is too arduous for GPU, but let me see how can I shift the tradeoffs. I think I need extremely optimized models so that they render well. So I’m currently trying to be proficient with different types of baking and is also exploring the 2D option as well.

I have baked textures full render in blender and applied UV textures on the model. However when I import those models in jMonkey and create material file j3m, they automatically use lightening.j3m. When I choose unshaded.j3m, and choose the color map as my texture, the T shaped texture of the cube (imported from blender) does not ma[ properly. The whole T shaped faces appear on each face of the cube.

How should I map the texture properly in unshaded.j3m

Did you copy the textures over from the existing lighting material or did you load them again yourself? If you loaded them again yourself did you specify the right value for y-flip?

I did the following steps

In Blender

  1. Created a cube
  2. UV unwrapped it
  3. Open the image in paint
  4. Filled the colors and numbers on each edge.
  5. UV mapped the texture to cube

The cube looked ok in blender and in jMonkey. However it used lightening, so to change that to unshaded I did the following steps.

Screenshot: http://pbrd.co/1ecrGv9

In jMonkey

  1. Clicked on create j3m material file
  2. Double click on the material
  3. Changed from “lightening” to “unshaded”
  4. Choose the cube_map.png as the color map.

I hope all these are all right, if not how to specify the right flip value. I tried checking/unchecking the y-flip, it does not rectify the bad mapping.