I have an animated character model which is currently ~2100 polys using a standard Max skeleton and the FPS drops like crazy when adding them to the screen. This is with nothing else happening or in the scene, as soon as I add any logic or anything else it gets even worse.
iPad 4 (desktop sits in the 50s, typically closer to 60, until adding 8 or more);
0 - 60 fps
1 - 50-55 fps
2 - 50-53 fps
3 - 35-40 fps
4 - 30 fps
5 - 30 fps
6 - 30 fps
7 - 26 fps
8 - 20 fps
9 - 20 fps
10 - 20 fps
Is there something I can do to get this working better ?
I was hoping to have the main characters a few other characters and a bunch of cubes, simple environment, on screen at once; but I canāt even have a few character models without too much slow down.
Itās easier to do this in Chrome on the desktop, and you might get similar results. But it may be a different area causing the slowness on the ipad, so itās worth trying it on the device if possible.
Hmm, Iām not really seeing anything, after the loading is done and the SplashScreen is removed there doesnāt seem to be any info showing up in the inspector.
(http://i.imgur.com/FqVVj74.jpg) - The end of the marks in Layout & Rendering and JavaScript & Events is when the game finished loading and actually showed the scene with the characters standing there animating.
Even just having a few blocks (made up of 1 - 4 cube meshes) falling using this.entity.translate on a parent entity (so all the cubes move together) causes the framerate to go up and down and run kinda slow.
Note that after adding a couple characters it will often immediately drop to a solid 30fps (from about 50) for the next few, maybe thereās something in WebGL that may be causing the fps to be capped/throttled or something ?
Sounds like Vsync. On my computer things run at binary fractions of 60FPS: 60, 30, 15, 7.5ā¦
I donāt think you can get around this.
Maybe Iām just old, but in my opinion, this is probably too many. You arenāt running on gaming quality hardware and this isnāt a native game engine. Itās running in a web-browser.
Animated things tend to use a lot of processing power per polygon, particularly if you have a lot of bones. Inverse Kinematics (IK) also uses a fair chunk.
So try use fewer polies and instead introduce some normal maps.
[quote]Sounds like Vsync. On my computer things run at binary fractions of 60FPS: 60, 30, 15, 7.5ā¦
I donāt think you can get around this.[/quote]
Hmm, it only seems to really lock to 60 or 30, other than that it seems to be whatever. It jumps around so much itās hard to tell though.
[quote]Maybe Iām just old, but in my opinion, this is probably too many. You arenāt running on gaming quality hardware and this isnāt a native game engine. Itās running in a web-browser.
Animated things tend to use a lot of processing power per polygon, particularly if you have a lot of bones. Inverse Kinematics (IK) also uses a fair chunk.
So try use fewer polies and instead introduce some normal maps.[/quote]
The artist and animator will not like that. haha. But I guess we have no other choice; even when removing the skeleton all together to just have the model I canāt even get to 10 without big performance hits.
2100 triangles for a character model sounds reasonable for a PlayCanvas game running on mobile.
There are two possibilities for the performance drops you describe.
You are CPU bound.
You are GPU bound.
You can become CPU bound if you submit too many draw calls to the hardware. In PlayCanvas, a draw calls is a āmesh instanceā. This is essentially a collection of triangles with the same material in a model. (Note that CPU cost is not per-polyon!) For a typical mobile game using PlayCanvas, you probably want to keep the number of draw calls down to about 200 or fewer.
You can become GPU bound by either maxing out the vertex transform or pixel fill capability of the GPU. Typically, itās rare to see the GPU bottlenecked on vertex transform. Itās far more likely the GPU is struggling to fill the screenās pixels with the fragment programs used by your sceneās shaders.
I suggest you create and link a simple public project that exhibits performance characteristics that you do not expect or cannot explain and Iāll take a look.
Once the loading is done. Select Javascript & Events. Clear this panel. Then click the Red dot to record some profiling information. You should see a set of events one for each frame.
You can expand out each function and see how long each one took. You can also sort by Total Time to put the most expensive at the top.
This should give you rough overview of what is taking up time. e.g. if your update is taking longer than render. Then your scripts are doing something slow.
Hmm, that could explain the slow down after only a couple then. I checked and each character is using 34 draw calls, and each block 1. So it seems like the character has too many meshes ? (Iām not an artist by any means, so Iāll need to pass info along to the modeller).
Hmm. It seems as though ammo is taking way too long. As soon as I add any of my kinematic rigidbodies it slows down and ammo is using pretty much all the time ⦠Any idea why ?
All Iām doing is duplicating one of my āprefabā shapes that consist of 1-4 cubes each with a kinematic rigidbody which I listen for collisionstart events (removing those listeners didnāt really change anything) and then move then every frame using entity.translate on their parent entity (so they all move together).