I couldn’t make LUT.glsl output unmodified colors except when using big identity LUTs.
I just read that the Sega Genesis has a 9-bit RGB palette (512 colors). I generated an identity LUT containing just that amount of colors: When applied, to a Sega Genesis screenshot it did not preserve original colors!
According to this Wikipedia article, the Sega Genesis’ palette is this: It’s a different set of colors. The channels are swapped but I edited “LUT.glsl” and tried it and it also didn’t preserve colors!
For reference, here is the desired output (unmodified colors):
I don’t know what the entries must be or maybe there’s something wrong with the shader?.
I tried with SNES. According to Wikipedia the SNES has a 15-bit RGB palette (32.768 colors). So I used “32.png” which is bundled with glsl shaders and contains just that amount of colors. The result was the same, LUT.glsl produced altered colors.
So why did colors change and how can it be fixed?
I’ll attach the shader mod and the LUTs: Modified LUT.glsl and Sega Genesis identity LUTs