您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
46 行
1.1 KiB
46 行
1.1 KiB
Shader "Hidden/LightweightPipeline/CopyDepth"
|
|
{
|
|
SubShader
|
|
{
|
|
Tags { "RenderType" = "Opaque" "RenderPipeline" = "LightiweightPipeline"}
|
|
|
|
Pass
|
|
{
|
|
ColorMask 0
|
|
ZTest Always
|
|
ZWrite On
|
|
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
sampler2D_float _CameraDepthTexture;
|
|
|
|
struct VertexInput
|
|
{
|
|
float4 vertex : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 position : SV_POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
VertexOutput vert(VertexInput i)
|
|
{
|
|
VertexOutput o;
|
|
o.uv = i.uv;
|
|
o.position = UnityObjectToClipPos(i.vertex);
|
|
return o;
|
|
}
|
|
|
|
float frag(VertexOutput i) : SV_Depth
|
|
{
|
|
return tex2D(_CameraDepthTexture, i.uv).r;
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
}
|