Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Request for help: Does your WebGL 2 game render correctly in Safari Tech Preview?

Discussion in 'Web' started by jukka_j, Feb 3, 2021.

  1. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Hi all,

    Apple is developing WebGL 2 support into Safari browser. For some while now, Safari Tech Preview has had experimental WebGL 2 support enabled by default. We are hoping towards speedy release of their WebGL 2 support, and have been coordinating with them to make sure that Unity WebGL 2 builds render properly on Safari Tech Preview.

    While we have run the browser through a battery of different test cases, it is no substitute to running it for real in the wild, and it is possible that there are issues that we have not caught. If you are developing a game for WebGL 2 and are interested in Safari, I would like to ask you to download Safari Tech Preview at https://developer.apple.com/safari/technology-preview/ , then build your game by disabling WebGL 1 from Graphics API list (disable Auto Graphics API project build option) and only enable WebGL 2.

    Finally, cross reference the results against Chrome or Firefox on the same device, and see if there are any differences. If so, please either report here on this thread, or open a bug using the Unity Bug Reporter and CC a link to this thread.

    This can help ensure more confidence that when Apple decides to release WebGL 2 by default, that it will have as few corner cases in Safari as possible.

    When doing this test, it can help to open the Safari Devtools web console to check if there are any errors that are printed. Even if everything seems to be rendering correctly, sometimes there can be rendering errors posted in the browser's log.

    If you gave it a spin, and everything did work out ok without bugs, it can also be helpful to post a "worked for me" comment in this thread.

    Help the world get rid of WebGL 1 finally :)
     
  2. lightmapper

    lightmapper

    Joined:
    Jan 14, 2015
    Posts:
    27
    We have a pretty complex application, and it worked!
     
    jukka_j likes this.
  3. Hypertectonic

    Hypertectonic

    Joined:
    Dec 16, 2016
    Posts:
    75
    Tested a project today, found 2 issues:
    - Fullscreen doesn't work (but I think this is not a problem in Unity's side)
    - I'm using cursor locking together with a mouselook script, and when the cursor lock is released, it stutters and dumps about 10 or 12
    Performance Warning: Recreating Offscreen FBO
    messages. This doesn't happen on Chrome, Firefox, or Chromium browsers.
    Also, performance is worse than in other browsers.
     
  4. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    @Hypertectonic Would you be able to post full logs about the Performance Warning event? And/or a video?
     
  5. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    242
    i don't have a mac here, but i asked 2 workmates to test it.
    and it seems it worked.

    you can test the build in my signature if u want.
     
  6. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Cool app - works great for me (Windows 10, Chrome).
     
  7. TallJohn

    TallJohn

    Joined:
    Dec 3, 2019
    Posts:
    12
    I know you asked about rendering but I tested our game Smash Karts on the tech preview and it has major audio issues.

    For now we are hosting a WebGL 2.0 only version - https://smashkarts.io/webgl2/

    Let me know if you have problems noticing the issue. For me I just need to start playing and the audio starts to break up and sounds really strange after about 30 seconds. We have never seen this issue before on normal Safari.
     
  8. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thanks for testing @TallJohn ! Any chance you'd be able to report the issue to https://bugs.webkit.org/ ? Or if you'd rather not go through the hassle, then would you be able to record a video showcasing the issue, and I can create a webkit bug and link to the forum thread here?
     
  9. TallJohn

    TallJohn

    Joined:
    Dec 3, 2019
    Posts:
    12
    No problem. Here is a video showing the audio issue.

    I was testing on -
    Safari Technical Preview: Release 120 (Safari 14.2, WebKit 16612.1.2.6)
    Unity 2020.1.17f1

    For now the WebGL2 only version of the game is available at https://smashkarts.io/webgl2/ I will leave it up there for the next few weeks at least in case anyone needs to check it out.

    @jukka_j please post the bug. I have not familiar with Webkit bug posting.
     
  10. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    TallJohn likes this.
  11. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    590
    Is there a way to install it on iOS? (Quick Google search had results only for Mac)
     
    TheVirtualMunk likes this.
  12. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    My understanding is that it requires a specially signed image from Apple, so no customer STP for iOS. (that is a bit silly :( ). At least I have not heard of any other way either.
     
    De-Panther likes this.
  13. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Thank you for starting this thread, jukka_j! It's great to see Unity continuing to invest in WebGL.

    Unfortunately, my site does not load at all under WebGL 2 in Safari on the latest version of macOS Big Sur + Safari.

    (Note: the site is not currently publicly accessible, so you aren't able to try it yourself, but I'd be more than happy to send you/others at Unity a link you can play around with — or even the full source if it'd be helpful.)

    Here are the browser logs from the site: https://gist.githubusercontent.com/...4af4a788a1107d482c4fb5f7967bd8/webgl2_big_sur

    Of note:

    1. The build is set to WebGL2 support only and works under Firefox and Chrome
    2. At one point I did allow WebGL 1 support for my game, and it did work under Safari (with a noticeably performance hit). However I've had to disable it since because I need to use the Linear color space and stencil/depth buffer, both of which have issues or are unsupported entirely under WebGL1 via Unity.

     
  14. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thanks for raising the issue @aromana . We should definitely sync up on this. Either of the two paths:
    1. Would you be able to slim down most heavy assets and excess scripts of that project, and report it as a bug to Unity tracker? We can then triage it to double check it is not something that is wrong in Unity, and route it out to Apple if needed, or
    2. Report it directly to Apple at https://bugs.webkit.org/ (though they'll need a repro link to run on)

    Let me know if one of these works.
     
  15. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Just submitted a bug including my full project. I mentioned your username in the bug report, hopefully you can find it that way (I've been on your end of this interaction a few times :)). Removing excess scripts might be challenging, but since the issue occurs with 0 user intervention (it fails to load entirely), it should be simple enough to see the issue. For reference, this is what you should expect to see if it loads successfully. The project should load to this screen under Firefox and Chrome.
     
    Last edited: Feb 23, 2021
  16. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Perfect, thank you so much! I'll give the QA a bit of time to go through the report and verify it. Sometimes they do cleaning/reduction steps of their own, which can be a lot of help for our dev team.

    @TallJohn Looks like Apple acknowledged the audio issue last night, and did some bisecting investigation on it already, so hopefully it will get resolved soon.
     
    TallJohn likes this.
  17. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Thanks! By the way, my project also suffered from the audio distortion bug being discussed above - actually back on Safari with WebGL1. At the time I noticed that there were a lot of “virtual audio channel exhausted” messages in the console coming from Unity. I didn’t look much more into the issue, but the issue did indeed seem to be correlated with the number of audio sources playing sounds in my game (there can be more than 100).
     
  18. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    590
  19. TallJohn

    TallJohn

    Joined:
    Dec 3, 2019
    Posts:
    12
  20. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,998
    Any idea when WebGL 2 goes live in main safari (non preview)?
     
  21. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    449
    Keep an eye here; https://webkit.org/blog/

    Looks like the next release will contain the WebGL update as the last one contained updates up to release 109. The WebGL update is release 114.

    So it should be released anytime soon as the last main release was in November.
     
    MadeFromPolygons likes this.
  22. ManjitSBedi

    ManjitSBedi

    Joined:
    Mar 8, 2014
    Posts:
    58
    With iOS 14.5 and Mac OS 11.3 just being released, I tried a WebGL project out. The project loads which is great!

    The project has a video playing in it. I have a switch to toggle the audio on as in a web page as audio is muted when a page is first loaded; the toggle does not work in Safari; in fact, the video will stop playing on MacOS; the video does not work at all on iOS, an error dialogue pops up. I needed to enable WebGL 2 in the Safari advanced settings on iOS.

    In comparison, I have tested the project with the Brave browser on MacOs and it works with the audio toggle switch; it works with Edge on Windows.

    The project does not work at all with FireFox on MacOs. I have been using Unity 2020.3.4f1.

    The project is hosted using GitHub pages.
    https://manjitbedi.github.io/Gallery/
     
  23. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    I think STP on iOS is now at a stage where it should have WebGL 2 default enabled without needing to apply for Beta program. However we still do not know when Apple will release WebGL2 to macOS and iOS Safari in the stable channel, they have not announced when that would happen. If they branch out a new major Safari version for next WWDC like they often do, maybe it will be out there, but we don't know yet :(
     
    De-Panther likes this.
  24. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    What was the error dialog text?

    I wonder if you have a chance to try out latest 2021.1 or 2021.2 channels whether the issue persists there?
     
  25. ManjitSBedi

    ManjitSBedi

    Joined:
    Mar 8, 2014
    Posts:
    58
    Hi,

    I just tried the web page again. The video plays without audio on a 2020 iPad Pro with iOS 14.5. The error with no video on the iPhone X is:

    NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
    play@[native code]
    _JS_Video_Play@blob:https://manjitbedi.github.io/c740e4f0-d849-471d-ba13-a39ad5881332:2:52552
    wasm-stub@[wasm code]
    <?>.wasm-function[22927]@[wasm code]
    <?>.wasm-function[23095]@[wasm code]
    <?>.wasm-function[23091]@[wasm code]
    <?>.wasm-function[23167]@[wasm code]
    <?>.wasm-function[23168]@[wasm code]
    <?>.wasm-function[23170]@[wasm code]
    <?>.wasm-function[57483]@[wasm code]
    <?>.wasm-function[56104]@[wasm code]
    <?>.wasm-function[56103]@[wasm code]
    <?>.wasm-function[24507]@[wasm code]
    <?>.wasm-function[60149]@[wasm code]
    wasm-stub@[native code]
    blob:https://manjitbedi.github.io/c740e4f0-d849-471d-ba13-a39ad5881332:2:470703
    invoke_iiiii@blob:https://manjitbedi.github.io/c740e4f0-d849-471d-ba13-a39ad5881332:2:336020
    <?>.wasm-function[60149]@[wasm code]
    <?>.wasm-function[58216]@[wasm code]
    <?>.wasm-function[57644]@[wasm code]
    <?>.wasm-function[4604]@[wasm code]
    <?>.wasm-function[4602]@[wasm code]
    <?>.wasm-function[8616]@[wasm code]
    <?>.wasm-function[8614]@[wasm code]
    <?>.wasm-function[10689]@[wasm code]
    <?>.wasm-function[8856]@[wasm code]
    <?>.wasm-function[11116]@[wasm code]
    <?>.wasm-function[10791]@[wasm code]
    <?>.wasm-function[10791]@[wasm code]
    <?>.wasm-function[10786]@[wasm code]
    <?>.wasm-function[10779]@[wasm code]
    <?>.wasm-function[60168]@[wasm code]
    wasm-stub@[native code]
    blob:https://manjitbedi.github.io/c740e4f0-d849-471d-ba13-a39ad5881332:2:480283
    browserIterationFunc@blob:https://manjitbedi.github.io/c740e4f0-d849-471d-ba13-a39ad5881332:2:171272
    runIter@blob:https://manjitbedi.github.io/c740e4f0-d849-471d-ba13-a39ad5881332:2:174337
    Browser_mainLoop_runner@blob:https://manjitbedi.github.io/c740e4f0-d849-471d-ba13-a39ad5881332:2:172802

    I have not been working with Unity 2021 on this project (so far).
     
  26. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thanks, now that I search the bug database, this "NotAllowedError" does look like a known issue that is on the task list, but has not yet been assigned to a developer. I think there was someone on the WebGL forums who was developing a GitHub repo with a Safari-specific workaround to starting video playback on iOS. Can't quite recall where that was though..

    If I understand correctly, the NotAllowedError does not occur if the video does not have an audio track in it?
     
  27. nixcry

    nixcry

    Joined:
    Mar 13, 2017
    Posts:
    5
    The browser console log is like this:

    Performance Warning: Recreating Offscreen FBO (1244x703 => 408x231)
    view3d.framework.js:3 Performance Warning: Recreating Offscreen FBO (408x231 => 507x286)
    view3d.framework.js:3 Performance Warning: Recreating Offscreen FBO (507x286 => 1116x631)
    view3d.framework.js:3 Performance Warning: Recreating Offscreen FBO (1116x631 => 144x81)
    view3d.framework.js:3 Performance Warning: Recreating Offscreen FBO (144x81 => 948x536)
    view3d.framework.js:3 Performance Warning: Recreating Offscreen FBO (948x536 => 897x507)
    view3d.framework.js:3 Performance Warning: Recreating Offscreen FBO (897x507 => 926x523)
    view3d.framework.js:3 Performance Warning: Recreating Offscreen FBO (926x523 => 1101x622)
    view3d.framework.js:3 Performance Warning: Recreating Offscreen FBO (1101x622 => 1104x624)

    Effects:
    1. Continuous log output in the browser console.
    2. Obvious, repeated image flickers on the canvas.

    Recurrence conditions:
    1. Only happens in Linear Color Space.
    2. Only happens during the canvas size changing( eg. enter/exit full-screen-mode, responsive size changing by javascript)

    This still happens in Unity 2021.3LTS, in Feb. 2023.
     
  28. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,503
    just adding test report, if this thread is still relevant..

    works for me,
    But had to disable "Desktop browsing" on ipad Safari, otherwise Touch wouldn't work..