1
2
3 Shader
"Hidden/CreaseApply" {
4 Properties {
5     _MainTex (
"Base (RGB)", 2D) = "white" {}
6     _HrDepthTex (
"Base (RGB)", 2D) = "white" {}
7     _LrDepthTex (
"Base (RGB)", 2D) = "white" {}
8 }
9
10 SubShader {
11     Pass {
12         ZTest Always Cull Off ZWrite Off
13
14 CGPROGRAM
15 #pragma vertex vert
16 #pragma fragment frag
17 #include
"UnityCG.cginc"
18
19 sampler2D _MainTex;
20 sampler2D _HrDepthTex;
21 sampler2D _LrDepthTex;
22
23 uniform float4 _MainTex_TexelSize;
24
25 uniform
float intensity;
26
27 struct
v2f {
28     float4 pos : SV_POSITION;
29     float2 uv : TEXCOORD0;
30 };
31
32 v2f vert( appdata_img v )
33 {
34     v2f o;
35     o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
36     o.uv.xy = v.texcoord.xy;
37     
return o;
38 }
39
40 half4 frag (v2f i) : SV_Target
41 {
42     float4 hrDepth = tex2D(_HrDepthTex, i.uv);
43     float4 lrDepth = tex2D(_LrDepthTex, i.uv);
44     
45     hrDepth.a = DecodeFloatRGBA(hrDepth);
46     lrDepth.a = DecodeFloatRGBA(lrDepth);
47     
48     float4 color = tex2D(_MainTex, i.uv);
49     
50     
return color * (1.0-abs(hrDepth.a-lrDepth.a)*intensity);
51 }
52
53 ENDCG
54
55
56     }
57 }
58
59 Fallback off
60
61 }


Gõ tìm kiếm nhanh...