카테고리 없음

12-3-2 홀로그림. 흐르게 하기

소나무꼴 2020. 4. 4. 22:02
Shader "Custom/12-3-2"
{
    Properties
    {
		_BumpMap("NormalMap (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 _CustomLight noambient alpha:auto 

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

			sampler2D _BumpMap;

        struct Input
        {
			float3 viewDir;
			float3 worldPos;
			float2 uv_BumpMap;
        };

        #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)
        {

			o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
			float rim = dot(o.Normal, -IN.viewDir);
			rim = pow(1 - rim, 3) + pow(frac(IN.worldPos.g * 3 - _Time.y), 30);			
			o.Emission = float3(0, 1, 0);
			o.Alpha = rim;
        }

		float4 Lighting_CustomLight(SurfaceOutput s, float3 lightDir, float3 viewDir, float atten)
		{
			return float4(0, 0, 0, s.Alpha);
		}
        ENDCG
    }
    FallBack "Diffuse"
}