-
Notifications
You must be signed in to change notification settings - Fork 29
/
CP_SSSSS_BlitDepthTextureToDepth.shader
51 lines (43 loc) · 1.43 KB
/
CP_SSSSS_BlitDepthTextureToDepth.shader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Hidden/CPSSSSSBlitDepthTextureToDepth" {
SubShader {
Pass {
ZTest Always Cull Off
ZWrite On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord.xy;
return o;
}
float4 frag (v2f i, out float outDepth : SV_Depth) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
outDepth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.texcoord);
return float4(0, 0, 0, 0);
}
ENDCG
}
}
Fallback Off
}