Game Development Community

Color

by Thomas Shaw · in Torque Game Engine · 06/26/2005 (11:30 am) · 5 replies

Okay, I have had the engine for awhile now and just been fumbling around with this, but now I need to get serious.

How does color work in TGE?

The format is: 0.980000 .20000 .90000 1.0000

There are four numbers here. What do they mean? I have managed to create colors by tweaking these but I can't make any serious artistic choices since I don't know what each value specifically represents.

I am sure this is simple, but I have been able to figure it out yet.

Thanks

#1
06/26/2005 (12:42 pm)
TGE (to my understanding) has really 2 types of Colors:
ColorF and ColorI

Both of which are 4 numbers representing:
Red Green Blue Alpha

The ColorF has all the colors represented from 0.0 to 1.0. Meaning 0.0 of a particular item to 1.0 or max of a particular item. This also appears to be what you are looking at based on your floating point example above.

ColorI has all the colors represented from 0 to 255 ( of 0x00 to 0xff) Meaning 0 of a particular item to 255 or max of a particular item.

So ColorF of 0.0 1.0 1.0 0.5 is the same (minus rounding) as ColorI 0 255 255 127 or 0 Red, Max Green Max Blue and 1/2 Alpha.

Make Sense?
#2
06/26/2005 (1:59 pm)
OOOHHH, I just tried it. So the numbers represent the percent of RGB. Interesting....

Okay thanks allot that really helps
#3
06/26/2005 (3:00 pm)
If you're doing MLtext, it's the same as the ones used for HTML. Just thought I'd add that. You can get it out of any decent PaintingProgram out there like PS or PSP.
#4
06/26/2005 (4:26 pm)
Glad I could help and Stefan's tip helps me too. Didn't think about matching it HTML.
#5
06/26/2005 (11:47 pm)
Also, if you take the 0-255 sort and just divide them by 255 you'll get the floating point version. :)