Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Shader not working when switched to WebGL

Discussion in 'Shaders' started by PelvisParsley, Apr 11, 2021.

  1. PelvisParsley

    PelvisParsley

    Joined:
    Aug 9, 2016
    Posts:
    57
    I'm trying to add the shaders mentioned here, according to the instruction:

    http://willweissman.com/unity-outlines

    I switched the renderer on the PC/Mac/Linux platform to OpenGLES 2.0 but it still runs fine. As soon as I switch to WebGL, the effect stops working. The editor shows the renderer as OpenGLES 2.0. Also, building to WebGL release does not change anything. Does anyone know what could be causing this and how it could be fixed?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    10,408
    If you switch to "OpenGLES 2.0" on a desktop it's still running Direct3D, Vulkan, or Metal (whatever the default is for that desktop platform), it's not actually running OpenGLES 2.0. It's only emulating OpenGLES 2.0 by turning off support for some features that GLES universally will not support.
    https://docs.unity3d.com/2018.4/Documentation/Manual/GraphicsEmulation.html

    This will do some basic checks on the shader to ensure it's not doing some hard limits of GLES 2.0, but GLES 2.0 has a very wide range of capabilities and Unity is essentially only covering a very high level list of known limitations. WebGL's limitations are similar to, but not exactly the same as GLES 2.0, so switching to WebGL likely more accurately emulates that API's limitations.
     
unityunity