From bb048d4aaa8efef1cf0c5b53dddd5255cd09142e Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Sat, 31 Jan 2026 16:30:10 -0800 Subject: [PATCH] more fixes --- blueprints/.glsl/Chromatic_Aberration_16.frag | 23 ++++++++++++------- blueprints/.glsl/Glow_30.frag | 3 +-- blueprints/.glsl/Image_Channels_23.frag | 3 +-- blueprints/.glsl/Unsharp_Mask_26.frag | 4 ++-- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/blueprints/.glsl/Chromatic_Aberration_16.frag b/blueprints/.glsl/Chromatic_Aberration_16.frag index c19216085..09a271146 100644 --- a/blueprints/.glsl/Chromatic_Aberration_16.frag +++ b/blueprints/.glsl/Chromatic_Aberration_16.frag @@ -2,6 +2,7 @@ precision highp float; uniform sampler2D u_image0; +uniform vec2 u_resolution; uniform int u_int0; // Mode uniform float u_float0; // Amount (0 to 100) @@ -22,38 +23,44 @@ const float INV_SQRT2 = 0.70710678118; void main() { vec2 uv = v_texCoord; vec4 original = texture(u_image0, uv); - + float amount = u_float0 * AMOUNT_SCALE; - + if (amount < 0.000001) { fragColor = original; return; } - + + // Aspect-corrected coordinates for circular effects + float aspect = u_resolution.x / u_resolution.y; vec2 centered = uv - 0.5; - float r = length(centered); - vec2 dir = r > 0.0001 ? centered / r : vec2(0.0); + vec2 corrected = vec2(centered.x * aspect, centered.y); + float r = length(corrected); + vec2 dir = r > 0.0001 ? corrected / r : vec2(0.0); vec2 offset = vec2(0.0); - + if (u_int0 == MODE_LINEAR) { - // Horizontal shift + // Horizontal shift (no aspect correction needed) offset = vec2(amount, 0.0); } else if (u_int0 == MODE_RADIAL) { // Outward from center, stronger at edges offset = dir * r * amount * RADIAL_MULT; + offset.x /= aspect; // Convert back to UV space } else if (u_int0 == MODE_BARREL) { // Lens distortion simulation (r² falloff) offset = dir * r * r * amount * BARREL_MULT; + offset.x /= aspect; // Convert back to UV space } else if (u_int0 == MODE_SWIRL) { // Perpendicular to radial (rotational aberration) vec2 perp = vec2(-dir.y, dir.x); offset = perp * r * amount * RADIAL_MULT; + offset.x /= aspect; // Convert back to UV space } else if (u_int0 == MODE_DIAGONAL) { - // 45° offset + // 45° offset (no aspect correction needed) offset = vec2(amount, amount) * INV_SQRT2; } diff --git a/blueprints/.glsl/Glow_30.frag b/blueprints/.glsl/Glow_30.frag index fe0725f3b..0ee152628 100644 --- a/blueprints/.glsl/Glow_30.frag +++ b/blueprints/.glsl/Glow_30.frag @@ -76,7 +76,6 @@ void main() { float t1 = threshold + 0.15; vec2 texelSize = 1.0 / u_resolution; - float aspect = u_resolution.x / u_resolution.y; float radius2 = radius * radius; float sampleScale = clamp(radius * 0.75, 0.35, 1.0); @@ -104,7 +103,7 @@ void main() { float fi = float(i); float dist = sqrt(fi / float(samples)) * radius * radiusJitter; - vec2 offset = dir * dist * texelSize * vec2(1.0, aspect); + vec2 offset = dir * dist * texelSize; vec3 c = texture(u_image0, v_texCoord + offset).rgb; float mask = smoothstep(t0, t1, dot(c, LUMA)); diff --git a/blueprints/.glsl/Image_Channels_23.frag b/blueprints/.glsl/Image_Channels_23.frag index 813475dcb..76d70af13 100644 --- a/blueprints/.glsl/Image_Channels_23.frag +++ b/blueprints/.glsl/Image_Channels_23.frag @@ -2,7 +2,6 @@ precision highp float; uniform sampler2D u_image0; -uniform vec2 u_resolution; in vec2 v_texCoord; layout(location = 0) out vec4 fragColor0; @@ -17,4 +16,4 @@ void main() { fragColor1 = vec4(vec3(color.g), 1.0); // Green channel fragColor2 = vec4(vec3(color.b), 1.0); // Blue channel fragColor3 = vec4(vec3(color.a), 1.0); // Alpha channel -} \ No newline at end of file +} diff --git a/blueprints/.glsl/Unsharp_Mask_26.frag b/blueprints/.glsl/Unsharp_Mask_26.frag index e45f0547f..f5990cb4a 100644 --- a/blueprints/.glsl/Unsharp_Mask_26.frag +++ b/blueprints/.glsl/Unsharp_Mask_26.frag @@ -36,11 +36,11 @@ void main() { for (int x = -samples; x <= samples; x++) { for (int y = -samples; y <= samples; y++) { vec2 offset = vec2(float(x), float(y)) * texel; - vec2 sampleCoord = v_texCoord + offset; + vec4 sample_color = texture(u_image0, v_texCoord + offset); float dist = length(vec2(float(x), float(y))); float weight = gaussian(dist, sigma); - blurred += texture(u_image0, sampleCoord) * weight; + blurred += sample_color * weight; totalWeight += weight; } }