Help-Random color

hi all,
I`m trying to make a small script
that can randomiz my vray light color.
How can i randomiz 5 specific colors?
Now my scrip is mixing all the values..

clr01=color 255 150 120
clr02=color 180 223 255
clr03=color 50 250 50
clr04=color 255 0 0
clr05=color 0 0 255

for o in selection do o.color = random clr01 clr05

thanx

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

colors = #(color 255 150 120, color 180 223 255, color 50 250 50, color 255 0 0, color 0 0 255)
-- or U can use point3 values or predefined colors names 
--colors = #([255,150,120], [180,223,255], [50,250,500, red, blue)
vrLight = VRayLight() -- create VRay Light
vrLight.color = colors[random 1 colors.count]

bga

barigazy's picture

...

If you have many lights in the scene:
#1 and U want to randomize light color with predefined colors
then try this

colors = #(color 255 150 120, color 180 223 255, color 50 250 50, color 255 0 0, color 0 0 255)
for vrL in lights where isKindOf vrL VRayLight do vrL.color = colors[random 1 colors.count]

#2 to randomize all light colors

for vrL in lights where isKindOf vrL VRayLight do vrL.color = random black white

bga

lnio's picture

Great thanks! one question

Great thanks!
one question -
how can i random the color by temperature?
because when changing the temp i need to change the color
in the light parametes..

$.color_temperature = 5000
$.color = color 255 247.188 212.708

how can i bind them together when randomiz?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.