baobao
6/20/2018 - 5:36 AM

boxPattern0.shader

Shader "Test"
 {
     Properties{}
     CGINCLUDE
     #include "UnityCG.cginc"
    float box(float2 st, float size)
    {
        st = step(st, size);
        return st.x * st.y;
    }
    
    fixed4 frag(v2f_img i) : SV_Target
    {
        return box(frac(i.uv*2), 0.8);
    }
     ENDCG
     SubShader
     {
         Pass
         {
             CGPROGRAM
             #pragma vertex vert_img
             #pragma fragment frag
             ENDCG
         }
     }
 }