ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

randomly changing colour of a light inside a 3d room

FAQ   •   VIEW ALL
 randomly changing colour of a light inside a 3d room on Mar 13, 2012 at 4:29:18 am

Hi guys
I have to make the flicker of a tv light on the walls of a simple 3d room I have made in after effects. I need it to flicker red blue and green......more blue of course. I managed to do it by precomposing the room with a white light. Then adding a different coloured tints for each colour to the precompose then chopping it up for each colour (lots of layers) with wiggler on there opacities to may em flicker.

Only problem is I need to have this happen to twenty separate rooms in the one shot...its looking at the side of a building. So I want to know if there s a way of making the different coloured lights without so many layers?

thanks miles

 Re: randomly changing colour of a light inside a 3d roomon Mar 13, 2012 at 6:34:00 pm

if you wanted totally random colors that changed every frame, then an expression like this in the light's color property would do just that:

random([0,0,0,1],[1,1,1,1])

but i have a feeling that would be too random...

a wiggle expression may give you a more smooth random. something like this would be smotther:

wiggle(1,1,1)

in that expression the first value is the frequency of change, specifically the number of time it changes the color per second (in this case once per second). the second value is the amount of change -- in ae, rgb color is defined by value between 0 and 1. rgb red, for example is 1,0,0, rather than the typical 8-bit color value 255,0,0 -- so if you want less change set that value to a number between 0 and 1. the third value effects how smoothly the colors would change per the frequency. a higher value will make it more wiggly (flickering) a low value will be more smooth.

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW

 Re: randomly changing colour of a light inside a 3d roomon Mar 13, 2012 at 6:46:38 pm

actually, since wiggle() by it self will also effect the alpha component of ae color (ae measures color as rgba), this may work a bit better:

w = wiggle(1,1,1);
[w[0],w[1],w[2],1]

this limits the wiggle to just the rgb values and keeps the alpha full.

changing the wiggle values as described earlier still applies.

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW

 Re: randomly changing colour of a light inside a 3d roomon Mar 14, 2012 at 5:47:08 am

Hey thanks kevin.
...I didn't realize that I could keyframe thei colour change right inside the the light settings of the 3d scene. That is working fine for me now...wll try out those expressions though thanks!
Miles