Search Unity

Is there any reserved keywords with shaders ??

Discussion in 'Shaders' started by gritche, Oct 14, 2010.

  1. gritche

    gritche

    Joined:
    Aug 27, 2009
    Posts:
    44
    Hi there.

    Just wrote a surface shader that mix 3 texture based on rvb from another (so 4 texture as input).
    Then i realized that only the first uv tiling was active.. so i rewrote it from scratch, and went to the good result but with exactly the same shader !?

    Only difference is the names used for textures uv
    Working case : _Detail_R uv_Detail_R (then G B)
    Buggy case : _Map_R uv_MapR (then G B)

    After many tests i get pretty sure the naming has to do with the bug..
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    check out the includes you use. they contain the macros etc that unity offers
     
  3. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    In your "buggy case", the names for the texture the UV do not match. "uv" + "_Map_R" should be "uv_Map_R", not "uv_MapR".
     
  4. gritche

    gritche

    Joined:
    Aug 27, 2009
    Posts:
    44
    @dreamora : with surface shaders, there is no more explicit include needed.
    @aras : Cool.. names not matching was the problem ! From the docs, it was not clear to me that "uv_" was a prefix for the same name (+ there is no errors in such a case).

    The new writing made this shader (like some other) faster to create and clearer to read.. and most of all it now take shadow with no pain :)
    Surface shaders was another great idea.

    Thanks guys.