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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Question URP/Terrain/Lit shader erroring in WebGL builds

Discussion in 'Universal Render Pipeline' started by ApacheMatt, Jun 23, 2023.

  1. ApacheMatt

    ApacheMatt

    Joined:
    Sep 25, 2012
    Posts:
    1
    Running into an issue using Unity Terrain on the web. Works fine in the editor but in a WebGL build we're not getting any of the detail, and the console is throwing the following error

    -------- Shader Universal Render Pipeline/Terrain/Lit
    -------- GLSL link error: FRAGMENT shader texture image units count exceeds MAX_TEXTURE_IMAGE_UNITS(16)

    I'm not a strong shader coder (only just started looking into them), but it appears that the URP/Terrain/Lit shader is simply using too many Texture Samplers. I have attempted playing around with the shader to reduce these but as I've said, not really sure what I'm doing. Does anyone know if there is a Web friendly version of the shader, or some other solution to the problem?

    We are aware we can export the mesh into our 3D software and make the textures manually but there's a high likelihood that the terrain is going to change during development so we don't want to have to do that every time there's an update.

    Terrain in Editor


    Terrain in Web
     
  2. AceJiang

    AceJiang

    Joined:
    Dec 14, 2019
    Posts:
    14
    same problem
     
  3. CarlosCabrera26

    CarlosCabrera26

    Joined:
    Mar 14, 2022
    Posts:
    1
    I got the same problem here. I'm only able to see the detail grass on terrain on Ubuntu with Chromium, W11 with Edge, Chrome, Opera, Firefox shows nothing and gives this same error code