07-03-2014, 05:32 PM
(07-02-2014, 12:28 PM)TheShyGuy Wrote: That bitrate shader is pretty cool. I didn't think doing that kind of post processing was that simple.
Do you do the input color->base palette distance check because of how your team works with pixels or because that's just how you support palettes?
Edit:
If it's the latter, why not just convert the original image to a indexing image using a base palette, or generating a base palette. Then, you just send in the indexing image to the shader + the desired (alternate) palette.
paletteUVCoord = sample(indexTexture,UVCoord) / 255
outputColor = sample(altPaletteTexture,paletteUVCoord)
The shader I made does send in the original palette and the alternate palette and coverts the base image to one that only uses that palette. Then from there you can add an alternative palette, play around with things like brightness, etc.
I do this by iterating through the palette with a loop dependent on a constant called SAMPLES. It's a constant because loops must not be dynamic due to the way GLSL works..
As for generating a base palette, that cannot be done with shaders, but would have to be done with a CPU method that would output a list of colors.
I'll admit I had a bit of trouble answering this, but I hope that was good enough. xD