Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

WebGL flickering screen on chromebook

Discussion in 'WebGL' started by crushforth, Jan 28, 2016.

  1. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    We're experiencing full screen flickering on our ASUS chromebook when running unity WebGL content. It flickers randomly all the time but in more easily repeatable when moving the mouse around the screen.

    Video showing our app & the angry bots webgl demo doing something very similar
    https://www.dropbox.com/s/amxm7b608vb8z99/20160128_135327.mp4?dl=0

    When the screen flickers it usually the same color as the cameras clear screen color.

    I've tried various webgl examples from http://threejs.org/examples/ on this chromebook but I can't get them to flicker like unity WebGL content.

    Are there some settings like backbuffer color depth or how the page flipping happens that I can play around with and try and track down what is causing this? Where would be a good place to look in the javascript?
     
    Last edited: Jan 28, 2016
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Do you get the same problem with a simpler Unity project ?
    Which version of Unity ?

    Perhaps you can try to tweak some of the render settings in QualitySettings=>Rendering or PlayerSettings=>OtherSettings=>Rendering
     
  3. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    I tried this with a simpler unity project. One was empty Unity 5 scene (with the default gray to blue skybox) and a cube. The flickering still happens but it is less frequent. Also when it flickers it was just the cube that flickers. So it seems to be rendering the skybox 100% of the time and very occasionally not rendering the scene objects (like the cube). Also tried it with an empty project with just a fresh import of NGUI. Same flickering but not as much as in our project. It seems to be the slower the frame rate the more the flickering. Both AngryBots and our project perform very badly and flicker a lot, but the very simple scenes run smoothly and flicker much less. I'm using the latest Unity 5.3.1p4 but have been switching between all the latest builds and patches from 5.3.1f1 & 5.3.1p1 to p4).

    Going to continue investigating this. I'll add more information and maybe submit a bug if I can track it down to something more concrete.
     
  4. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    Sort of bumping this thread in the hopes that someone more familiar with emscripten/unity WebGL has more insight into what could be causing this flickering issue.

    I've managed to reproduce this issue on a completely empty project & scene with a untextured cylinder.
    http://journey2050.staging.wpengine.com/webglflickertest/

    The above demo is a Development build so I could look at the code and try commenting out various places where the screen could be being cleared or the framebuffer swapped. Was surprised to find so much SDL code in there.

    What is frustrating is all the emscripten demos and other WebGL demos I can find all work perfectly with no screen flickering.

    I've added an issue on the chromium issue tracker but its not getting a lot of attention.
    https://code.google.com/p/chromium/issues/detail?id=583474

    @Marco Trivellato I've tried reducing the quality settings and enabling/disabling dynamic/static batching, and changing the rendering path from forward to 'legacy vertex lit'. Nothing really seems to make any difference.

    I'm going to go back a few Unity versions (probably to where WebGL was introduced) and see if maybe anything improves.
     
  5. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    I commented out the contents of both of the glClear functions and I've managed to eliminate the flickering (at the cost of not clearing the backbuffer).

    Code (csharp):
    1.  
    2.   function _glClear(x0) { /*GLctx.clear(x0)*/ }
    3.   function _emscripten_glClear(x0) { /*GLctx.clear(x0)*/ }
    4.  
    Seems somehow the clearing is happening at weird times throughout the frame. Not sure what is causing the issue. Don't think this is a unity issue and probably more an issue with a wonky ARM Mali driver or something that could be changed in emscripten.
     
  6. bigbrainz

    bigbrainz

    Joined:
    Jul 21, 2015
    Posts:
    175
    Hey, our friends found an odd, but simple fix for this:

    Enable Anti-aliasing.

    Weird, but turning that ON in the lower quality settings . . . or defaulting to higher quality settings . . . totally fixed it.
     
  7. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    Thanks for the info, I'll give that a try. I ended up only clearing the depth buffer:

    function _glClear(x0){if (x0 == 0x00004000) {return;} else {GLctx.clear(x0);}}

    and because this messed up all the transparency:

    contextAttributes.preserveDrawingBuffer=true;
    contextAttributes.alpha=false;

    Had to change the GLContext creation to preserve the drawing buffer and turn off the context's alpha (against the page). This gave us a workable webgl/chromebook version.

    I'd be interested in hearing from anyone who has done a WebGL chromebook app and share some performance tips. We were finding almost nothing we did had a significant effect on the framerate.
     
    Last edited: Mar 1, 2016