Could you explain me light and shadow concept
from RGB and math point of view.
I need to get three colors from one.
should be produced.
How could I do it?

And one more question what is the way around if given color is too
dark to make shadow from it?
How would one bias it to get yet 2 additional colors for 3D effect?

I'm absolute beginner in color field, detailed explonations are wellcome.
Posted on 2003-03-13 18:36:22 by The Svin

Hue is the color. I'm sure there are many methods to choose three colors, but I would base my choice on the intensity of the color. If the color intensity is between 256/3 and 512/3, then the highlight color is I - (256/3) and the shadow color is I + (256/3). For lighter/darker colors the complement of the hue could be used for the out of range color.
Posted on 2003-03-13 20:49:10 by bitRAKE
I've drawn hundreds of 3D buttons in Paint. There are 1,2 and 3-line heights. I prefer 2-line ones.
You have this:


X is the color of the face {R1:G1:B1}
B is black {0:0:0}
W is white
L is "light" {R1*2 : G1*2 : B1*2}
D is "dark" {R1/2 : G1/2 : B1/2}

For a better picture, make a snapshot of a normal Win button, and you should know the simple formula I gave for "Dark" and "Light" above.
Posted on 2003-03-13 21:30:01 by Ultrano
Thanx, bitRake and Ultrano for your informative replies,
I hope you wouldn't refuse to guide me if I have further questions.
Rickey, a very good link!
Exactly what I needed when I was asking to explain math concept of RGB!
Posted on 2003-03-14 04:47:48 by The Svin
I've been making some slappy experiments
with 3d colored lines, testing different logic
for 3 color creation.
And noticed something that I yet can not fully comprehend.
For different colors diviation of light,shadow,normal is
different to achive shadow effect.
For example for pure green it's might be upto 5 times less then
for pure blue.
Here are some not optimized procs I briefly wrote to test color logic.
there is proc Pens3D that creates three pens.
If one would share simular 3D color procs, I'd appreaciate it.
Posted on 2003-03-16 06:52:39 by The Svin
The color on the screen is non-linear -- that is the reason for converting the colors to an HSL system, and then making linear adjustments from that system, then convert back to RGB.
Posted on 2003-03-16 11:30:16 by bitRAKE
If you understand it why not write in asm?
Or pseudo algo?
From first link it was clear from math equation
how to RGB - > HSL, though accurate implementation
of the equations seems too lengthy and slow.
I'm sure there should be shorter ways.

HueColour (float h, float m1, float m2)
What is h here? Hue?
What means hue here? RGB value?
(for example the same format in wich I specify color in CreatePen API?
if yes why is it float?)
I tried to compile it to lookup machine code - VC reported 3 errors
Posted on 2003-03-16 13:13:58 by The Svin
Posted on 2003-03-16 13:36:00 by bitRAKE
I found it by search :)
Anyway Rickey thaks for direction. (HSL and RGB)
Posted on 2003-03-16 13:53:20 by The Svin
I tried you "L" approach now with iblis procs.
The same thing - for different hue Light addjusment
should be different to achive light\shadow effect
Posted on 2003-03-16 14:42:59 by The Svin