Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "CustomColorPattern" {
- Properties{
- _Color1("Main Color 1", Color) = (1,1,1,1)
- _Color2("Main Color 2", Color) = (1,1,1,1)
- _MainTex("Mask Texture", 2D) = "white" {}
- }
- SubShader{
- Tags{ "RenderType" = "Diffuse" }
- LOD 100
- Pass{
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #pragma multi_compile_fog
- #include "UnityCG.cginc"
- struct appdata_t {
- float4 vertex : POSITION;
- float4 color : COLOR;
- float2 texcoord : TEXCOORD0;
- };
- struct v2f {
- float4 vertex : SV_POSITION;
- fixed4 color : COLOR;
- half2 texcoord : TEXCOORD0;
- UNITY_FOG_COORDS(0)
- };
- fixed4 _Color1;
- fixed4 _Color2;
- v2f vert(appdata_t v)
- {
- v2f o;
- o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
- o.texcoord = v.texcoord;
- o.color = v.color;
- UNITY_TRANSFER_FOG(o,o.vertex);
- return o;
- }
- sampler _MainTex;
- fixed4 frag(v2f i) : COLOR
- {
- fixed4 c = tex2D(_MainTex, i.texcoord);
- if (c.r == 0 && c.g == 0 && c.b == 0)
- {
- c = _Color1;
- }
- else
- {
- c = _Color2;
- }
- UNITY_APPLY_FOG(i.fogCoord, c);
- UNITY_OPAQUE_ALPHA(c.a);
- return c;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement