Search Unity

URP including too many Terrain Shaders in WebGL Bundles

Discussion in 'Universal Render Pipeline' started by bigbrainz, Jun 29, 2020.

  1. bigbrainz

    bigbrainz

    Joined:
    Jul 21, 2015
    Posts:
    177
    We have to be very careful with the size of our asset bundles. With 1 fairly simple terrain material that uses the URP/Terrain/Lit shader. For some reason URP is including TerrainLit, TerrainLitBase and TerrainLitAdd shaders, which together are doubling the size of our bundle.

    Is this a bug? Does the Terran/Lit shader really need all three versions? Is there something we can do to get Unity to be much more efficient with these terrain shaders in bundles?

    Thanks!

    upload_2020-6-29_7-54-21.png
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,023
    If you look into the code for TerrainLit shader, it declares some dependencies:
    Dependency "AddPassShader" = "Hidden/Universal Render Pipeline/Terrain/Lit (Add Pass)"
    Dependency "BaseMapShader" = "Hidden/Universal Render Pipeline/Terrain/Lit (Base Pass)"
    This is why they get included as well.
     
  3. bigbrainz

    bigbrainz

    Joined:
    Jul 21, 2015
    Posts:
    177
    Got it. Thank you!
     
    aleksandrk likes this.