Search Unity

Bug Build rendering different on browsers

Discussion in 'Web' started by blraj, Mar 5, 2023.

  1. blraj

    blraj

    Joined:
    Jan 24, 2023
    Posts:
    9
    Hi, I have created a webgl project which works as expected in unity, but once it's built and on unity play, it renders different for different browsers. I followed the warning to remove webgl 1 but on safari it shows as black and white pixels to the point it's unrecognisable and on chrome, the lighting follows the user which is also incorrect and pixellates some of the meshes like a glitch.

    Here's the published build to see the issues: https://play.unity.com/mg/other/creative-core-game-build
     

    Attached Files:

  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,981
    Can't load, stuck at 90%.

    Generally speaking, WebGL is a severely limited target platform. Even if it runs on your desktop with many cores and fast GPU, it just does not support many of the modern features. It's easy to break WebGL builds by using postprocessing effects such as bloom or using complex shaders and generally shadows. Also the choice of render pipeline is critical, URP is highly recommended over built-in.

    You will have to strip down your build to a bare minimum set of rendering features and then turn them back on one by one to see if WebGL can manage.
     
    blraj likes this.
  3. blraj

    blraj

    Joined:
    Jan 24, 2023
    Posts:
    9
    It seems to be the third person starter asset scene that is where it is happening. I started a new URP project for webGL, added the asset and used the playground scene provided, converted it to URP (maybe I missed something there) and it was this exact issue, but not sure what needs fixing there
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,981
    This is the one I know as "Third Person Starter Asset", it's a template when starting a new project from the Hub. But that doesn't seem to be the asset you used.
    upload_2023-3-6_20-30-32.png
     
  5. blraj

    blraj

    Joined:
    Jan 24, 2023
    Posts:
    9
    This is the one I used, here is a screenshot of how just the plain playground scene builds instead of my full project
     

    Attached Files:

  6. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,981
    What Unity version? For WebGL projects I would recommend the latest tech stream, 2022.2 that is.
    Since you mention Safari I assume this is running on a Mac. What model?
    Since these glitches happen across browsers I would normally suggest checking video driver updates on a Windows system.
     
  7. blraj

    blraj

    Joined:
    Jan 24, 2023
    Posts:
    9
    Unity 2021.3.16f1 on M1 MacBook Pro at the moment. I'll install and try 2022.2, does it matter that its not LTS?
     
  8. blraj

    blraj

    Joined:
    Jan 24, 2023
    Posts:
    9
    It's still rendering glitchy in 2022.2 like this:

    Update: when I remove one of the objects' cinemachine components it looks a bit better but still not right, although I need these to move the camera and character
     

    Attached Files:

    Last edited: Mar 6, 2023
  9. blraj

    blraj

    Joined:
    Jan 24, 2023
    Posts:
    9
    Another update, once I added either the MainCamera or PlayerFollowCamera to a new scene, even after deleted them then this glitching starts happening
     
  10. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,981
    Do other WebGL games on that Unity publishing site work or do they also render with glitches? There are also general WebGL compatibility tests and benchmarks you could try.

    The M1 series CPU may have some video issues with WebGL is my suspicion, or it may be faulty to begin with but I wouldn‘t go that far if other 3d apps work fine.
     
    blraj likes this.
  11. blraj

    blraj

    Joined:
    Jan 24, 2023
    Posts:
    9
    Seemed to have found the issue! The Player settings quality for webgl was set as some automatic option by unity that was using one of their render pipeline assets. I created a new unedited pipeline asset and made sure webgl used that one instead of unity's ones. Thanks for the help! :)

    Other games on unity play look fine so I am hoping it was just this causing it but I would like to learn about those general webGL compatibility tests and benchmarks