How does color toning work?

Status
Not open for further replies.

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
When you tint the screen or a picture, how does it determine the RGBA values for each pixel?


RGBA ranges from 0-255


Tone components range from -255 to 255
 
Last edited by a moderator:

BadMinotaur

You can do it!
Veteran
Joined
Mar 13, 2012
Messages
260
Reaction score
115
First Language
English
Primarily Uses
RMVXA
I think it works by increasing or decreasing that specific color on each pixel by a certain amount. I'm not sure how that amount is calculated though.

Since the ranges are from -255 to 255, maybe it will add that number to the color value of the image, capping out at 255? If so, that would explain why setting a color tone of RGB(255,0,0) makes pure black look like pure red. It would also explain why setting a tone of RGB(-255,0,0) makes the pure reds completely black.

There might be some other math associated with it somewhere, but just looking at how the colors behave that seems to be how it works.

EDIT: Oh, that "other math" is probably how grey factors in. I'm not sure where that comes in, all of the above assumed a "grey" of 0.

EDIT 2: "Grey" might just be a "colorize" function with another name. I notice that setting the tone to RGBg(255,0,0,255) makes all of the colors pure red, but it keeps each color's saturation and brightness value, to a point -- black is still changed to pure red with this tone.

EDIT 3: Maybe it changes everything to the RGB tone first, then changes the hue of all of the colors to that tone's hue, depending on the grey value? But then I don't think so 'cause that wouldn't explain why some areas become more bright than others.

Sorry for the stream-of-consciousness posting, heh. I'm just not good at color math in general so I have to puzzle it out step-by-step. I'm sure there's a simple solution to what you're asking.
 
Last edited by a moderator:

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
The method employed to make the tint is quite simple. First, the RGB values are brought to gray based on the tone's power component. Then tone's RGB components are added to the resulting values. Alpha is not touched.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
So for RGB


+255 makes the component max


-255 basically removes the component


0 doesn't touch the component


I'm not sure how the gray works.


Gray ranges from 0 to 255.


What does gray of 0 mean? It probably isn't setting the RGB components to 0.


255 makes the whole image gray.
 

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
The gray value denotes the grayscaling power.

Let's say a color(186, 27, 224). The grayscale color value for this is the mean of all color components, so it is (186+27+224)/3, or about 145.

The gray denotes how much the original color value will deviate to this grayscale color value. So a gray value of 128 will result in this:

R = 186 - ((186-145) * 128/255) = 165

G = 27 - ((27-145) * 128/255) = 85

B = 224 - ((224-145) * 128/255) = 184

After this, the resulting color values will be shifted according to the tone's respective color values, which is a simple addition operation with output limited to 0 and 255.

The grayscale calculation is far more complex when compared to the tone balancing. It is even noted in the help file that the processing time will be longer when it is used.
 
Last edited by a moderator:

BadMinotaur

You can do it!
Veteran
Joined
Mar 13, 2012
Messages
260
Reaction score
115
First Language
English
Primarily Uses
RMVXA
^ See? A perfectly simple solution. =P
 

dullman

Villager
Member
Joined
Jun 7, 2015
Messages
20
Reaction score
0
Primarily Uses
Hello i don't start new topic since i have a similar question, my problem is that i convert rpg maker xp script CCTS (time system) to vx ace and works fine, but the khas awesome effect works on different rule than my script (CCTS modify a tone depends on hour/month/season/climate) so the easiest way for me is to create a Color object from Tone object and i want to know how it's created from algorithm, what steps i need to do to successfully create new color object from Tone object (i believe it's possible since The Tone object somehow change Color object on screen). I tried using the algorithm that ShadowLurk showed but it doesn't return a proper Color object.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,359
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
Hello i don't start new topic since i have a similar question,
Please do start a new topic and do not hijack someone else' topics or necropost. There are a lot of reasons for that.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,015
Members
137,563
Latest member
MinyakaAeon
Top