HAPPY

세이더_디졸브+투명

101won 2024. 10. 1. 00:45
  • 이러면 어떨까?

오브젝트가 2개임 - 투명 (크기0.99) + 디졸브

 - 디졸브의 Height를 서서히 올림 

 

위치 지정 이펙트/ 두들김 이펙트/ 완성 이펙트

 

Shader "Custom/Fade"
{
Properties
    {
       _MainTex ("Albedo (RGB)", 2D) = "white" {}
       _Color("Color", Color) = (1,1,1,1)
    }
    SubShader
    {
        Tags { "RenderType"="Transparent" "Queue" ="Transparent"}

        CGPROGRAM
        #pragma surface surf Lambert alpha:fade
        #pragma target 3.0

        sampler2D _MainTex;
        float4 _Color;

        struct Input
        {
            float2 uv_MainTex;
            float3 viewDir;
        };

        void surf (Input IN, inout SurfaceOutput o)
        {
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
            o.Albedo = c.rgb;

            //프레넬 n dot v
           float rim = saturate(dot(o.Normal, IN.viewDir));
           float reverseRim = pow(1-rim,1);

           o.Emission = _Color.rgb;

            o.Alpha = reverseRim; //  * abs(sin(_Time.y* 10)); // 일정한 속도로 깜빡이기 // 시간 * 속도
        }
        ENDCG
    }
    FallBack "Diffuse"
}