Hi,
I'm thinking about the best way to handle sprites with user selected colours, this is most commonly seen in an RPG where the player can choose for example skin and hair colour and perhaps one or two clothing colours as well.
So clearly the starting point is a layered image. But I see a couple of ways to go from there. We could just store the layers separately and draw them one at a time with the appropriate colour.
Or we could try and do something clever with the fragment shader, say we bind a greyscale texture as a layer map and use this to index into an array of colours passed as a uniform. This sounds simple enough, but I have a very poor feel for whether it would actually perform better. I suppose I should just try it. One thing I don't like about it is that it would be nice to use the same shader to draw things like spell particles and projectiles which are very unlikely to have multiple layers, making this somewhat wasteful.
Also I was looking into how the old infinity engine games store their character sprites and see something interesting: