Search Unity

Bug WebGL doesn't support spotlight cookies under URP?

Discussion in 'Web' started by shwhjw, Mar 14, 2023.

  1. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi, spotlight cookies were added to URP somewhat recently, but I've found that WebGL doesn't seem to support them when also using URP (they do work the the standard renderer).

    Is this a known issue? Is there a plan to make URP spotlight cookies work in WebGL? I checked the cookie docs and URP docs and there is no mention of WebGL being different.

    Thanks,
    Si.
     
  2. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    273
    they *should* work in WebGL. can you send a sample project that shows the issue? (or better yet, create a bug report so I can get it triaged quickly :) )
     
  3. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi Ruba, I did submit a bug report on Sunday in the editor but didn't get any confirmation it'd been sent.

    I've attached a simple example project made with Unity 2022.1.23f1. It's literally just a URP project containing a spotlight with a cookie on a quad:
    upload_2023-3-14_23-20-51.png

    Here is the resulting WebGL build:
    https://sim0wn3d.itch.io/webglcookietest-urp (password is "cookie")
    upload_2023-3-14_23-21-32.png

    So it seems WebGL doesn't support cookies, unless there is something fundamental I missed? I deleted all Quality levels apart from the highest so there's no way it's dropped to lower quality graphics.

    I can try to submit another bug report if you think it's needed.
     

    Attached Files:

  4. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    I've just tried it in Edge and the cookie works in Edge! Why not Firefox?
     
  5. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    So after more testing, in Unity 2021.3 the simple cookie scene also works in Edge. But for some reason the 3d scene never loads in Firefox (I'm using 111.0 64-bit).
    With Unity 2022.1, the cookie also shows in Edge, and Firefox can load the scene but there is no cookie in the spotlight.
    So seems it might be a problem with the Unity WebGL player in Firefox. Are there any known issues?

    I am still having trouble with my runtime-created cookies in URP + WebGL + Edge (there is no light at all like the spotlights are disabled), but I guess that could be a scripting issue (they work in the Windows build). Will do some more testing over the next few days.
     
  6. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    273
    so, interestingly, when I open your itchio link on my M1 Mac mini and my intel Macbook Pro and I see "cookie" in all three browsers: Firefox 111.0.1, Safari 16.3, and Chrome 111.0.5563.110 (I've attached a screenshot of what I see). Was the expectation that the itchio game wouldn't show me the word "cookie"?
     

    Attached Files:

  7. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
  8. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
    Just to help out;

    I am on Win10.0.19045 Build 19045, Firefox 111.0 and can confirm that I cannot see "cookie" but it works in Chrome.

    Error log on Firefox:

    -------- Shader Universal Render Pipeline/Lit
    -------- GLSL link error: C:\fakepath(818,28-67): error X3067: 'int_ctor': ambiguous function call
    Warning: D3D shader compilation failed with default flags. (ps_5_0)
    Retrying with skip validation
    C:\fakepath(818,28-67): error X3067: 'int_ctor': ambiguous function call
    Warning: D3D shader compilation failed with skip validation flags. (ps_5_0)
    Retrying with skip optimization
    C:\fakepath(818,28-67): error X3067: 'int_ctor': ambiguous function call
    Warning: D3D shader compilation failed with skip optimization flags. (ps_5_0)
    Failed to create D3D Shaders
    --
    WebGL warning: linkProgram: Failed to link, leaving the following log: C:\fakepath(818,28-67): error X3067: 'int_ctor': ambiguous function call Warning: D3D shader compilation failed with default flags. (ps_5_0) Retrying with skip validation C:\fakepath(818,28-67): error X3067: 'int_ctor': ambiguous function call Warning: D3D shader compilation failed with skip validation flags. (ps_5_0) Retrying with skip optimization C:\fakepath(818,28-67): error X3067: 'int_ctor': ambiguous function call Warning: D3D shader compilation failed with skip optimization flags. (ps_5_0) Failed to create D3D Shaders
    --
    WebGL warning: drawElementsInstanced: Depth texture comparison requests (e.g. `LINEAR`) Filtering, but behavior is implementation-defined, and so on some systems will sometimes behave as `NEAREST`. (warns once)


    Error Log on Chrome:

    [.WebGL-00001DC001542A00] GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs.


    Hope it helps.
     
  9. Zarod

    Zarod

    Joined:
    Jan 20, 2016
    Posts:
    60
    Don't know if it helps, but it is long time knowledge that any of the lighting features work properly in webgl unity 2021.

    I know it is a pain, but i highly raccomand you to bake anything and everything you can.

    It's also understandable, cuz Unity is tasked to make something work on completely different devices.

    It is limiting, but both the performance cost and the bugs are not worth the cost of implementing such features, that hardly ever matter for gameplay 99 percent of the times.

    I know it's easy to flex to investors and potential costumers with fancy graphics and effects, but they really are not worth it imo

    I am not aware of any breakthroughs, even when trying to just fake it as you can incur into broken stage batching or additive transparent fragments, so it's either you fixing it or work around it by baking.