From d580523c6eabcdb598bd13cd37d6ef5b82d8472c Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Fri, 22 Nov 2024 18:29:27 +0200 Subject: [PATCH] Revert "Slightly optimize IndexedToRGB.gdshader" This reverts commit 7cf87ac142bc732b35c779949634be17b7b51bb6. --- src/Shaders/IndexedToRGB.gdshader | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Shaders/IndexedToRGB.gdshader b/src/Shaders/IndexedToRGB.gdshader index 1ca167744..b86caa1a8 100644 --- a/src/Shaders/IndexedToRGB.gdshader +++ b/src/Shaders/IndexedToRGB.gdshader @@ -7,14 +7,14 @@ uniform sampler2D palette_texture : filter_nearest; uniform sampler2D indices_texture : filter_nearest; void fragment() { - float index = texture(indices_texture, UV).r * 255.0; + float index = texture(indices_texture, UV).r; if (index <= EPSILON) { // If index is zero, make it transparent COLOR = vec4(0.0); } else { float n_of_colors = float(textureSize(palette_texture, 0).x); - index -= 1.0; - float index_normalized = index / n_of_colors; + index -= 1.0 / 255.0; + float index_normalized = ((index * 255.0)) / n_of_colors; if (index_normalized + EPSILON < 1.0) { COLOR = texture(palette_texture, vec2(index_normalized + EPSILON, 0.0)); }