
Change image’s color is a useful trick in game with pixel arts.
Usually, change color means create a new image with different palette chunk,
it cost more memory and bring a peak of cpu usage(when creating).
The more palettes, the more images need to be created;
Fortunately, use SHADER may avoid those troubles.
This is the effect : change “Offset” value to use different palette.
This is a very simple trick:
First:Seperate palette form image.
Forexample:Only 4 colors exist in “mario”, the new palette image is 4*4 and queue the colors in the last line.
Red in “mario” should change the value to (0.5,0,0), it mean the point with UV(0.5,0,0)in new palette image is red.

Second:Show color in new palette by UV in the upper image;
Third:Add more palettes in new palette image, and change “offset” to use them.

Download demo in last line.
1525420–87753–$demo.rar (112 KB)
