카테고리 없음

12-3-1 홀로그램

소나무꼴 2020. 4. 4. 21:51
Shader "Custom/12-3"
{
    Properties
    {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
	}
		SubShader
		{
			Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }

			CGPROGRAM
			// Physically based Standard lighting model, and enable shadows on all light types
			#pragma surface surf Lambert noambient alpha:auto 

			// Use shader model 3.0 target, to get nicer looking lighting
			#pragma target 3.0

			sampler2D _MainTex;

        struct Input
        {
            float2 uv_MainTex;
			float3 viewDir;
        };

        #pragma instancing_options assumeuniformscaling
        UNITY_INSTANCING_BUFFER_START(Props)
            // put more per-instance properties here
        UNITY_INSTANCING_BUFFER_END(Props)

		void surf(Input IN, inout SurfaceOutput o)
        {
			fixed4 c = tex2D(_MainTex, IN.uv_MainTex);			
			float rim = dot(o.Normal, -IN.viewDir);
			rim = pow(1 - rim, 3);
			o.Emission = float3(0, 1, 0);
			o.Alpha = rim *abs(sin(_Time.y));
        }
        ENDCG
    }
    FallBack "Diffuse"
}