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"
}