Is there a way to do a very simple palette swap? Like, just adding some code to an object's draw command to use a different image/shader for the color table? I'm trying to get player 2's units to use the same images as player 1 but use a different palette.
I've been looking at:
It just seems like a lot of moving parts for something simple.
The idea here is to use the red channel (actually you can use any one of them) of the base color to index a color from the color palette.
This would require you to modify the red channel of your images so that they contain the color index for each pixel.
This is not very difficult, you could make a little program to do that automatically. It could be done at runtime, though I would suggest the image resources be converted. (keep backups of the original images).
There are other technical details which I won't go into for the moment.
...
Alternatively you could try using a color look up table shader, which is a little more complicated (only the shader itself actually), but has the advantage that you wouldn't need to modify any of your images in any way.
I did. A trick you can use, that I did, is use a simple shader to modify certain pixels of a sprite when it's drawn. In my case, I simply made a man with a white shirt and passed the whole sprite into a shader. The shader targetted the white pixels of his shirt and swapped them with a different color that I specificed using 3 float uniforms. (RGB). That way only a single part of the sprite was colorized while the remainder remained untouched.