Color shifting is a very fast, very simple effect that can greatly simplify the work of game artists. Here’s a demonstration (using a classic StarCraft Siege Tank):
Color shifting is relatively simple to implement – all we do is shift the red, green, and blue values of each pixel to the right (or left). For example, a right-shift could work like so
- Red -> Green
- Green -> Blue
- Blue -> Red
Note that the direction of the shift is somewhat misleading (as Windows DIBs, for example, encode color bits in BGR order), but the direction isn’t nearly as important as the effect – that without any extra work, we can generate two color variations on a source image.
Because gray-toned values have RGB values that are identical (or nearly identical), color shifting doesn’t change the appearance of gray pixels. This is pretty clear on the siege tanks above, as the color shifting merely adjusted the subtle hues of the gray regions.
However, the colored portion near the front of the tank changes drastically. This is expected, since a sharply colored region must have large variations in its RGB values.
Can you see the obvious game design implication? :) If your game has the same unit available for multiple teams, races, or guilds, color-shifting can turn one base image into at least three possible team colors. And, because color shifting is such a low-cost function, it can be easily performed on the fly – saving your artists work, and saving file bloat from redundant images.