Search Unity

Gpu artifacts?

Discussion in 'Web' started by AlexHell, Apr 26, 2019.

  1. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    Hello! Our project use runtime mesh and texture creation, mostly on renderTextures on GPU side, and finally output to the screen (from final RT).
    Sometimes our users report about visual artifacts with incorrect blending and transparency on the screen. We cant reproduce this artifacts.

    Example of artifacts http://prntscr.com/ngypu3
    normally the model's legs must be not transparent, but in this screenshot it has transparency pattern, and the background is visible throught the legs.
    The pattern must be taken into account, it's not our texture, we dont have textures with this "pattern of dots" through which the backgound is visible.
    Sometimes it's blended with incorrect alpha.

    Normal legs must be like this http://prntscr.com/ngyre1 without dots and without background visible through legs.

    Main target is WebGL.

    Previously we have found some (but not equals) artifacts on android, and on PC windows; after some mesh count and memory optimization we have avoid this artifacts on PC win (notebooks) and android.
    But currently we have artifacts in WebGL.
    After previous experience (artifacts on PC and android) my hypothesis - it's gpu memory issue now as previous.

    One of our users give me a screenshot where GPU memory graph is 1600-1900 MiB, when 2000 MiB is limit (GTX 1050 with 2 GiB memory),
    http://prntscr.com/ngym2e
    (as I understand it's from some tool)
    and he has visual artifact on the screen in the tab with our game.

    Also with similar memory usage, the same user - does NOT have this artifact.
    Artifacts appering and hiding. On the same machine, with the same gpu memory usage.

    Artifacts appearing in other users' machines too.

    Questions:
    1) Does memory from webGL taken into account on this graph?
    2) Which tool we can use to monitor users' gpu memory on his target machines? Any examples please.
    3) Why artifacts is appear, but not crash due to out of memory (GPU memory). It would be better to take exception on webgl when memory is near limit, and not take visual artifacts what can't be automatically detected.
    4) Can it be browser \ unity \ webgl \ GPU driver - related artifacts?

    5) Can it be our code artifacts? But as I understand, if we create a bug in our shader code for example, it must appear not spontaneously, but on all machines. If it will be float precision (as I have fix in previous) it also would be all the time on the same input. Buy it's not the same output with artifacts, or without artifacts, when the input is the same. Input is some renderTextures, processed with shaders for blending, etc.

    May be I incorrectly use sync on shaders? Don't found any sync. I have clear any RT before render to it, and reuse all of my RTs. For example I use code like this to append to textureResult, many calls of Graphics.Blit
    Code (CSharp):
    1. _materialMyMultAlphaSimple.SetTexture("_TopTex", textureColored);
    2. _materialMyMultAlphaSimple.SetTexture("_BottomTex", textureBack);
    3. Graphics.Blit(null, textureResult, _materialMyMultAlphaSimple);
    * It may be related - sometimes our users takes "webgl context lost" warning in the browser console, and the screen turns to black. As I understand from docs https://www.khronos.org/webgl/wiki/HandlingContextLost "webgl context lost" can appear due to long running task (we have many calculations on the CPU side to procedural generate mesh etc) (also some sources tries to confirm this), but also due to "browser decided to lost contest to your app, it can be at any moment" like trifle..

    Remark: it's not the same Set of users, and the cases. For example one users takes "webgl context lost" and black screen, but not see transparency artifacts. And vise versa.
    6) Can "webgl context lost" be the case of GPU-OutOfMemory? (my name)
    7) Can "webgl context lost" be related to artifacts?
    Or it's other, not related case, which we must handle properly (can't understand - how to handle).
     
    Last edited: Apr 26, 2019
  2. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    any expert?