Search Unity

"Draw Instanced" terrain horribly slow and choppy on WebGL

Discussion in 'Web' started by ferretnt, Mar 23, 2021.

  1. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Why? I would have thought the lesser CPU load of this would help WebGL and the horror that is having Unity's highly-optimized core run as Javascript out?

    Is it possible this will improve at any point?

    Also, is it possible to get per-pixel lighting with a normal map on terrain (assume I'm happy to write my own shader, but don't want to reinvent the terrain engine because that's rather more work...) without Draw Instanced?
     
  2. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Anybody? WebGL instanced terrain is unusable due to framerate issues, which in turn means per-pixel lit terrain on WebGL is unusable (because per-pixel lighting is actually bound to instancing. I have some sympathy for why Unity did this.)

    I can sort of see how to get around this by manually using a Graphics.Blit to compute the terrain normal map ourselves (terrain.terrainNormalMap returns null if not using instancing) and pass it to a shader, but it's going to be days of work to test and debug carefully, and it feels like the underlying problem is that there isn't a reason for instanced terrain to be slower on WebGL than regular terrain is. There's not more CPU work to draw the instanced terrain, there's less!