-
Notifications
You must be signed in to change notification settings - Fork 877
Expand file tree
/
Copy pathFinalPass.shader
More file actions
156 lines (127 loc) · 4.87 KB
/
Copy pathFinalPass.shader
File metadata and controls
156 lines (127 loc) · 4.87 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
Shader "Hidden/PostProcessing/FinalPass"
{
HLSLINCLUDE
#pragma multi_compile __ FXAA FXAA_LOW
#pragma multi_compile __ FXAA_KEEP_ALPHA FXAA_NO_ALPHA
#pragma vertex VertUVTransform
#pragma fragment Frag
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/Colors.hlsl"
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/Builtins/Dithering.hlsl"
// PS3 and XBOX360 aren't supported in Unity anymore, only use the PC variant
#define FXAA_PC 1
#if FXAA_KEEP_ALPHA || FXAA_NO_ALPHA
// Luma hasn't been encoded in alpha
#define FXAA_GREEN_AS_LUMA 1
#else
// Luma is encoded in alpha after the first Uber pass
#define FXAA_GREEN_AS_LUMA 0
#endif
#if FXAA_LOW
#define FXAA_QUALITY__PRESET 12
#define FXAA_QUALITY_SUBPIX 1.0
#define FXAA_QUALITY_EDGE_THRESHOLD 0.166
#define FXAA_QUALITY_EDGE_THRESHOLD_MIN 0.0625
#else
#define FXAA_QUALITY__PRESET 28
#define FXAA_QUALITY_SUBPIX 1.0
#define FXAA_QUALITY_EDGE_THRESHOLD 0.063
#define FXAA_QUALITY_EDGE_THRESHOLD_MIN 0.0312
#endif
#include "FastApproximateAntialiasing.hlsl"
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
float4 _MainTex_TexelSize;
float4 Frag(VaryingsDefault i) : SV_Target
{
half4 color = 0.0;
// Fast Approximate Anti-aliasing
#if FXAA || FXAA_LOW
{
#if FXAA_HLSL_4 || FXAA_HLSL_5
FxaaTex mainTex;
mainTex.tex = _MainTex;
mainTex.smpl = sampler_MainTex;
#else
FxaaTex mainTex = _MainTex;
#endif
color = FxaaPixelShader(
i.texcoord, // pos
0.0, // fxaaConsolePosPos (unused)
mainTex, // tex
mainTex, // fxaaConsole360TexExpBiasNegOne (unused)
mainTex, // fxaaConsole360TexExpBiasNegTwo (unused)
_MainTex_TexelSize.xy, // fxaaQualityRcpFrame
0.0, // fxaaConsoleRcpFrameOpt (unused)
0.0, // fxaaConsoleRcpFrameOpt2 (unused)
0.0, // fxaaConsole360RcpFrameOpt2 (unused)
FXAA_QUALITY_SUBPIX,
FXAA_QUALITY_EDGE_THRESHOLD,
FXAA_QUALITY_EDGE_THRESHOLD_MIN,
0.0, // fxaaConsoleEdgeSharpness (unused)
0.0, // fxaaConsoleEdgeThreshold (unused)
0.0, // fxaaConsoleEdgeThresholdMin (unused)
0.0 // fxaaConsole360ConstDir (unused)
);
#if FXAA_KEEP_ALPHA
{
color.a = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoordStereo).a;
}
#endif
}
#else
{
color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoordStereo);
}
#endif
color.rgb = Dither(color.rgb, i.texcoord);
return color;
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma exclude_renderers gles vulkan webgpu switch
#pragma multi_compile __ STEREO_INSTANCING_ENABLED STEREO_DOUBLEWIDE_TARGET
#pragma target 5.0
ENDHLSL
}
}
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma exclude_renderers gles vulkan webgpu switch
#pragma multi_compile __ STEREO_INSTANCING_ENABLED STEREO_DOUBLEWIDE_TARGET
#pragma target 3.0
ENDHLSL
}
}
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma only_renderers gles3
#pragma multi_compile __ STEREO_INSTANCING_ENABLED STEREO_DOUBLEWIDE_TARGET
#pragma target 3.0
ENDHLSL
}
}
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma only_renderers gles vulkan webgpu switch
#pragma multi_compile __ STEREO_DOUBLEWIDE_TARGET //not supporting STEREO_INSTANCING_ENABLED
ENDHLSL
}
}
}