Search Issue Tracker

Fixed in 7.2.0

Votes

6

Found in [Package]

7.1.1

Issue ID

1185948

Regression

Yes

[URP] [Terrain] Shader exception is thrown on creating Terrain game object with URP Template.

Package: Scriptable Render Pipeline Universal

-

Shader exception is thrown on creating Terrain game object with URP Template.

How to reproduce:
1. Create a new project with URP Template.
2. GameObject > 3D > Terrain.

OR

1. Create a new project using URP
2. In the Project view, navigate to Packages/Universal RP/Shaders/Terrain
3. Reimport the "TerrainLitBase" shader

Expected results: The shader successfully compiles
Actual results: The shader does not compile and throws an "unrecognized identifier 'Varyings'" error

Reproducible with:
URP 7.1.6, 7.1.5, 7.1.1 (209.3.0f3, 2019.3.0b4, 2020.1.0a5)

Not reproducible with:
URP 7.0.1 (2019.3.0b4, 2020.1.0a5),
LWRP 6.9.1 (2019.2.7f1)

  1. Resolution Note (fix version 7.2.0):

    Fixed in URP 7.2.0

Comments (3)

  1. Randolin

    Jan 07, 2020 06:05

    I ran into this with 7.1.7 URP on Unity 2019.3.0f3 while setting up a new project with a 2D Renderer. The issue was with TerrainLitMetaPass.hlsl in this case.

    I don't claim to even remotely understand the inner workings of the URP or shader code; however, I was able to resolve it (at least superficially) by adding in definitions for Varyings and Attributes. I used LitMetaPass, SimpleLitMetaPass and BakedLitMetaPass as a point of reference in the parent folder:

    struct Attributes
    {
    float4 positionOS : POSITION;
    float3 normalOS : NORMAL;
    float2 uv0 : TEXCOORD0;
    float2 uv1 : TEXCOORD1;
    float2 uv2 : TEXCOORD2;
    #ifdef _TANGENT_TO_WORLD
    float4 tangentOS : TANGENT;
    #endif
    };

    struct Varyings
    {
    float4 positionCS : SV_POSITION;
    float2 uv : TEXCOORD0;
    };

    Once these were declared in the file above the methods that required those definitions, it no longer throws a console error and might even work.

    Maybe this will help someone.

  2. grasski

    Dec 03, 2019 19:12

    I have also this issue. Can not work with it, Unity everytime crash! :(

    7.1.6 URP and Unity 2020.1.0a.14, also had in 2019.3.0f1

  3. Ghosthowl

    Dec 01, 2019 14:31

    I am also having this issue with 7.1.6 URP - 2019.3.0f1. Currently I have no idea how to solve it.

Add comment

Log in to post comment