Created
January 31, 2013 11:23
-
-
Save thallippoli/4682218 to your computer and use it in GitHub Desktop.
Simple parameter based blink shader in Unity
This file contains hidden or 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 "Custom/Blink" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_Blink ( "Blink", Float ) = 0 | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
LOD 200 | |
CGPROGRAM | |
#pragma surface surf Lambert | |
sampler2D _MainTex; | |
float _Blink; | |
struct Input { | |
float2 uv_MainTex; | |
}; | |
void surf (Input IN, inout SurfaceOutput o) { | |
half4 c = tex2D (_MainTex, IN.uv_MainTex ); | |
if( _Blink == 1.0f ) | |
c *= ( 0.5f + abs( sin( _Time.w ) ) ); | |
o.Albedo = c.rgb; | |
o.Alpha = c.a; | |
} | |
ENDCG | |
} | |
FallBack "Diffuse" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i added simple code for tint color and no alpha
Shader "Custom/Blink" {
Properties {
_MainTex ("Particle Texture", 2D) = "red" {}
_Blink ( "Blink", Float ) = 0
_Color("Color", Color) = (1,1,1)
}
}