Search Unity

shader make it transparent

Discussion in 'Shaders' started by JohnSonLi, Sep 30, 2014.

  1. JohnSonLi

    JohnSonLi

    Joined:
    Apr 15, 2012
    Posts:
    586
    I want to make an object invisible and learn something about tex2dProj.I dont have any good documents,but try the codes.
    Code (csharp):
    1.        
    2.           v2f vert (appdata_t v)
    3.             {
    4.                 v2f o;
    5.                 o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
    6.                 o.color = v.color;
    7.                 o.texcoord = v.texcoord;
    8.                 o.screenPos = ComputeScreenPos(o.vertex);
    9.                 //o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex);
    10.                 return o;
    11.             }
    12.  
    13.             sampler2D _GrabTexture;
    14.             half4 frag (v2f IN) : COLOR
    15.             {
    16.                half4 originCol = tex2Dproj(_GrabTexture,IN.screenPos);
    17.                half4 completedColor = originCol;
    18. /[CODE]
    19. these codes does not work.... anyone fixes it?