Advice for measuring graphics performance and cost on android?

Building a game with JME using a lot of graphics, lighting, particles and such, and the phone is starting to drop framerate etc.

It always flows fine when running on the PC so I need to run it on the phone to really know how things affect the end result.

I’m wondering if there is a well known tool or method for measuring and calculating the “cost” of different effects so that I can compare them and hopefully also to make some predictions and not having to test run everything on the phone. The framerate doesn’t drop when running on my PC so that isn’t a reliable measurement.

The purpose is to make development choices faster and easier to make and to motivate, and also to have some “scientific” way of comparing for example the performance cost of adding ambient occlusion vs having 10 more particle effects, vs having 3x as detailed models in terms of triangles, I hope you get what I’m after.

Can this be done with JME or should I look for something more Android specific?

I’m willing do to some reading if that’s needed. I need a better basis for decisions than trial and error.

Thanks!

http://hub.jmonkeyengine.org/forum/topic/mesh-gets-light-only-from-1-direction/

Looks like you solved this? What was the issue?

As for android, do the emulators mimic performance?

If u want a game to run smoothly in android, u need to strip your game bare. As much baked lighting as possible, simplice physics shapes, not many objects, use hardware skinning. Particles should be fine, but don’t go overboard.

1 Like

I didn’t solve it, the question became obsolete because we decided to change the model and thus I didn’t have to work on that one anymore. I edited my initial post to say that but maybe I should have posted a reply as well.

From what I read on google’s pages, emulators are not a good way to mimic performance so they cannot be trusted.

Baked lighting makes sense, I’ll take that into account where possible. Lights seem to be quite heavy for the phone and we already discarded some things that were cool on the PC but didn’t run at all on Android.

The things you describe are useful, do you just have a feel for it or do you know how to put numbers on them? As in how much difference does it make if my cube has 1000 vertices or 100, or triangles?

The number of triangles in Blender seems not to correspond well to the number of triangles displayed in JME. Why is this?

ok, fair enough, yeh a post would have been better, I don’t normally reread posts, so if they changed, I would have no clue ^^

I don’t have any numbers, I’ve not even used Android that much (going to soon tho), just going off everyone else’s experience. To be safe I wouldn’t go above 50K vertices and 100 objects. I wouldn’t even use a light, but apparently vertex lighting is supposed to be tolerable.

I guess the difference between the numbers you see in Blender and jME are because Blender only shows the Position vertex counts, there are also normals etc. Where does blender show triangle count? The difference between faces in blender and traingles in jME, is that jME has to process triangles, so the faces need to be divided until we have triangles :slight_smile:

From v 2.66 it says “Tris: xx” in the upper right corner next to the number of faces, edges and vertices.

I had the impression that JME uses a lot more tris than Blender . Now when I load it in the scene editor, it shows the same number of tris as blender does.

When running the game, the live text display for number of triangles jumps up a lot more though when a new model appears on screen. Haven’t been able to properly test this but the impression is that it increases by 5-10x the number of tris in the model. Will test and try it out more.

But in the video above it is quite well illustrated, a bat coming on screen seems to increase the triangle count by about 2000, while the actual model has a triangle count of 288 in the scene editor. The wizard model has1073 triangles, but when live it jumps by about 5000 when it comes on screen.

Are they triangles in blender or polygons?

@ettavsdro said: From v 2.66 it says "Tris: xx" in the upper right corner next to the number of faces, edges and vertices.

I had the impression that JME uses a lot more tris than Blender . Now when I load it in the scene editor, it shows the same number of tris as blender does.

When running the game, the live text display for number of triangles jumps up a lot more though when a new model appears on screen. Haven’t been able to properly test this but the impression is that it increases by 5-10x the number of tris in the model. Will test and try it out more.

But in the video above it is quite well illustrated, a bat coming on screen seems to increase the triangle count by about 2000, while the actual model has a triangle count of 288 in the scene editor. The wizard model has1073 triangles, but when live it jumps by about 5000 when it comes on screen.

How many lights are lighting the bat?

They are tris, it doesn’t say how many polygons.
Triangle count is same but this screenshot from both show that JME gives about twice as many vertexes.

I don’t know about the lights, but I’ll try to find out! Thanks for asking.

<cite>@wezrule said:</cite> http://hub.jmonkeyengine.org/forum/topic/mesh-gets-light-only-from-1-direction/

Looks like you solved this? What was the issue?

As for android, do the emulators mimic performance?

If u want a game to run smoothly in android, u need to strip your game bare. As much baked lighting as possible, simplice physics shapes, not many objects, use hardware skinning. Particles should be fine, but don’t go overboard.

I found some more things here we could elaborate on.
We’re not using emulators at all so their reliability isn’t a problem. The videos are all taken running on a PC and the reality tests are run on a Samsung GS2.

As of now, lights are the obvious problem. Making the background wall unshaded helped some, so we’ll probably go with that as soon as we figure what to do about lights on the wall. I think pre-rendered static textures are a good way to go for torch lights and window lights.

Turning off some of those lights also helps frame rate, so a combination of both is probably a good idea.

What is hardware skinning? (Edit: just went on google, will have a look). (Edit2 found this among other things
http://hub.jmonkeyengine.org/forum/topic/gpu-skinning-on-android/ )

I also know a few particles we can save on that will either not make a visual difference or that live longer than they have to. Will try that, but in general our particles don’t seem to be a problem yet.

By the way, I have the bad habit of not deleting the spot lights and camera from Blender when exporting, so some of those may hang on to the import and render in game. I’ve seen that they make some visual difference on the model, but we don’t need them since we have other lights. Could they have a big impact on performance?
I’ll look around and delete them right away and see what thay may do.

Hardware skinning is basically letting the Graphics card do the animating for you, rather than the CPU, it was only just introduced in the last few weeks:

http://hub.jmonkeyengine.org/forum/topic/hardware-skinning-patch-is-in-and-tested/

to use it, do:
[java]skeletonControl.setHardwareSkinningPreferred(true) ;[/java]

As for those lights from Blender, i’m not sure I’ve always deleted them ^^

1 Like

Potentially they could have a big impact, since the model is drawn once for each light…

It’s not as bad as lighting the whole scene multiple times but still pretty wasteful.

1 Like
<cite>@wezrule said:</cite> Hardware skinning is basically letting the Graphics card do the animating for you, rather than the CPU, it was only just introduced in the last few weeks:

http://hub.jmonkeyengine.org/forum/topic/hardware-skinning-patch-is-in-and-tested/

to use it, do:
[java]skeletonControl.setHardwareSkinningPreferred(true) ;[/java]

Will try. I didn't even know that a phone had a graphics card. Good to know. I suppose this requires a nightly build then? Haven't been able to install that, but this gives me one more reason to do so.

As for those lights from Blender, i’m not sure I’ve always deleted them ^^

<cite>@zarch said:</cite> Potentially they could have a big impact, since the model is drawn once for each light....

It’s not as bad as lighting the whole scene multiple times but still pretty wasteful.

Will also try deleting blender lights and report back. This is exciting.
A new wizard with ~250 triangles is on the way to replace the 1073 version of now, too.

Any idea how cheap or expensive U/V texturing is? I’m saving some triangles on the new wizard by painting his beard for example, the old one was made of some rough cloth, looking all nice on a 20x20 cm size on the pc screen, but for a 5mm wizard on the phone you wouldn’t notice. I Imagine this is a huge saving. Not that the beard and hair was thousands of triangles anyway, but relatively speaking.

uv texturing is pretty cheap.

<cite>@wezrule said:</cite>

I don’t have any numbers, I’ve not even used Android that much (going to soon tho), just going off everyone else’s experience. To be safe I wouldn’t go above 50K vertices and 100 objects. I wouldn’t even use a light, but apparently vertex lighting is supposed to be tolerable.

Are you saying you would use everything unshaded? That’s a bit of a sacrifice but yeah, I suppose lots of things can look good that way too. I first made a connection unshaded = untextured then realised that’s not what it is.
I suppose without lights you could use pretty much unlimited everything else. At least from my experience with this.

Some results of removing the internal lights that came with blender. No visual difference came of this
Bat - 1728 triangles before, 1154 after (model has about 240 triangles)
Wizard 3000/3500 before, 2000/2500 after (model has about 350 triangles)
Haven’t run it on the phone yet so can’t see if there’s a performance change, but will probably be able to test it tomorrow.

yh unshaded with baked in shadows ftw. The lighting system in jME for android is quite unfriendly atm, but there is a new awesome one in the works I think (hope :p).

Yes, shading and texturing are very different things - check out the hello materials tutorial for a reminder.

As you are making a mostly 2d platform game you mgiht use a lighting trick.

Make a blackish-gray transparent qaud on the gui node, then modify its texture to be more transparent around lights.
Depending on how fast it is possible to modify/update that texture your lighting then is quite fast.

<cite>@wezrule said:</cite> Hardware skinning is basically letting the Graphics card do the animating for you, rather than the CPU, it was only just introduced in the last few weeks:

http://hub.jmonkeyengine.org/forum/topic/hardware-skinning-patch-is-in-and-tested/

to use it, do:
[java]skeletonControl.setHardwareSkinningPreferred(true) ;[/java]

As for those lights from Blender, i’m not sure I’ve always deleted them ^^

Will it help me, if I’m not using animation models. I’m just moving static models around using drag and drop.

@simar.i3r said: Will it help me, if I'm not using animation models. I'm just moving static models around using drag and drop.

sorry it took me a while to reply. No it won’t help (and also wouldn’t even work), mostly because your model wouldn’t have a skeleton control