Skip to content

Commit

Permalink
Revert "Slightly optimize IndexedToRGB.gdshader"
Browse files Browse the repository at this point in the history
This reverts commit 7cf87ac.
  • Loading branch information
OverloadedOrama committed Nov 22, 2024
1 parent 11da07b commit d580523
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Shaders/IndexedToRGB.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit d580523

Please sign in to comment.