Author Topic: Performance with many objects, low fps  (Read 1422 times)

Offline MemphisM

  • byte
  • *
  • Posts: 4
    • View Profile
Performance with many objects, low fps
« on: February 13, 2014, 10:01:52 am »
First of all, thanks for the wonderful 3D engine.

I create Android app with many object3D. I need to know the parameters of each object, such as сenter, vertices, bounding box. Each object consists of 2-20 triangles and will respond to collisions (setCollisionMode(Object3D.COLLISION_CHECK_OTHERS)). And I use forceGeometryIndices(true);

The results:
186 Objects  - 24 fps and 186 draw calls per frame;
552 Objects - 12 fps.

Phone:
512 MB RAM
CPU    1 GHz
GPU    Adreno 205
Android 4.0

How to reduce draw calls and improve fps in my case?

« Last Edit: February 13, 2014, 10:13:46 am by MemphisM »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Performance with many objects, low fps
« Reply #1 on: February 13, 2014, 10:14:08 am »
Isn't that pretty obvious? Use less objects or, if possible, merge multiple objects to one. Each object requires at least one draw call. If it uses multiple textures, it will require even more.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Performance with many objects, low fps
« Reply #2 on: February 13, 2014, 10:15:14 am »
Apart from that, these are pretty low specs. What device is that, a Nexus One?

Offline MemphisM

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Performance with many objects, low fps
« Reply #3 on: February 13, 2014, 10:31:27 am »
Thanks!
My device is HTC One V.
I don't use any textures, only setAdditionalColor.

Unfortunately, I can't reduce the number of objects. Is the only way merge objects to one (In app I need to choose each object by touching)?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Performance with many objects, low fps
« Reply #4 on: February 13, 2014, 10:44:53 am »
Each object means one draw call. There's no way around this, because that's the way in which OpenGL works.

Offline MemphisM

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Performance with many objects, low fps
« Reply #5 on: February 14, 2014, 07:39:29 am »
I didn't say that the objects may overlap each other. For the overlapped objects I set visibility (obj.setVisibility(false)). And fps has improved.

Offline Varanda

  • byte
  • *
  • Posts: 27
    • View Profile
Re: Performance with many objects, low fps
« Reply #6 on: February 29, 2016, 01:53:39 am »
Hello,

I am searching on the forum for performance numbers but I was not able to find much data.
I would like to get a sense how much vertexes I can have in my scene to get >15 fps running in a 2 year old Android.
Also, how "expense" is bone animation (if relevant in terms of FPS dropping).

Is there any topic where developers report numbers like that?

Thanks,
Varanda

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Performance with many objects, low fps
« Reply #7 on: February 29, 2016, 08:38:45 am »
That's a rather difficult question, because it depends on a lot of things. It depends on the device ("2 years old" can be everything from some crappy $60 device up to a Galaxy S5), on the version of Android (because with 5.0, we had this shift in runtimes from Dalvik to ART) on your scene (a high polygon count can be caused by one or two larger objects as well as by many small ones and the performance differs largely between both even if the polygon count is actually the same), on the throttling strategy of the device etc...
As a rule of thumb, larger but few objects are usually faster than more but smaller ones. Rendering lots of polygons isn't as expensive as making lots of draw calls is.
For example, my game Naroth (https://play.google.com/store/apps/details?id=com.threed.jpct.games.rpg) runs @ around 20fps on most older devices. It renders one terrain with approx. 7000 polygons and many small objects like trees, bushes, gras, enemies, houses, particles etc, which range from 1 to 800 polygons each.

It might help to know, what exactly you want to render.

Offline Varanda

  • byte
  • *
  • Posts: 27
    • View Profile
Re: Performance with many objects, low fps
« Reply #8 on: February 29, 2016, 02:38:15 pm »
Naroth looks fantastic. Left a rate/review there. It is a big motivator for anyone to choose jPCT. I am sold already... will bug you guys for the nex few months :-)

My game will be much simpler. It has political motivation to fight corruption in Brazil... it will focus more on sending a message than the gameplay itself.
However, I believe that will be fun. A corrupt guy is climbing a particular building in a KingKong style; the Player, first person with a small chopper cockpit overlay, will flies around the building shooting fruits towards the kong. The idea is to stop him to reach the top. surround the building are other building (a couple 3D but most drawn in the Skybox). Kong can throw back rocks and may damage the chopper. All these elements have political meaning. I want to deliver this game ASAP to take advantage of the current political context; otherwise, It may not make much sense anymore.

Thanks for your help,
Varanda

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Performance with many objects, low fps
« Reply #9 on: February 29, 2016, 08:38:41 pm »
That doesn't sound too complicated at first glance. An older device should be able to handle that just fine.