Search Unity

Unity Issue: "Too many uniforms" with PBR Master Node in URP Shadergraph in WebGL

Discussion in 'Universal Render Pipeline' started by ExatexX, Nov 20, 2020.

  1. ExatexX

    ExatexX

    Joined:
    Jun 24, 2018
    Posts:
    3
    I am experiencing issues with weird behaviour of shadergraph shaders in URP WebGL, with maps and values not being set. Upon investigation, I suspect "too many uniforms" to be the root cause.

    All shaders with the "PBR Master Node" seem to produce a shader error "Too Many Uniforms" and "Note: Creation of the internal variant of Shader ... failed" (blue, on the left). Even for the most simple pbr shader without any properties whatsoever. How to Reproduce: crate a new URP project, build target WebGL, create a new PBR shadergraph shader without any properties, assign to a new marterial and that to a simple cube. Build and run with WebGL.


    As a comparison: The unlit shader (red, on the right) does not show that behaviour.

    Since WebGL seems to have a 16 uniforms limit (unity itself does not warn about that), I tried to create the same error with an unlit shadergraph shader. Even at 32 color properties, the unlit shader worked as expected without any errors :



    I am currently on Unity 2020.1.0b11.3880, same behaviour in all browsers on my Mac. Can anyone else reproduce the error? Is there a fix? My business is quite dependent on this feature working.
     
  2. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Old post, but I am having a similar issue. My WebGL project made wit h2021.3.4f1 builds and works fine on PC desktop chrome, but on mac/safari, i get an error:error "Too Many Uniforms" and "Note: Creation of the internal variant of Shader Universal RenderPipeline/Lit failed", and "Note: Creation of the internal variant of Shader Universal RenderPipeline/SimpleLit failed".

    It is worth noting that the project worked just fine on mac and even IOS until recently. I am trying to revert to the point where it started causing problems but I haven't figured it out yet.

    Does anyone have the same problem ?
     
  3. dev_unity857

    dev_unity857

    Joined:
    Dec 1, 2020
    Posts:
    3
    Have the same problem, were you able to figure out?
     
  4. dhrodriguezg

    dhrodriguezg

    Joined:
    Nov 28, 2018
    Posts:
    1
    I'm having this problem only on WebGL for mobile devices using the regular Universal Render Pipeline/Lit (no shadergraph), it usually happens with some GL warnings:

    build.framework.js:3 WARNING: 0:2: 'GL_EXT_shader_texture_lod' : extension is not supported
    WARNING: 0:3: 'GL_EXT_shader_framebuffer_fetch' : extension is not supported
    ERROR: too many uniforms
    Note: Creation of internal variant of shader 'Universal Render Pipeline/Lit' failed.

    I'm using Unity 2022.1.10f1, and this error wasn't happening before back when I was using Unity 2019.4.14f1. It seems to be an URP issue, as it doesn't happen when using the built-in render pipeline.
     
    Last edited: Oct 3, 2022
  5. StayThirsty

    StayThirsty

    Joined:
    Jul 6, 2013
    Posts:
    42
    @dnach @Jonas-Mortensen

    Unity 2021.3.11f1
    WebGL
    URP 12.1.7
    On Android the Universal Render Pipeline/Lit, Simple Lit and Lit Shader Graph all fail with

    WARNING: 0:2: 'GL_EXT_shader_texture_lod' : extension is not supported
    ERROR: too many uniforms

    Desktop and iOS work fine but not Android. I've tried with an older device and a newer device
    The /Unlit shader works fine. Can anyone help with this issue?

    Edit: For runtime, I was able to hack a solution by searching for all meshes that use the URP lit/simplelit shaders and setting their material.shader to "Universal Render Pipeline/Lit" or "/Simple Lit". For whatever reason, it works. You need to have the shaders not be stripped in your Graphics Settings, and you probably need to have references to the materials that use those shaders in a scene
     
    Last edited: Oct 26, 2022