Convert Tone Object ot Color Object

dullman

Villager
Member
Joined
Jun 7, 2015
Messages
20
Reaction score
0
Primarily Uses
Hello since mod said that it's better to create new topic so i started, 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). 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I'm not sure why you don't just use Tone.


But Tone is made up of red, green, blue and gray, and Color is made up of red, green, blue and alpha. I'm not sure how alpha and gray correspond, but I'd make a start by just inserting the numbers.


if myTone is the existing Tone object, I'd do this:

Code:
myColor = Color.new(myTone.red, myTone.green, myTone.blue, myTone.gray
then just muck around with the last setting a bit to see how you can manipulate the results.
 

dullman

Villager
Member
Joined
Jun 7, 2015
Messages
20
Reaction score
0
Primarily Uses
I'm not sure why you don't just use Tone.

But Tone is made up of red, green, blue and gray, and Color is made up of red, green, blue and alpha. I'm not sure how alpha and gray correspond, but I'd make a start by just inserting the numbers.

if myTone is the existing Tone object, I'd do this:

myColor = Color.new(myTone.red, myTone.green, myTone.blue, myTone.graythen just muck around with the last setting a bit to see how you can manipulate the results.
 Why not use Tone, the answer is simple while CCTS changes tone, khas light effects use bitmap to cover screen and draw lights onto it, and the simple answer is wrong whilst tone also used red, green, blue channels the allowed value are from range -255 to 255 so it's not easy as directly use one value into another, or any other simple manipulation that comes to mind
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
564
Reaction score
275
First Language
German
Primarily Uses
You can't really convert a tone into a color as they work a bit differently. The corresponding color depends on the color you applied the tone to, so you'd have to calculate the tone color for each single pixel.

For example, if you use Tone.new(0, 0, 0, 255) to turn the background into a grayscale image, the corresponding color would be Color.new(X, X, X), where X depends on the brightness of a particular background pixel. You can't achieve that by applying a static color to the background.

Edit: Algorithm was a bit flawed, however ShadowLurk gave a good example on how the application of a color tone works:

http://forums.rpgmakerweb.com/index.php?/topic/25788-how-does-color-toning-work/?p=247916

Edit2: Confirmed that cremnophobia is right here, Sorry.
Thanks for the correction. :)
 
Last edited by a moderator:

dullman

Villager
Member
Joined
Jun 7, 2015
Messages
20
Reaction score
0
Primarily Uses
You can't really convert a tone into a color as they work a bit differently. The corresponding color depends on the color you applied the tone to, so you'd have to calculate the tone color for each single pixel.

For example, if you use Tone.new(0, 0, 0, 255) to turn the background into a grayscale image, the corresponding color would be Color.new(127, 127, 127, X), where X depends on the brightness of a particular background pixel. You can't achieve that by applying a static color to the background.

Edit: Algorithm was a bit flawed, however ShadowLurk gave a good example on how the application of a color tone works:

http://forums.rpgmakerweb.com/index.php?/topic/25788-how-does-color-toning-work/?p=247916
I read this and tried to ask question, but mods said that i should create new topic, anyway you said i can't achieve this effect with static color, so if it's true then the only resolve to my problem would be find any good time system that uses applying bitmap to screen instead of toning screen, but must say i searched web and didn't find any (some has advanced word in them but they just too bright in nights (and looks kinda weird during night time))
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,359
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
How about using a time system that doesn't tone, and then have timed checks that use Khas' Light script commands to change the display based on the time variables?
 

dullman

Villager
Member
Joined
Jun 7, 2015
Messages
20
Reaction score
0
Primarily Uses
How about using a time system that doesn't tone, and then have timed checks that use Khas' Light script commands to change the display based on the time variables?
Is there system like that?? I mean i only found one system that might be called a proper time system and it's named advanced time system(or something like that), but problem was when i was testing it looked not so good during nights, so i think it's need a better choice of color.

btw. I don't require such features like making nights darker during new moon or bad weather(in that case also days will be darker), or different tint during seasons, or in different climate, but if i get a proper time system which looks good during night and also uses bitmap i would try to modify script to use that bitmap
 

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
216
Reaction score
97
Primarily Uses
Edit: Algorithm was a bit flawed, however ShadowLurk gave a good example on how the application of a color tone works:


http://forums.rpgmakerweb.com/index.php?/topic/25788-how-does-color-toning-work/?p=247916
He isn't correct either. It's common and fast to use this algorithm but it doesn't look as good as with differentially weighted color components (RGSS).

http://www.hbgames.org/forums/viewtopic.php?p=188077#p188077

Oh, by the way, the formulas for Tone, Color and stuff look like this:


tone:


Pixel + Tone


color:


(1 - Color.alpha) * Pixel + Color.alpha * Color


color does however not seem to modify the pixels alpha channel...


grayscale filtering:


Gray = Pixel.red * 0.299 + Pixel.green * 0.587 + Pixel.blue * 0.114


(1 - Tone.gray) * Gray + Tone.gray * Color
 

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