+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Funky Color Function - Help
Pages: [1]
Author Topic: Funky Color Function - Help  (Read 2 times)
Tauwasser
Guest
« on: November 25, 2008, 06:45:49 pm »

Hi,

I thought maybe somebody here is well-versed in the art of creating gfx and so on and might help with this.
So I was hacking along and tried to determine some functions purpose based on its output. The function is obviously a split "fade from black to white" routine. Split in the sense that it determines the gradient used for the part "black to original color" in a different routine than the "original color to white" part. The black part goes straightforward and gives multiples of 12.5% of the original color, that is 0*12.5% = black, 1*12.5% = 1st gradient, ..., 8*12.5% = original color.
After that it changes and I don't quite get what it is actually doing besides making a quite obvious move to white color.

Now, this is gameboy, so for each channel of a color, rgb, there are values from 00 to 31 decimal instead of 32bit colors' values of 000 to 255 decimal.

I've made some diagrams showing what the function does for every iteration until white with the original color given to it, which do look ominously like some purposeful functions, as well as some example colors of the transformation to white in each iteration.

So basically, I'm hoping somebody can tell me what these do on a color level rather than on a functional level. Like I determined for the black gradients in percent of original color (which works totally different from this part, so I could not correlate).

So here goes: (I don't want to use thumbnails, because I think it might be clearer to have them lined up in a row)

1st iteration: channel OR 05 (decimal).



2nd iteration: channel OR 10 (decimal).



3rd iteration: channel OR 15 (decimal).



4th iteration: channel OR 20 (decimal).



5th iteration: channel OR 21 (decimal).



6th iteration: channel OR 30 (decimal).



7th iteration: channel OR 31 (decimal) -> this yields white.


So, umm basically, this makes the color go white in the end, however, I don't see how these things are in any way significant and have to be in that order to get a smooth fade out to white...

Some examples:






Thanks for any clue on this,

Tauwasser
« Last Edit: November 26, 2008, 01:15:05 pm by Tauwasser »
GenoBlast
Guest
« Reply #1 on: November 25, 2008, 07:40:31 pm »

I feel like a science teacher for saying this, but could you please label the axes? Tongue
I'm not asking you to re-edit the images, but if you could add some labels, it would certainly help me understand WTF those graphs mean. Smiley
DarthNemesis
Guest
« Reply #2 on: November 25, 2008, 08:25:51 pm »

Quote from: Killa B on November 25, 2008, 07:40:31 pm
I feel like a science teacher for saying this, but could you please label the axes? Tongue
I'm not asking you to re-edit the images, but if you could add some labels, it would certainly help me understand WTF those graphs mean. Smiley

x is the original value for a color channel, y is the output value for that color channel. Over 7 iterations the function takes the input value and gradually increases it to the maximum of 31, which results in a white color. The color chart at the bottom shows how each color changes after each iteration.

Tauwasser, it might help if you redraw the graphs to have the same vertical scale.
« Last Edit: November 25, 2008, 08:31:20 pm by DarthNemesis »
Neil
Guest
« Reply #3 on: November 25, 2008, 08:36:56 pm »

Quote from: DarthNemesis on November 25, 2008, 08:25:51 pm
Tauwasser, it might help if you redraw the graphs to have the same vertical scale.
Lies, bloody lies, and statistics?
Tauwasser
Guest
« Reply #4 on: November 26, 2008, 01:18:41 pm »

I did as DarthNemesis suggested and made them all the same scale.

Yes, they are in the fashion that the horizontal axis value (which did feature a label) is the old value and the vertical axis has all the new values.

The more I think about it, as is evident by the total black "gradient", it ors with different shades of grey - I had only looked at the bit patterns before that... So err... this really obvious thing slipped me.
However, I can see no defining argument at all... Notice how many colors get a bit lighter (like the first 3 examples), however, the pinkish color gets darker in the first iteration, not lighter. Is this maybe a common graphics effect/filter?

Thanks,

Tauwasser
GenoBlast
Guest
« Reply #5 on: November 26, 2008, 01:39:07 pm »

Quote from: Tauwasser on November 26, 2008, 01:18:41 pm
Notice how many colors get a bit lighter (like the first 3 examples), however, the pinkish color gets darker in the first iteration, not lighter.
It gets lighter. It seems to turn a strange shade of purple, but it's still lighter.

I really don't know what's going on either. Maybe it looks better on an actual GBC? What really bothers me is that the third color starts out turquoise, then proceeds to turn cyan, then indigo, then what looks like a very light shade of red before finally turning white.

Maybe the only real answer is the "devs smoking crack" idea that's been tossed around a couple times.
Tauwasser
Guest
« Reply #6 on: November 27, 2008, 06:29:54 am »

Hmm, but it works o.o
The only thing I've found so far is a Javascript called "Strobe" that does fade in and fade out for black text. I see why it works for black, however, I fail to see why it works for other colors though...

Mystery functions suck..

cYa,

Tauwasser
GenoBlast
Guest
« Reply #7 on: November 27, 2008, 07:35:04 pm »

That "strobe" thing just has a list of gray shades that it cycles through. There's no equations involved. :huh:
Tauwasser
Guest
« Reply #8 on: November 27, 2008, 08:19:10 pm »

However, this function in the rom ORs with grey shades, as you can see with the last example, total black to total white.
Maybe it was not perfect but good enough for the programmers to leave it that way :?

cYa,

Tauwasser
GenoBlast
Guest
« Reply #9 on: November 27, 2008, 09:58:52 pm »

Quote from: Tauwasser on November 27, 2008, 08:19:10 pm
Maybe it was not perfect but good enough for the programmers to leave it that way :?
That's what I was thinking. Someone probably had the idea to do it that way, and the rest of the team was like "alright, that works for me."

It really does seem like just a really simple solution to the problem, now that you mention it. When I read your first post I didn't realize you had meant bitwise-or, so I completely disregarded the "OR"s.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC