Category: Game Code  ·  Originally posted January 23, 2009  ·  Last updated February 1, 2011

Color Shifting – 200% More Graphics for Free! (VB6)

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):

For the record, I imagine this image is © Blizzard Entertainment...

For the record, I imagine this image is © Blizzard Entertainment...

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

  1. Red -> Green
  2. Green -> Blue
  3. 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.

This site - and its many free downloads - are funded by donations from visitors like you.
Please consider a small donation to fund server costs and to help me support my family.
Even $1.00 helps. Thank you!

 

bookmark and share this article

Email this article to a friend Print a copy of this article Subscribe to article comments Bookmark this article on Delicious Submit this article to reddit Submit this article to Digg Submit this article to StumbleUpon Share this article on Facebook Tweet this article

related articles

Discussion (Be the first to comment!)

Public comments are closed for this article. Private comments may be submitted using this link.

Comments are closed.