Game
Smacklings
5 years ago

Shady business saves time!


That headline was a little long shot. This post is about shading with shader programs. Here is the case:

In Smacklings, if both players chooses same character, in some cases it might be difficult to tell which one you are controlling.

Solution? Alter the colors of one of the characters. Three different ways comes to mind how to do it. First one is to create two different image asset sets with other having altered colors. Takes twice as much space but gets the job done.

Second option is to use default shader's color alteration abilities. Most of the game engines ship default shader that has a field called color. Usually has a white color assigned to it. Every pixel is then multiplied by that color and by multiplying with white the art is displayed using its original colors. Turn the color-field blue and your art will have blue tint on it. Problem with that solution is that your art becomes darker and it is just tinted.

Third solution is - like you would expect by now - is to write your own shader. With that it is possible do all kinds of tricks with the color. Want to inverse colors? Turn everything gray? Shift the colors? Can do. Color shifting is what we decided to go with.

Theory

Generally we computer guys separate color into three components, Red, Green and Blue. But there is also other representation, HSV. Hue, Saturation and Value. In that case Hue dictates the color of the pixel without caring how dark (Value) it is or how much there is color (Saturation). Hue is represented as an angle ranging from 0 to 360. By pushing that component same amount for every pixel alters their color, but the effect is very different than multiplying with another color.

There wont be tint towards one color. Instead all the colors shift same amount but the end result is based on what color it originally was. Red pixels may become blue, blue pixels green and green pixels red, for example.

The effect is applied on image below.

image.png

That technique is pretty common and it shouldn't be too difficult to find a complete shader for your game engine.



0 comments

Loading...

Next up

Here is one of the chracters, Dan, being photographed. The small paper roll behind his head was used as a support. After that it was edited in Photoshop and exported to the game as a png file.

Smacklings announces here on Game Jolt! Go check our development progress https://gamejolt.com/games/smacklings/477866

Here is a fresh screenshot from two-player mode.

Did you know that today is #InternationalJazzDay? 🎷😎

No? 😯 Well, we couldn't pass up this date!

And what better to celebrate this day than #Pecaminosa #OST? 🎷

Let us know what you think about it and have a great weekend!

Bandana Dee the Dream Friend

Quantum precognition is one of the most powerful cards. End game cards & equipment. Demo/alpha build boss is no match for this deck.

What you all think

Shuiro Haname. #Commission

Commission for @ShuHaname

Alone Together....