Search Issue Tracker

Fixed in 2017.1.0f3

Votes

0

Found in

5.6.0f3

Issue ID

898067

Regression

Yes

Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' faulty replacement breaking shader

Shaders

-

Steps reproduce:
1. Open attached project
2. Open ShadowMeta.cginc
3. Replace UnityObjectToClipPos(pos4) to mul(UNITY_MATRIX_MVP, pos4)
4. Save script
5. Notice that mul(UNITY_MATRIX_MVP, pos4) is upgraded to UnityObjectToClipPos(pos4)

Expected result: mul(UNITY_MATRIX_MVP, pos4) should not be replaced with UnityObjectToClipPos(pos4)

Reproduced in: 2017.1.0a6, 5.6.0f3, 5.6.0f2
Not reproduced in: 5.6.0f1, 5.6.0b11, 5.6.0b1 ,5.6.0a1, 5.5.3f1

Regression since: 5.6.0f2

Comments (16)

  1. toolparaphrase

    Jan 12, 2020 18:37

  2. farrukhnawaz

    Oct 24, 2019 13:12

  3. farrukhnawaz

    Jul 28, 2019 05:37

    I have 5.5.0 and i get this error when i follow the survival shooter tutorial made by unity. It happened when i switched the camera to orthographic mode.

    https://mobilefone.pk/brand/oppo/

  4. lshinamashiro_unity

    May 23, 2018 07:18

    #define UNITY_SHADER_NO_UPGRADE 1
    that is a grate idea

  5. cfazilleau

    Apr 06, 2018 14:36

    marked fixed but broken again on 2017.3.1f1

    I fixed it by placing
    #define UNITY_SHADER_NO_UPGRADE 1
    at the beginning of the shader.

    It prevents unity from fixing the shader because you are the dev, so you are the one who fix the bugs

  6. rtilton1

    Dec 14, 2017 05:57

    Also seeing this issue in 2017.2

  7. andybak

    Nov 20, 2017 12:58

    Still broken in 2017.2

    Try opening this: https://github.com/mattatz/unity-photo-particle-system

    and look at the error for either the billboard or butterfly shaders.

  8. toddw

    Sep 11, 2017 18:20

    There's a better way to fix this than SK_AVARITIA's suggestion. Simply replace all lines that were converted to this:
    o.position = UnityObjectToClipPos(v.position);

    with this:
    o.position = UnityObjectToClipPos(float4(v.position.xyz, 1.0));

    The compiler won't attempt to replace it again and it works fine for me.

  9. pigshape

    Jun 23, 2017 11:33

    @SK_AVARITIA

    It worked great for me!!Thanks!

  10. sk_avaritia

    Jun 16, 2017 20:00

    I used "UNITY_VERSION" and "UNITY_SHADER_NO_UPGRADE" then my code worked.
    I hope that I will be helpful for everyone.

    [before]
    o.vertex = UnityObjectToClipPos(v.vertex);

    [after]
    #if UNITY_VERSION >= 560
    o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
    #else
    #if UNITY_SHADER_NO_UPGRADE
    o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
    #endif
    #endif

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.