Skip to content

Instantly share code, notes, and snippets.

@sbmjob
Last active December 4, 2018 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbmjob/145dba9b6216507c015e3f701f16a16d to your computer and use it in GitHub Desktop.
Save sbmjob/145dba9b6216507c015e3f701f16a16d to your computer and use it in GitHub Desktop.
Custom Shader AlphaTest for Unity
Shader "Custom/AlphaTest_ForWeb" {
Properties {
_MainTex ("Albedo (RGB)", 2D ) = "white" {}
_Cutoff ("Cutoff" , Range(0, 1)) = 0.5
}
SubShader {
Tags {
"Queue" = "AlphaTest"
"RenderType" = "TransparentCutout"
}
LOD 200
Cull Off
CGPROGRAM
#pragma target 3.0
#pragma surface surf Standard fullforwardshadows alphatest:_Cutoff
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed2 scrolledUV = IN.uv_MainTex;
fixed yScrollValue = 1.0 * _Time;//縦
scrolledUV += fixed2(0,yScrollValue);
fixed4 c = tex2D (_MainTex, scrolledUV);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Transparent/Cutout/Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment