Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 20-01-2013 , 08:13 AM
Subscriber
Join Date: Aug 2005
Location: Austin, TX
Posts: 496

flickering lights

so im trying to emulate a firelight flicker using MEL but i have no real scripting experience. I looked up a few codes but they kept giving me errors. are there any MEL guru's that can help me out with a script of some kind that i can apply to multiple lights and will perpetuate throughout my animation? please and thank you user added image

never mind me and a buddy figured it out user added image


Last edited by MamoruK; 20-01-2013 at 09:10 AM.
# 2 20-01-2013 , 08:38 PM
ColdWave's Avatar
Registered User
Join Date: Sep 2006
Location: Bulgaria, Vidin
Posts: 1,310
Can you post it ?
Thx.

# 3 20-01-2013 , 11:39 PM
Subscriber
Join Date: Aug 2005
Location: Austin, TX
Posts: 496
$time = `currentTime -q`;

pointLightShape1.intensity = rand(#,#)* $time/$time;

go to the light intensity> right click > create new expression> paste into bottom field> click create.

when using this obviously you need to change the light type, and replace # with whatever you intensity values are going to be.

# 4 03-02-2013 , 04:57 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Just for the sake of posting something here in years I though I'd present another way of doing this. This gives you a little bit of control over the flickering. The $fFreq controls the speed of the flickering. $fMinIntensity is the threshold value the noise function has to exceed in order to turn the light on at all. $fMaxIntenxity does what it says on the tin. Another plus side is that you'll get always the same results.

Code:
float $fFreq = 15.0;
float $fMinIntensity = 0.5;
float $fMaxIntenxity = 1.0;

float $fIntensity = $fMaxIntenxity * .5 * (1 + noise(time * $fFreq));
if($fIntensity > $fMinIntensity)
	pointLightShape1.intensity = $fIntensity;
else
	pointLightShape1.intensity = 0.0;


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 5 03-02-2013 , 05:03 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988

$time = `currentTime -q`;

pointLightShape1.intensity = rand(#,#)* $time/$time;

go to the light intensity> right click > create new expression> paste into bottom field> click create.

when using this obviously you need to change the light type, and replace # with whatever you intensity values are going to be.

The problem is that rand is evaluated per-frame, so it will of course create a flickering effect. As Kari has shown above, using the noise function will create a much smoother transition in-between frames.


Imagination is more important than knowledge.
# 6 03-02-2013 , 07:28 PM
ieoie's Avatar
Registered User
Join Date: Aug 2007
Location: The Netherlands
Posts: 88
super mans are always available on simply maya.....

thx guys......
was looking for something like this......

lets see if this with some tinkering suits my needs aswell......

thank you......


*
The Universe is larger then you ever can think, But smaller then the size of your imagination.

all are welcome at www.ieoie.nl
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads