@@ -62,6 +62,7 @@ Shader "ReactUnity/BackdropFilter"
62
62
#pragma shader_feature_local _SPECULARHIGHLIGHTS_OFF
63
63
#pragma shader_feature_local _GLOSSYREFLECTIONS_OFF
64
64
#pragma fragmentoption ARB_precision_hint_fastest
65
+ #define GRAB_POS
65
66
#include "UnityCG.cginc"
66
67
#include "ShaderSetup.cginc"
67
68
@@ -70,11 +71,11 @@ Shader "ReactUnity/BackdropFilter"
70
71
float4 _GrabTexture_TexelSize;
71
72
72
73
float4 frag ( v2f i ) : COLOR {
73
- if (_Blur == 0 ) return tex2D (_GrabTexture, i.uv );
74
+ if (_Blur == 0 ) return float4 ( 0 , 0 , 0 , 0 );
74
75
75
76
float3 sum = float3 (0 ,0 ,0 );
76
77
77
- #define GRABPIXEL (weight,kernelx) tex2D ( _GrabTexture, UNITY_PROJ_COORD (float2 (i.uv .x + _GrabTexture_TexelSize.x * kernelx*_Blur, i.uv .y))) * weight
78
+ #define GRABPIXEL (weight,kernelx) tex2D ( _GrabTexture, UNITY_PROJ_COORD (float2 (i.uvgrab .x + _GrabTexture_TexelSize.x * kernelx*_Blur, i.uvgrab .y))) * weight
78
79
79
80
sum += GRABPIXEL (0.05 , -4.0 );
80
81
sum += GRABPIXEL (0.09 , -3.0 );
@@ -101,6 +102,7 @@ Shader "ReactUnity/BackdropFilter"
101
102
#pragma shader_feature_local _SPECULARHIGHLIGHTS_OFF
102
103
#pragma shader_feature_local _GLOSSYREFLECTIONS_OFF
103
104
#pragma fragmentoption ARB_precision_hint_fastest
105
+ #define GRAB_POS
104
106
#include "UnityCG.cginc"
105
107
#include "ShaderSetup.cginc"
106
108
@@ -109,11 +111,11 @@ Shader "ReactUnity/BackdropFilter"
109
111
float4 _GrabTexture_TexelSize;
110
112
111
113
float4 frag ( v2f i ) : COLOR {
112
- if (_Blur == 0 ) return tex2D (_GrabTexture, i.uv );
114
+ if (_Blur == 0 ) return float4 ( 0 , 0 , 0 , 0 );
113
115
114
116
float3 sum = float3 (0 ,0 ,0 );
115
117
116
- #define GRABPIXEL (weight,kernely) tex2D ( _GrabTexture, UNITY_PROJ_COORD (float2 (i.uv .x, i.uv .y + _GrabTexture_TexelSize.y * kernely*_Blur))) * weight
118
+ #define GRABPIXEL (weight,kernely) tex2D ( _GrabTexture, UNITY_PROJ_COORD (float2 (i.uvgrab .x, i.uvgrab .y + _GrabTexture_TexelSize.y * kernely*_Blur))) * weight
117
119
118
120
sum += GRABPIXEL (0.05 , -4.0 );
119
121
sum += GRABPIXEL (0.09 , -3.0 );
@@ -141,6 +143,7 @@ Shader "ReactUnity/BackdropFilter"
141
143
#pragma shader_feature_local _SPECULARHIGHLIGHTS_OFF
142
144
#pragma shader_feature_local _GLOSSYREFLECTIONS_OFF
143
145
#pragma fragmentoption ARB_precision_hint_fastest
146
+ #define GRAB_POS
144
147
#include "UnityCG.cginc"
145
148
#include "UnityUI.cginc"
146
149
#include "ShaderSetup.cginc"
@@ -197,17 +200,18 @@ Shader "ReactUnity/BackdropFilter"
197
200
198
201
float4 frag (v2f i) : SV_Target
199
202
{
200
- // Grab the texture from behind the current object
201
- float3 color = tex2D (_GrabTexture, i.uv).rgb;
203
+ float2 uvgrab = i.uvgrab;
202
204
203
205
// Apply pixelate effect
204
206
if (_Pixelate > 0 )
205
207
{
206
208
float4 ts = _GrabTexture_TexelSize * _Pixelate;
207
- float2 uv = round (i.uv / ts.xy) * ts.xy;
208
- color = tex2D (_GrabTexture, uv).rgb;
209
+ uvgrab = round (i.uvgrab / ts.xy) * ts.xy;
209
210
}
210
211
212
+ // Grab the texture from behind the current object
213
+ float3 color = tex2D (_GrabTexture, uvgrab).rgb;
214
+
211
215
// Convert to grayscale if needed
212
216
if (_Grayscale > 0 )
213
217
{
0 commit comments