From 3fa0110614c329deef9cd25017d86cfffcf70d7c Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Mon, 10 Feb 2025 21:01:22 +0200 Subject: [PATCH] Make the preview of the gradient dialog be more accurate with the result Basically just pixelate the UVs to the canvas size. --- src/Shaders/Effects/Gradient.gdshader | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Shaders/Effects/Gradient.gdshader b/src/Shaders/Effects/Gradient.gdshader index 6888fdbca..4a3368c0c 100644 --- a/src/Shaders/Effects/Gradient.gdshader +++ b/src/Shaders/Effects/Gradient.gdshader @@ -69,9 +69,9 @@ float dither(vec2 uv, float modified_uv, ivec2 image_size) { void fragment() { vec4 original_color = texture(TEXTURE, UV); vec4 selection_color = texture(selection, UV); - //vec2 tex_size = 1.0 / TEXTURE_PIXEL_SIZE; - //vec2 uv = floor(UV * tex_size) / (tex_size - 1.0); - float modified_uv = modify_uv(UV); + vec2 tex_size = 1.0 / TEXTURE_PIXEL_SIZE; + vec2 uv = floor(UV * tex_size) / (tex_size - 1.0); + float modified_uv = modify_uv(uv); if (repeat == 1) modified_uv = fract(modified_uv); else if (repeat == 2) @@ -92,7 +92,7 @@ void fragment() { } continue; } - if (modified_uv > off) { + if (modified_uv >= off) { if (i == n_of_colors) { output = second; }