Shader/Shader - SurfaceShader

18-1-2Pass Alpha

소나무꼴 2020. 4. 15. 16:21
Shader "Custom/18-1-2Pass Alpha"
{
    Properties
    {
		_MainTex("Texture", 2D) = "white" {}
		_Alpha("Alpha", Range(0, 1)) = 0
    }
    SubShader
    {
		Tags { "RenderType" = "Transparent" "Queue" = "Transparent"}
		// 1st
		zwrite on
		ColorMask 0
		cull off
		CGPROGRAM
		#pragma surface surf nolight noambient noforwardadd nolightmap novertexlights noshadow
		struct Input
		{
			float4 color:COLOR;
		};
		void surf(Input IN, inout SurfaceOutput o)
		{
		}
		float4 Lightingnolight(SurfaceOutput s, float3 lightDir, float3 viewDir, float atten)
		{			
			return float4(0, 0, 0, 0);
		}
		ENDCG

		// 2nt
		zwrite off
		CGPROGRAM
		#pragma surface surf Lambert alpha:fade
		sampler2D _MainTex;
		float _Alpha;
		struct Input
		{
			float2 uv_MainTex;
		};
		void surf(Input IN, inout SurfaceOutput o)
		{
			fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
			o.Albedo = c.rgb;
			o.Alpha = _Alpha;
		}
		ENDCG

    }
    FallBack "Diffuse"
}

'Shader > Shader - SurfaceShader' 카테고리의 다른 글

18-3타들어가는  (0) 2020.04.15
18-2  (0) 2020.04.15
17-1알파블렌딩  (0) 2020.04.15
16-3-알파블렌딩  (0) 2020.04.08
16-2-1깊이버퍼 출력  (0) 2020.04.08