File tree Expand file tree Collapse file tree 4 files changed +579
-579
lines changed
Assets/UnityChanStage/Visualizer Expand file tree Collapse file tree 4 files changed +579
-579
lines changed Original file line number Diff line number Diff line change 1- Shader "Custom/CopyDepth" {
2-
3- Properties {
4- }
5- SubShader {
6- Tags { "RenderType" ="Opaque" }
7- ZTest Always
8- ZWrite Off
9-
10- CGINCLUDE
11-
12- sampler2D _CameraDepthTexture;
13-
14- struct ia_out
15- {
16- float4 vertex : POSITION ;
17- };
18-
19- struct vs_out
20- {
21- float4 vertex : SV_POSITION ;
22- float4 screen_pos : TEXCOORD0 ;
23- };
24-
25- struct ps_out
26- {
27- float4 color : COLOR0 ;
28- };
29-
30-
31- vs_out vert (ia_out v)
32- {
33- vs_out o;
34- o.vertex = v.vertex;
35- o.screen_pos = v.vertex;
36- return o;
37- }
38-
39- ps_out frag (vs_out i)
40- {
41- float2 coord = (i.screen_pos.xy / i.screen_pos.w + 1.0 ) * 0.5 ;
42- #if UNITY_UV_STARTS_AT_TOP
43- coord.y = 1.0 -coord.y;
44- #endif
45-
46- ps_out r;
47- r.color = tex2D (_CameraDepthTexture, coord);
48- return r;
49- }
50- ENDCG
51-
52- Pass {
53- CGPROGRAM
54- #pragma vertex vert
55- #pragma fragment frag
56- #pragma target 3.0
57- #ifdef SHADER_API_OPENGL
58- #pragma glsl
59- #endif
60- ENDCG
61- }
62- }
63- FallBack Off }
1+ Shader "Custom/CopyDepth" {
2+
3+ Properties {
4+ }
5+ SubShader {
6+ Tags { "RenderType" ="Opaque" }
7+ ZTest Always
8+ ZWrite Off
9+
10+ CGINCLUDE
11+
12+ sampler2D _CameraDepthTexture;
13+
14+ struct ia_out
15+ {
16+ float4 vertex : POSITION ;
17+ };
18+
19+ struct vs_out
20+ {
21+ float4 vertex : SV_POSITION ;
22+ float4 screen_pos : TEXCOORD0 ;
23+ };
24+
25+ struct ps_out
26+ {
27+ float4 color : COLOR0 ;
28+ };
29+
30+
31+ vs_out vert (ia_out v)
32+ {
33+ vs_out o;
34+ o.vertex = v.vertex;
35+ o.screen_pos = v.vertex;
36+ return o;
37+ }
38+
39+ ps_out frag (vs_out i)
40+ {
41+ float2 coord = (i.screen_pos.xy / i.screen_pos.w + 1.0 ) * 0.5 ;
42+ #if UNITY_UV_STARTS_AT_TOP
43+ coord.y = 1.0 -coord.y;
44+ #endif
45+
46+ ps_out r;
47+ r.color = tex2D (_CameraDepthTexture, coord);
48+ return r;
49+ }
50+ ENDCG
51+
52+ Pass {
53+ CGPROGRAM
54+ #pragma vertex vert
55+ #pragma fragment frag
56+ #pragma target 3.0
57+ #ifdef SHADER_API_OPENGL
58+ #pragma glsl
59+ #endif
60+ ENDCG
61+ }
62+ }
63+ FallBack Off }
You can’t perform that action at this time.
0 commit comments