Last active
September 13, 2018 19:09
-
-
Save sasanon/a48debb68edbd5e40f45a2f7c0c9af26 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 "Sasa/Meat" | |
{ | |
Properties | |
{ | |
_MainTex ("Main Tex", 2D) = "white" {} | |
_DarkColor ("Dark Color", Color) = (0.5,0.5,0.5,1) | |
_LightColor ("Light Color", Color) = (0.5,0.5,0.5,1) | |
} | |
SubShader | |
{ | |
Tags { "Queue"="Transparent" "RenderType"="Transparent" } | |
Cull Back | |
Lighting Off | |
ZWrite Off | |
ZTest Off | |
Blend SrcAlpha OneMinusSrcAlpha | |
Pass | |
{ | |
Name "Default" | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#pragma target 2.0 | |
#include "UnityCG.cginc" | |
#include "UnityUI.cginc" | |
#pragma shader_feature __ UNITY_UI_CLIP_RECT | |
#pragma shader_feature __ UNITY_UI_ALPHACLIP | |
struct appdata_t | |
{ | |
float4 vertex : POSITION; | |
float4 color : COLOR; | |
float2 texcoord : TEXCOORD0; | |
UNITY_VERTEX_INPUT_INSTANCE_ID | |
}; | |
struct v2f | |
{ | |
float4 vertex : SV_POSITION; | |
fixed4 color : COLOR; | |
float2 texcoord : TEXCOORD0; | |
UNITY_VERTEX_OUTPUT_STEREO | |
}; | |
fixed4 _DarkColor; | |
fixed4 _LightColor; | |
sampler2D _MainTex; | |
v2f vert(appdata_t v) | |
{ | |
v2f OUT; | |
OUT.vertex = UnityObjectToClipPos(v.vertex); | |
OUT.texcoord = v.texcoord; | |
OUT.color = v.color; | |
return OUT; | |
} | |
fixed4 frag(v2f IN) : SV_Target | |
{ | |
half4 color; | |
color.r = tex2D(_MainTex, IN.texcoord).r; | |
color.rgb = lerp(_DarkColor, _LightColor, color.r); | |
color.a = 1; | |
return color; | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment