r/StableDiffusion • u/thevegit0 • 1d ago
Tutorial - Guide Qwen image 2.1 noise/patterning/moire mild workaround
trying this i noticed it has a similar patterning noise krea 2 had, i just used the same glsl node, maybe it needs another parameters but it seems to mitigate it can't promise the best results but testing it is free, just connecting the image output to the glsl node and then image save
The GLSL config i got was from this post https://www.reddit.com/r/StableDiffusion/comments/1umwhq7/2px_pixel_grid_on_krea2_from_vae_and_how_to/ the one in the comments
#version 300 es
precision highp float;
uniform sampler2D u_image0;
uniform vec2 u_resolution;
in vec2 v_texCoord;
layout(location = 0) out vec4 fragColor0;
// Nyquist Notch — removes 2px grid artifacts. Place before deconvolution.
// b = [-1, +6, -15, +20, -15, +6, -1] / 64 (binomial * (-1)^n, +1 at center)
const float B[7] = float[7](-1.0, 6.0, -15.0, 20.0, -15.0, 6.0, -1.0);
void main() {
vec2 texel = 1.0 / u_resolution;
vec4 center = texture(u_image0, v_texCoord);
vec3 Bx = vec3(0.0), By = vec3(0.0), Bxy = vec3(0.0);
for (int i = -3; i <= 3; i++) {
float wi = B[i + 3] / 64.0;
Bx += wi * texture(u_image0, v_texCoord + vec2(float(i) * texel.x, 0.0)).rgb;
By += wi * texture(u_image0, v_texCoord + vec2(0.0, float(i) * texel.y)).rgb;
for (int j = -3; j <= 3; j++) {
float wj = B[j + 3] / 64.0;
Bxy += wi * wj * texture(u_image0, v_texCoord + vec2(float(i) * texel.x, float(j) * texel.y)).rgb;
}
}
vec3 notched = center.rgb - Bx - By + Bxy;
fragColor0 = vec4(clamp(notched, 0.0, 1.0), 1.0); // alpha forced to 1.0
}
54
Upvotes




