Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

No spot/point lights in WebGl on iOs

Discussion in 'WebGL' started by wuannetraam, Nov 20, 2019.

  1. wuannetraam

    wuannetraam

    Joined:
    Oct 29, 2019
    Posts:
    87
    I'm working on a "simple" WebGL site. I've got a very basic scene with one point light in there without a shadow. It shows fine on all android devices. Also on pc and Imac it works fine. Except for iOs. On the Iphone and Ipad there is no light showing in the scene. It's build on WebGL1.0 in the latest Unity version. I've tested it on the latest stable Unity build too and no difference.

    Here is the example:
    https://cfxsquad.nl/pointlight/


    Hope you can help me out!
     
    Last edited: Nov 20, 2019
  2. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    It looks the same on my Mac (safari, firefox) and on my iPad(pro).
     
  3. wuannetraam

    wuannetraam

    Joined:
    Oct 29, 2019
    Posts:
    87
    Im sorry. My bad. I've updated this scene. This is the correct link:
    I'm sorry i linked to the wrong project. I've updated my post. This is the example scene I'm talking about.
    https://cfxsquad.nl/pointlight/
     
  4. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    We have the same issue fwiw. Our artists had to get creative to workaround it. IIRC not exactly a Unity bug as the lights worked on older Safari versions, but not newer ones. Hard to recall as it's been this way for like 2 years.
     
  5. wuannetraam

    wuannetraam

    Joined:
    Oct 29, 2019
    Posts:
    87
    How did the artists work around this? Any advice you have for me?
     
  6. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    I see the pointlight in Firefox (as a vertex light), but not Mac Safari.
    Scene failed to launch with a javascript error on my iPadPro.

    I think Safari is sabotaging you. Can you bake the lighting?
     
  7. wuannetraam

    wuannetraam

    Joined:
    Oct 29, 2019
    Posts:
    87
    Does cfxsquad.nl/asm work for you? I will combine light mapping with directional lights and make seperate layers for different objects to assign direct lights only to these objects to fake some point lights ish effect.
     
  8. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Yes, loads on my iPad
     
  9. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    944
    I am fairly positive this is due to something that we reported to Apple a while back, and they have since fixed, here is the bug: https://bugs.webkit.org/show_bug.cgi?id=169999 .

    As a really wild test, the following local hack might work around this: edit C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\library_gl.js, find around line 550:


    if (!ctx) return 0;
    var context = GL.registerContext(ctx, webGLContextAttributes);

    and replace it with

    if (!ctx) return 0;

    ctx.realGetSupportedExtensions = ctx.getSupportedExtensions;
    ctx.getSupportedExtensions = function() {
    return this.realGetSupportedExtensions().filter(function(ext) {
    return ext.indexOf('texture_half_float') == -1;
    });
    }

    var context = GL.registerContext(ctx, webGLContextAttributes);


    and do a re-export of the project. (You can also do the change to an already built development project by finding the same location in the generated framework.js file)

    Not sure if the above workaround really works, but might be worth testing out.
     
    sandstedt, gecko and kognito1 like this.
  10. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    Yes this works!!! Thanks @jukka_j !!!
     
  11. mikewilliams

    mikewilliams

    Joined:
    May 6, 2019
    Posts:
    1
    This work around worked for us. Thank you!
     
  12. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,238
    works for me too, thanks so much!