Shader初学笔记:简单色块红橙黄绿蓝靛紫白灰黑

2018-03-26 10:43:16 浏览数 (1)

v2f vert (appdata v)

{

v2f o;

o.vertex = UnityObjectToClipPos(v.vertex);

o.uv = v.uv;

return o;

}

fixed4 frag (v2f i) : SV_Target

{

if(i.uv.x>0.9)return float4(1,0,0,1);

else if(i.uv.x>0.8)return float4(1,0.5,0,1);

else if(i.uv.x>0.7)return float4(1,1,0,1);

else if(i.uv.x>0.6)return float4(0,1,0,1);

else if(i.uv.x>0.5)return float4(0,0,1,1);

else if(i.uv.x>0.4)return float4(0,1,1,1);

else if(i.uv.x>0.3)return float4(1,0,1,1);

else if(i.uv.x>0.2)return float4(1,1,1,1);

else if(i.uv.x>0.1)return float4(0.5,0.5,0.5,1);

else return float4(0,0,0,1);

}

0 人点赞