[HELP] translating a shader that uses arrays to store a palette

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By blank

Hello, lately I’ve been desperately trying to make a bayer matrix dithering shader, which I kinda succeeded at, and it works pretty fine, but the problem comes when I want to introduce palette indexing to it, so I can clamp the dither to specific colors.

I have something like this in mind -shadertoy example-

but they used an array to introduce the palette and sub-palette into the shader, I’ve tried using a texture of the palette and sampler2D with texelFetch() to get the colors, but that didn’t really work out and still left out the sub-palette to be desired.

If anyone of the more skilled shader-guys could help me, I would be really thankful. If any of you have something like this already made, I’m willing to buy a shader like this.

Thanks in advance,
-blank