Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

RGB vector values

Fafnir Fauna
Downy Cat
Join date: 23 Jun 2004
Posts: 34
07-14-2004 20:34
Can anyone explain how RGB values work in a vector in SL?

I know 1 is full color for the color channel, and 0 results in none of that color channel, and the floating point numbers between are different ammounts of Red Green Blue added into the 'mix'.

Now my question is.. How would you say.. take a standard RGB color reference (ie; <255, 255, 255> = White) and convert it to SL's float vector?

I'm just trying to find a way to make it easier for me to find the color I want when writing a script that changes the color of an object, instead of the trial and error way I'm currently doing!
Archanox Underthorn
Registered User
Join date: 20 May 2003
Posts: 168
07-14-2004 20:41
Treat each vector value as a percentage of 255. So to convert from vector to the RBG values, multiply each vector value by 255.

<0.3,0.4,0.5> : <0.3x255,0.4x255,0.5x255> : R76.5 B102 G127.5

edit: and vice versa, to get from RBG to vector, divide each value by 255
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
07-14-2004 21:04
easy way to convert.

<0.1,0.2,0.3>*255

<25,51,76>/255

no need to devide and multiply each entry just do it to the entire vector :)
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Siggy Romulus
DILLIGAF
Join date: 22 Sep 2003
Posts: 5,711
07-14-2004 21:21
Easy sleazy hack way to work it out..

Rez a prim, put a script in to spit out it's color on a touch.

Make the prim the color you want, then touch it.. Someone put a quick script in the script library on it, and I think the idea is brilliant.

Siggy.
_____________________
The Second Life forums are living proof as to why it's illegal for people to have sex with farm animals.

From: Jesse Linden
I, for one, am highly un-helped by this thread
Fafnir Fauna
Downy Cat
Join date: 23 Jun 2004
Posts: 34
07-14-2004 21:35
Cool. Thanks guys. :D