@@ -6,6 +6,7 @@ uniform float _ToneIntensity;
6
6
uniform half4 _ColorValue;
7
7
uniform float _ColorIntensity;
8
8
uniform float _SamplingIntensity;
9
+ uniform float _SamplingScale;
9
10
uniform sampler2D _TransitionTex;
10
11
uniform float4 _TransitionTex_ST;
11
12
uniform float _TransitionRate;
@@ -39,6 +40,11 @@ uniform float _TargetSoftness;
39
40
* step (uvMask.x, uv.x) * step (uv.x, uvMask.z) \
40
41
* step (uvMask.y, uv.y) * step (uv.y, uvMask.w)
41
42
43
+ float2 texel_size ()
44
+ {
45
+ return _MainTex_TexelSize.xy * _SamplingScale;
46
+ }
47
+
42
48
float3 rgb_to_hsv (float3 c)
43
49
{
44
50
const float4 K = float4 (0.0 , -1.0 / 3.0 , 2.0 / 3.0 , -1.0 );
@@ -241,7 +247,7 @@ half4 apply_sampling_filter(float2 uv, const float4 uvMask, const float2 uvLocal
241
247
float4 o = 0 ;
242
248
float sum = 0 ;
243
249
float2 shift = 0 ;
244
- const half2 blur = _MainTex_TexelSize.xy * _SamplingIntensity * 2 ;
250
+ const half2 blur = texel_size () * _SamplingIntensity * 2 ;
245
251
for (int x = 0 ; x < KERNEL_SIZE; x++)
246
252
{
247
253
shift.x = blur.x * (float (x) - KERNEL_SIZE / 2 );
@@ -380,13 +386,13 @@ half4 uieffect(float2 uv, const float4 uvMask, const float2 uvLocal)
380
386
// Sampling.Pixelation
381
387
#if SAMPLING_PIXELATION
382
388
{
383
- const half2 pixelSize = max (2 , (1 - lerp (0.5 , 0.95 , _SamplingIntensity)) * _MainTex_TexelSize.zw );
389
+ const half2 pixelSize = max (2 , (1 - lerp (0.5 , 0.95 , _SamplingIntensity)) / texel_size () );
384
390
uv = round (uv * pixelSize) / pixelSize;
385
391
}
386
392
// Sampling.RgbShift
387
393
#elif SAMPLING_RGB_SHIFT
388
394
{
389
- const half2 offset = half2 (_SamplingIntensity * _MainTex_TexelSize .x * 20 , 0 );
395
+ const half2 offset = half2 (_SamplingIntensity * texel_size () .x * 20 , 0 );
390
396
const half2 r = uieffect_internal (uv + offset, uvMask, uvLocal).ra;
391
397
const half2 g = uieffect_internal (uv, uvMask, uvLocal).ga;
392
398
const half2 b = uieffect_internal (uv - offset, uvMask, uvLocal).ba;
@@ -396,8 +402,8 @@ half4 uieffect(float2 uv, const float4 uvMask, const float2 uvLocal)
396
402
#elif SAMPLING_EDGE_LUMINANCE || SAMPLING_EDGE_ALPHA
397
403
{
398
404
// Pixel size
399
- const float dx = _MainTex_TexelSize .x;
400
- const float dy = _MainTex_TexelSize .y;
405
+ const float dx = texel_size () .x;
406
+ const float dy = texel_size () .y;
401
407
402
408
// Pixel values around the current pixel (3x3, 8 neighbors)
403
409
const float2 uv00 = uv + half2 (-dx, -dy);
0 commit comments