Game
Smacklings
4 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.

Short intro of us πŸ’•βœŒοΈ

We're an eletro duo based in Seoul πŸ‡°πŸ‡· Heavily influenced by the 90s.

Our new album #Xennials is all about the nostalgia of that era πŸ’½ CD listenin πŸ“Ÿ beeper beepin πŸ’Ύ floppy disks floppin days 😎

Stream now! 🎧

https://open.spotify.com/album/3YwWhnHWVy5cA8XOpbaGRA?si=8E9awqU…

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!

Shoobies leave a sticky trail of mucus in their wake, which can impede movement for any creature that steps in it.

We made a lot of improvements on the Freezing Plains visual. Things like pine trees, tiny bushes, some rocks, and others game props!

#IndieGame | #IndieDev | #GameDev | #PixelArt | #WaifuQuest | #WifeQuest | #screenshotsaturday

Runestones: from concept to in-game modelπŸ—Ώ

I have added rewards for quests so that villagers can give you something in return for your hard work helping them. πŸ₯³

I want to know - what's your favourite quest reward?

"Our work is never over" they said.