@@ -62,6 +62,7 @@ Shader "ReactUnity/BackdropFilter"
6262 #pragma shader_feature_local _SPECULARHIGHLIGHTS_OFF
6363 #pragma shader_feature_local _GLOSSYREFLECTIONS_OFF
6464 #pragma fragmentoption ARB_precision_hint_fastest
65+ #define GRAB_POS
6566 #include "UnityCG.cginc"
6667 #include "ShaderSetup.cginc"
6768
@@ -70,11 +71,11 @@ Shader "ReactUnity/BackdropFilter"
7071 float4 _GrabTexture_TexelSize;
7172
7273 float4 frag ( v2f i ) : COLOR {
73- if (_Blur == 0 ) return tex2D (_GrabTexture, i.uv );
74+ if (_Blur == 0 ) return float4 ( 0 , 0 , 0 , 0 );
7475
7576 float3 sum = float3 (0 ,0 ,0 );
7677
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
7879
7980 sum += GRABPIXEL (0.05 , -4.0 );
8081 sum += GRABPIXEL (0.09 , -3.0 );
@@ -101,6 +102,7 @@ Shader "ReactUnity/BackdropFilter"
101102 #pragma shader_feature_local _SPECULARHIGHLIGHTS_OFF
102103 #pragma shader_feature_local _GLOSSYREFLECTIONS_OFF
103104 #pragma fragmentoption ARB_precision_hint_fastest
105+ #define GRAB_POS
104106 #include "UnityCG.cginc"
105107 #include "ShaderSetup.cginc"
106108
@@ -109,11 +111,11 @@ Shader "ReactUnity/BackdropFilter"
109111 float4 _GrabTexture_TexelSize;
110112
111113 float4 frag ( v2f i ) : COLOR {
112- if (_Blur == 0 ) return tex2D (_GrabTexture, i.uv );
114+ if (_Blur == 0 ) return float4 ( 0 , 0 , 0 , 0 );
113115
114116 float3 sum = float3 (0 ,0 ,0 );
115117
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
117119
118120 sum += GRABPIXEL (0.05 , -4.0 );
119121 sum += GRABPIXEL (0.09 , -3.0 );
@@ -141,6 +143,7 @@ Shader "ReactUnity/BackdropFilter"
141143 #pragma shader_feature_local _SPECULARHIGHLIGHTS_OFF
142144 #pragma shader_feature_local _GLOSSYREFLECTIONS_OFF
143145 #pragma fragmentoption ARB_precision_hint_fastest
146+ #define GRAB_POS
144147 #include "UnityCG.cginc"
145148 #include "UnityUI.cginc"
146149 #include "ShaderSetup.cginc"
@@ -197,17 +200,18 @@ Shader "ReactUnity/BackdropFilter"
197200
198201 float4 frag (v2f i) : SV_Target
199202 {
200- // Grab the texture from behind the current object
201- float3 color = tex2D (_GrabTexture, i.uv).rgb;
203+ float2 uvgrab = i.uvgrab;
202204
203205 // Apply pixelate effect
204206 if (_Pixelate > 0 )
205207 {
206208 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;
209210 }
210211
212+ // Grab the texture from behind the current object
213+ float3 color = tex2D (_GrabTexture, uvgrab).rgb;
214+
211215 // Convert to grayscale if needed
212216 if (_Grayscale > 0 )
213217 {
0 commit comments