Search Unity

[Android] Per-pixel-Specular disappeared when target SM 2.0

Discussion in 'Shaders' started by Daylightsburning, Sep 15, 2014.

  1. Daylightsburning

    Daylightsburning

    Joined:
    Oct 24, 2013
    Posts:
    15
    Hi there,
    I have a shader which uses per-pixel-specular and worked fine when target SM 3.0, but the specular will disappear if change shade model to 2.0, could any one here please tell me what's going on? how can i stick with SM 2.0 while still have the per-pixel-specular effects? thank you.
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Can you post the shader?
     
  3. Daylightsburning

    Daylightsburning

    Joined:
    Oct 24, 2013
    Posts:
    15
    Problem solved :

    Code (CSharp):
    1. struct v2f
    2. {
    3.     float4  pos     : SV_POSITION;
    4.     float2  uv      : TEXCOORD0;
    5.     fixed3  viewDir : COLOR;
    6. };


    It turns out that the out type of viewDir is the problem, just change it from 'COLOR' to 'TEXCOORD1" will work fine in SM 2.0.

    Thank you.
     
    Last edited: Sep 16, 2014