Search Unity

webgl performance in google chrome

Discussion in 'WebGL' started by gregory-tkach, Feb 15, 2017.

  1. gregory-tkach

    gregory-tkach

    Joined:
    May 20, 2013
    Posts:
    10
    Hello!

    We are busy developing a new game for both mobile and desktop (webgl). We are almost finished with but we have some questions and issues.

    We have a big issue with the performance of our WEBGL build in Google Chrome. In Chrome our game gets a horrible 15 FPS. However, this is not the case on every PC. We have tested it on OS X, Windows 10 and Windows 8 on 7 different pcs. On 2 of those PC's we reach a 15 FPS on Chrome, while on Firefox those PC's and other PC's reach a steady FPS of 40~60.

    We tried to enablked/disable WEBGL 2.0 at chrome://flags but that didn't worked. Also, we checked of any of our hardware is on the Blacklists (https://www.khronos.org/webgl/wiki/BlacklistsAndWhitelists and https://wiki.mozilla.org/Blocklisting/Blocked_Graphics_Drivers). This is not the case.

    We implemented also the following points: http://www.gamasutra.com/blogs/BenV...WebGL_Memory_and_Performance_Optimization.php. But still we don't tackle the problem.

    Also we optimized our game in the best way as we can (we have stable 60 fps on other browsers/pcs and editor).

    We have used the following technologies:
    - ugui
    - websockets
    - 3d renderers
    - 3d physic
    - 3d light
    Unity version is 5.4.1p2

    We have no idea what we should do to fix those FPS problems. I hope somebody can help us out with this. We have the following questions:

    1. Does somebody have a Unity game with a stable FPS of atleast 30+ on both Chrome and Firefox and tested on different PC's (high performance but also average PC's)? Are you able to share an url where we can test it? This proofs us that it should be possible to fix...
    2. Is this FPS issue caused by Unity or is this a known issue of Chrome? Because on Firefox it works fabulous.
    3. Chrome implemented webgl 2.0 on releaseversion 56, and it is stable already. It will help if we shift to webgl 2.0? Could we expect improving performance soon or in some estimated time frame?
    4. Does anybody have a tip to fix those performance issues especially on Chrome?
    5. Is there anything else that we can do in order to tackle the issue? Do you need something from us in order to find the issue? Some best practices maybe?

    I created some screenshots of the profiler which can be found here:
    http://take.ms/q9ITn
    http://take.ms/bbJj8
    http://take.ms/dYhZj

    Thank you very much for your time!

    Greg

    P.S. our profiler screenshots:
     
  2. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    328
    I suspect it's the lack of asm.js on chrome that is hurting you (webassembly will "fix" this). Obviously it's hard to say for sure from just a forum post. In situations where we are heavily cpu bound (skinned mesh rendering), chrome can be half the frame rate for us. Unfortunately outside of waiting, not much you can do other than try to reduce the load on the cpu.
     
    TheFrozenFires likes this.
  3. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    504
    From the profiler, it looks like you have a lot of allocations going on. You'll want the GC allocations to be as close to 0 as possible. Be sure to profile the actual build, not in editor.

    Also, whatever is happening to that scrollrect is taking up quite a bit of time.
     
  4. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    Chrome does support asm.js
     
  5. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    Here are two:

    As you can see here, Unity WebGL performance varies depending on the browser. Are both Chrome and Firefox 64 bit?

    We haven't measured performance of webgl1.0 vs. webgl2.0 but I would not expect much difference. Having said that, WebGL2.0 specs include new garbage free entry-points so basically there will be less CPU usage spikes due to the browser vm garbage collection. This will be available at some point after Unity 5.6.

    Another feature that will improve performance if you are CPU-bound, is GPU instancing which should be in 5.6 by the time it ships.
     
  6. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    460
    Nothing is impossible ^^ Hard but not impossible check out : http://www.war-attack.com

    But yeah dead trigger 2 is the perfect exemple
     
  7. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    328
    Is this recent? I've only seen the "Successfully compiled asm.js code" message in the browser console for Edge and Firefox. Obviously every browser "supports" asm.js as it's just javascript, but I was under the impression that Chrome doesn't enable any extra optimizations for asm.js like Edge and Firefox do.

    I will say I noticed in the console for a few Chrome revisions (I'm on the dev 64-bit branch) it would try to compile asm.js but seemed to always fail. At the moment, Chrome (58.0.3013.3) no longer appears to even try.
     
  8. gregory-tkach

    gregory-tkach

    Joined:
    May 20, 2013
    Posts:
    10
    Thank you for all information so far, really useful. We're doing some tests currently and will let you know if it works or not.
     
  9. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    The main difference is that Chrome does not compile asm.js Ahead-Of-Time.
     
  10. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Marco,

    Is GPU instancing fully available in 5.6.0f3 for WebGL? SystemInfo.supportsInstancing says yes, but when I use the Profiler the Rendering Window doesn't include (Instancing) details (whereas it does when the platform is switched to Android).

    Is this just an oversight in the Profiler or does instancing not work the same way in WebGL?
     
  11. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Sorry, looks like it requires WebGL 2.0 graphics emulation for instancing to be enabled. Is that correct?
     
    quietNix likes this.
  12. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    It does require WebGL2.0. I'll add a note to the docs. thanks.
     
unityunity