PDA

View Full Version : particle emitter expression


jstanislawski
10-25-2009, 04:28 PM
hi,
i know very little about scripting and need a little help and have been trying to learn more but i am stuck on something that seems like it should be pretty simple. i just want to be able to emit a number of particles every 5-10 frames or so to give a looping effect of smoke puffing out of a chimney. i could keyframe it but i think it would be possible and easier to script it, i'm just not sure how. so i was wondering if anyone might be able to help me out. thanks a lot.

jeff

bendingiscool
10-26-2009, 01:04 AM
For something that simple, just keyframe the emitter going on aand off once, then in the graph editor select the animation keys and set the keys to post cycle>infinity from one of the drop down menus.

Chris

jstanislawski
10-26-2009, 01:15 AM
that's is perfect. that's just what i needed. i knew it was something simple like that. thanks a lot man.

TheRispo
10-26-2009, 02:43 AM
Yep... for an effect like that, keyframing the emitter is the way to go..

Also, remember that expressions get evaluated every frame, for something simple like this you would probably wont even notice anything, but the more expressions used and the more complexe these get.. the more slower your sim would be.

if you want to use expressions anyway, try this:
if (frame %10)
emitter1.rate = 0;
else
emitter1.rate =100;

That would set the emitter rate to 100 every 10th frame.. while on the other frames the rate is 0... hope that helps

efecto
10-26-2009, 03:10 AM
Using Risco's expression, you can add some randomisation to it.


int $randRate = rand(50,100);
if (frame %10)
emitter1.rate = 0;
else
emitter1.rate = $randRate;




if you want to use expressions anyway, try this:
if (frame %10)
emitter1.rate = 0;
else
emitter1.rate =100;

That would set the emitter rate to 100 every 10th frame.. while on the other frames the rate is 0... hope that helps

apoc519
10-26-2009, 07:14 AM
if you want a more natural emission. Maybe try noise

emitter.rate = (noise(time * 2) + 1) * 50;

change the 2 to speed up or slow down the rate change
the 50 is just a multiplier on the total rate

Aikiman
10-26-2009, 07:49 AM
or even


float $rate = 10;
emitter.rate = abs((sin(time*2))*$rate);

Wick3dParticle
10-26-2009, 08:08 PM
if you want a more natural emission. Maybe try noise

emitter.rate = (noise(time * 2) + 1) * 50;

change the 2 to speed up or slow down the rate change
the 50 is just a multiplier on the total rate

instead of offsetting with the "+1", you can use abs() which will return the absolute value.

emitter.rate = abs(noise(time * 2)) * 50;



~Ilan

stooch
10-26-2009, 10:09 PM
instead of offsetting with the "+1", you can use abs() which will return the absolute value.

emitter.rate = abs(noise(time * 2)) * 50;



~Ilan

you dont always want to use abs on sin or noise because it will break the tangents. open up graph editor and enable view/show results to see the actual curve that is generated.

Wick3dParticle
10-26-2009, 10:50 PM
you dont always want to use abs on sin or noise because it will break the tangents. open up graph editor and enable view/show results to see the actual curve that is generated.

No doubt, that you don't want to use it all the time. But we are discussing smoke emission from a chimney. If I were animating an object's position using noise, I would consider the sharp tangents; but that isn't quite the case here.

~Ilan

Aikiman
10-26-2009, 11:02 PM
you dont always want to use abs on sin or noise because it will break the tangents. open up graph editor and enable view/show results to see the actual curve that is generated.

Thats handy to know.

stooch
10-27-2009, 07:17 PM
No doubt, that you don't want to use it all the time. But we are discussing smoke emission from a chimney. If I were animating an object's position using noise, I would consider the sharp tangents; but that isn't quite the case here.

~Ilan

I dont care what you use it for, just posting a tip that might be useful for someone if they were not aware of the effects on tangents.

Wick3dParticle
10-27-2009, 07:45 PM
I dont care what you use it for, just posting a tip that might be useful for someone if they were not aware of the effects on tangents.

awesome, thank you.

CGTalk Moderation
10-27-2009, 07:45 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.