Search Unity

GPU Instancing WebGL

Discussion in 'Editor & General Support' started by mickfcna, May 27, 2020.

  1. mickfcna

    mickfcna

    Joined:
    May 13, 2019
    Posts:
    46
    Hi,

    I would like to know if GPU Instancing works in WebGL, when I activate it on Editor Mode, I have a huge impact of performances (from 10000 to 100 draw calls), but it does not seem to have any impact in my webgl build.

    I use the version 2019.3.

    Thank your for your help.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The Unity manual says GPU Instancing is supported on WebGL so long as using WebGL 2.0 API. Not all browsers have WebGL 2.0 support.

    Browser support: (Safari is the big one without 2.0, says Edge doesn't either but the page hasn't been updated since Edge switched to Chromium)
    https://docs.unity3d.com/Manual/webgl-browsercompatibility.html

    Some info on WebGL 2.0, including detecting if running with 2.0 support:
    https://docs.unity3d.com/Manual/webgl-graphics.html

    Says GPU Instancing only supported on 2.0:
    https://docs.unity3d.com/Manual/GPUInstancing.html
     
  3. mickfcna

    mickfcna

    Joined:
    May 13, 2019
    Posts:
    46
    Hello Joe-Censored,

    First of all thanks for your help
    I changed the build option to WebGL 2.0 but it did'nt change anything. I'm on the last version of Chrome, so it should wordk :-(

    Thanks in advance,
     
  4. mickfcna

    mickfcna

    Joined:
    May 13, 2019
    Posts:
    46
    Hello,

    Maybe the problem on WebGL it's not the draw calls it might be something else. To be really sure is it possible to know the number of draw calls in WebGL. I searched but don't know if it's possible.

    Thanks for your reply,
     
  5. mickfcna

    mickfcna

    Joined:
    May 13, 2019
    Posts:
    46
    Hello,

    Anyone has a response ?
    Thanks in advance
     
  6. Samasab

    Samasab

    Joined:
    May 13, 2018
    Posts:
    13
    I did a test where I disabled and enabled the GPU instancing of a shared material in a WebGL build using material.enableInstancing =

    First, this did not work, because the Instancing Variants graphic setting was set to 'Strip Unused', and this material variant was stripped out. Changing this to 'Keep All' solved it. -,A better way would probably be to use two different materials so the stripping doesnt think it is unused.

    When it works, the difference was significant, 150 cars (sharing same mesh and material ) rendered with twice as much FPS when the instancing was properly enabled. Hope this might help others.