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.

Smile! Here, take some happy pills! ✨💊 #Blender #3DModelling #3DArt Buy me a Ko-fi: https://ko-fi.com/barbarafb_

Have a good Boi

What you all think

Sometimes the suction cup get sticky. Small animation I made in Blender after doing my tutorial on picking up/dropping objects in animations. Crate model by jQueary (https://sketchfab.com/3d-models/game-ready-sci-fi-crate-d98deca6…).

So here's the first of the zodiac signs i will make for the next weeks.

A Shiny Mega Gengar 🌟 For @ManutkArt 's #ThreeColorsChallenge!

Today I tackled drawing different variations of facial expressions for one of the main characters in Eden. What do you think of it? :) Eden: https://gamejolt.com/games/Eden/592698