Created
February 20, 2020 10:33
-
-
Save sangress/fc260e14f0b98ab843a40d74ce834f66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Unlit/WorldMapHighlight" | |
{ | |
Properties{ | |
_Color ("Tint", Color) = (0, 0, 0, 1) | |
_FullColor ("Full Color", Color) = (0, 0, 0, 1) | |
_MainTex ("Texture", 2D) = "white" {} | |
// _HighlightUV ("highlightUV", Vector) = (0, 0, 0, 1) | |
_HighlightUV ("Highlight", Color) = (0, 0, 0, 1) | |
} | |
SubShader{ | |
Tags{ | |
"RenderType"="Transparent" | |
"Queue"="Transparent" | |
} | |
Blend SrcAlpha OneMinusSrcAlpha | |
ZWrite off | |
Cull off | |
Pass{ | |
CGPROGRAM | |
#include "UnityCG.cginc" | |
#pragma vertex vert | |
#pragma fragment frag | |
sampler2D _MainTex; | |
float4 _MainTex_ST; | |
fixed4 _Color; | |
fixed4 _HighlightUV; | |
fixed4 _FullColor; | |
struct appdata{ | |
float4 vertex : POSITION; | |
float2 uv : TEXCOORD0; | |
fixed4 color : COLOR; | |
}; | |
struct v2f{ | |
float4 position : SV_POSITION; | |
float2 uv : TEXCOORD0; | |
fixed4 color : COLOR; | |
}; | |
v2f vert(appdata v){ | |
v2f o; | |
o.position = UnityObjectToClipPos(v.vertex); | |
o.uv = TRANSFORM_TEX(v.uv, _MainTex); | |
o.color = v.color; | |
return o; | |
} | |
fixed4 frag(v2f i) : SV_TARGET{ | |
fixed4 col = tex2D(_MainTex, i.uv); | |
if (_HighlightUV.r == col.r && _HighlightUV.g == col.g && _HighlightUV.b == col.b) { | |
col *= _HighlightUV; | |
} else { | |
col *= _Color; | |
} | |
col *= i.color; | |
return col; | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment