Search Unity

Shader not working when switched to WebGL

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

  1. PelvisParsley

    PelvisParsley

    Joined:
    Aug 9, 2016
    Posts:
    89
    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:
    12,343
    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.