diff --git a/effects/shaders/crop.frag b/effects/shaders/crop.frag index 084466485..340f6fdaf 100644 --- a/effects/shaders/crop.frag +++ b/effects/shaders/crop.frag @@ -3,6 +3,7 @@ uniform float top; uniform float right; uniform float bottom; uniform float feather; +uniform vec2 resolution; uniform mediump float amount_val; @@ -15,23 +16,26 @@ vec4 process(vec4 col) { alpha = 0.0; } } else { - float f = pow(2.0, 10.0-(feather*0.1)); + + float f = pow(2.0, 10.0-(feather*0.25)); if (left > 0.0) { - alpha *= clamp(((v_texcoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left + alpha *= clamp(((resolution.x*v_texcoord.x+(0.5/f))-(left*0.01*resolution.x))*f, 0.0, 1.0); // left } if (top > 0.0) { - alpha *= clamp(((v_texcoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top + alpha *= clamp(((resolution.y*v_texcoord.y+(0.5/f))-(top*0.01*resolution.y))*f, 0.0, 1.0); // top } if (right > 0.0) { - alpha *= clamp((((1.0-v_texcoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right + alpha *= clamp(((resolution.x*(1.0-v_texcoord.x)+(0.5/f))-(right*0.01*resolution.x))*f, 0.0, 1.0); // right } if (bottom > 0.0) { - alpha *= clamp((((1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom + alpha *= clamp(((resolution.y*(1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01*resolution.y))*f, 0.0, 1.0); // bottom } + + } return col * alpha;