본문 바로가기
게임개발/게임 그래픽 프로그래밍

Alphatest addshadow

by pudding81 2024. 2. 26.

 

 

 

Shader "Custom/leaves"
{
    Properties
    {
        _Color("Main Color",Color)=(1,1,1,1) //그림자
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Cutoff("Alpha cutoff",Range(0,1))=0.5        
        _Speed("speed",Range(0,1))=0.1 //속도
        _Timing("Timing",Range(0,5))=0.5 //간격 

    }
    SubShader
    {
        Tags { "RenderType"="Transparent" "Queue"="AlphaTest" }
        

        CGPROGRAM
    
        #pragma surface surf Lambert alphatest:_Cutoff vertex:vert addshadow//알파테스트 버텍스

      
        #pragma target 3.0

        sampler2D _MainTex;
        float _Speed;
        float _Timing;

        struct Input
        {
            float2 uv_MainTex;
            float2 color:COLOR;
        };

        void vert(inout appdata_full v) //버텍스
        {
           //버텍스컬러 칠한 부분만 위아래로 움직이기         
            v.vertex.y += sin(_Time.y*_Timing)*_Speed*v.color.r; 
        }


        void surf (Input IN, inout SurfaceOutput o)
        {
          
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
            o.Albedo = c.rgb*IN.color.r;
           //o.Albedo = IN.color.rgb;
          
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack  "Legacy Shaders/Transparent/Cutout/VertexLit" 
}

'게임개발 > 게임 그래픽 프로그래밍' 카테고리의 다른 글

Triplanar : WorldNormal  (0) 2024.02.26
MatCap _Nolight  (1) 2024.02.26
Dissove  (0) 2024.02.23
Alpha Blink  (0) 2024.02.23
Hologram Alpha blend  (0) 2024.02.23