Colors in Particle scripts.
by Mark Barner · in Torque Game Engine · 10/26/2003 (8:21 am) · 8 replies
I am just learning to script and wanted to know if someone could please explain the color in scripts.
ex.:
times[0] = 0.0;
times[1] = 0.33;
times[2] = 0.66;
colors[0] = "0.7 0.7 0.0 0.7";
colors[0] = "0.9 0.8 0.0 0.3";
colors[0] = "0.8 0.8 0.0 0.2";
sizes[0] = 4.0;
sizes[1] = 0.5;
sizes[1] = 0.2;
I know it is red,green,blue,intensity. But I was wondering what the values of 0.7 or 0.3 are? I am used to using numbers for colors like 255,45,100 ......where do you get these values from and is their a program that allows me to pick the colors and outputs the values so I can paste them into the script?
ex.:
times[0] = 0.0;
times[1] = 0.33;
times[2] = 0.66;
colors[0] = "0.7 0.7 0.0 0.7";
colors[0] = "0.9 0.8 0.0 0.3";
colors[0] = "0.8 0.8 0.0 0.2";
sizes[0] = 4.0;
sizes[1] = 0.5;
sizes[1] = 0.2;
I know it is red,green,blue,intensity. But I was wondering what the values of 0.7 or 0.3 are? I am used to using numbers for colors like 255,45,100 ......where do you get these values from and is their a program that allows me to pick the colors and outputs the values so I can paste them into the script?
#2
10/26/2003 (8:56 am)
OpenGL uses values from 0.0f to 1.0f for colors, that's why torque does so too.
#3
10/26/2003 (9:38 am)
Thanks guys. One other question.... do you have to have 3 colors? color[0],color[1],color[2]? I think this confuses me the most. I have seen some people use only two. What do these multiple colors do? Sorry about all the questions....I have searched the forums and could not find anything on this. If I got a book on OpenGL will this be the same for the Torque?
#4
10/26/2003 (9:43 am)
If you look there are 3 colors, 3 times, and 3 sizes. This basically states that at time 0 the particles will be color 0 and size 0, at time 1 they will be color 1 and as big as size 1, etc...
#5
I never actually thought of that ... heh
@Mark: Btw, in the code you posted above you set the 3 colors to 0, if you don't want the others just delete them, but doing that is effectively replacing the first 2 with the last one.
10/26/2003 (10:11 am)
@Matt: mmm... nice call :) I never actually thought of that ... heh
@Mark: Btw, in the code you posted above you set the 3 colors to 0, if you don't want the others just delete them, but doing that is effectively replacing the first 2 with the last one.
#6
colors[0] = "0.7 0.7 0.0 0.7";
colors[0] = "0.9 0.8 0.0 0.3";
colors[0] = "0.8 0.8 0.0 0.2";
to
colors[0] = "0.7 0.7 0.0 0.7";
colors[1] = "0.9 0.8 0.0 0.3";
colors[2] = "0.8 0.8 0.0 0.2";
Otherwise at time 0 your colors would only be the last one (the .8 .8 .0 .2). and the first two color definitions are basically useless.
10/26/2003 (11:37 am)
Err yeah exodus is right, didn't catch that. changecolors[0] = "0.7 0.7 0.0 0.7";
colors[0] = "0.9 0.8 0.0 0.3";
colors[0] = "0.8 0.8 0.0 0.2";
to
colors[0] = "0.7 0.7 0.0 0.7";
colors[1] = "0.9 0.8 0.0 0.3";
colors[2] = "0.8 0.8 0.0 0.2";
Otherwise at time 0 your colors would only be the last one (the .8 .8 .0 .2). and the first two color definitions are basically useless.
#7
10/26/2003 (11:40 am)
Sory about that eXoDuS! Was a cut and paste of the same line... should have been 0,1,2. Thanks to all of you for the great answers. I fully understand it now. Thanks again.
#8
10/26/2003 (2:26 pm)
No problem.
Torque Owner Ben Swanson