Shader/Shader - SurfaceShader
18-4 풀흔들기
소나무꼴
2020. 4. 22. 23:49
Shader "Custom/18-4"
{
Properties
{
_Color("Main Color", Color) =(1,1,1,1)
_MainTex("Texture", 2D) = "white" {}
_Cutoff("Cutoff", float) = 0.5
_Move("Move", Range(0, 0.5)) = 0.1
_Timeing("Timeing", Range(0, 5)) = 1
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue" = "AlphaTest"}
CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff vertex:vert addshadow
sampler2D _MainTex;
float _Move;
float _Timeing;
struct Input
{
float2 uv_MainTex;
};
void vert(inout appdata_full v)
{
v.vertex.y += sin(_Time.y * _Timeing)*_Move*v.color.r;//버텍스 칼라중 R 칼라를 사용해 흔들리는 버텍스를 선택
}
void surf(Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}