We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 11da07b commit d580523Copy full SHA for d580523
src/Shaders/IndexedToRGB.gdshader
@@ -7,14 +7,14 @@ uniform sampler2D palette_texture : filter_nearest;
7
uniform sampler2D indices_texture : filter_nearest;
8
9
void fragment() {
10
- float index = texture(indices_texture, UV).r * 255.0;
+ float index = texture(indices_texture, UV).r;
11
if (index <= EPSILON) { // If index is zero, make it transparent
12
COLOR = vec4(0.0);
13
}
14
else {
15
float n_of_colors = float(textureSize(palette_texture, 0).x);
16
- index -= 1.0;
17
- float index_normalized = index / n_of_colors;
+ index -= 1.0 / 255.0;
+ float index_normalized = ((index * 255.0)) / n_of_colors;
18
if (index_normalized + EPSILON < 1.0) {
19
COLOR = texture(palette_texture, vec2(index_normalized + EPSILON, 0.0));
20
0 commit comments