Search Unity

2018 Built-In shader source... booby-trapped?

Discussion in 'Shaders' started by ginconic, Jun 3, 2018.

  1. ginconic

    ginconic

    Joined:
    May 19, 2015
    Posts:
    89
    This might be some weird case of a jinx. But I though it might be worth asking whether that's the case.

    So I've been trying to port my CFTD shader to (hopefully, maybe someday) metal with the help of another unity user. The idea was to get tessellation working. Personally I'm still on 5.6 btw.

    Upon downloading the built in shader zip for 2018.1 (or 2018.2) and dropping that in an empty project the user is greeted with a bunch of compile errors on the gui code. Fair enough, all I need is the shader cgincs; just scrape those gui cs-s. Then there is something strange.
    I set the folders and all. Once I click on pretty much and shader I see it an error invalid subscript uv2 in meta. Sure, lets open the meta and see what's wrong. uv2 is invalid because in the struct it only defined when unity_pass_meta (or din_lightmap) is defined. Unity_pass_meta however is never defined anywhere. It should in fact be defined in standardmeta.cginc, So why, I say, why are we only getting a half-working shader code reference?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    The shader source is for reference, it should not be placed inside a project.
     
  3. ginconic

    ginconic

    Joined:
    May 19, 2015
    Posts:
    89
    I guess so.. However, I often place it in a project when I need to work on shaders. This also lets you check/ override the default ones.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Yes, and I do that to for some things. However as best I can tell that is a bug of sorts. Reimporting one shader at a time “fixes” it.

    Also you should not expect shader source from “future” versions of Unity to work as features may be changed or added that change the behavior.
     
  5. ginconic

    ginconic

    Joined:
    May 19, 2015
    Posts:
    89
    Sry, I should have made that clear: I've set up the projects in their respective unity versions. I don't expect shader code to be compatible with older versions. Quite the contrary.
    That might indeed be a bug though. My point was that the shader source zips were somehow 'messed up'. But the error persists in the actual includes that ship with unity 2018.