Shader/Shader - SurfaceShader

16-2-1깊이버퍼 출력

소나무꼴 2020. 4. 8. 00:35
Shader "Custom/16-1"
{
    Properties
    {
    }
    SubShader
    {
		Tags { "RenderType" = "Opaque" }

		CGPROGRAM
		#pragma surface surf Lambert noambient noshadow

		struct Input
		{
			float4 screenPos;
		};

		sampler2D _CameraDepthTexture;

		void surf(Input IN, inout SurfaceOutput o)
		{
			float2 sPos = float2(IN.screenPos.x, IN.screenPos.y) / IN.screenPos.w;
			float4 Depth = tex2D(_CameraDepthTexture, sPos);
			o.Emission = Depth.r;
			o.Alpha = 1;
		}
		ENDCG
    }
    FallBack "Diffuse"
}

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

17-1알파블렌딩  (0) 2020.04.15
16-3-알파블렌딩  (0) 2020.04.08
15-3-MaskMap  (0) 2020.04.08
Custom/15-1-Reflection  (0) 2020.04.07
14-5  (0) 2020.04.06