PDA

View Full Version : [SHOWOFF] Smoke effect


petefs
06-20-2004, 11:33 AM
I extended bit-101's particle class and did some photoshop work early this morning and came up with this nifty smoke effect. I'll share the modified class and source .FLA if people are interested : )

http://ps.frontsidedesign.com/particles/smoke.html

When I get more time/energy I'll be extending the particle class further and making an emitter class ^_^

I'm curious how it runs on slower systems. it runs very quickly on this P4 2.6GHz. Any mac users wanna test it out? ^_^

pixelwit
06-20-2004, 12:34 PM
Looks real good and runs fine on my 600MHz PIII. Would be a little better if you could keep the individual clouds from drifting away from each other since it looks a little odd when only a few clouds are emitted and they all head off in different directions.

Are you using an inverse gravity? I like the fact that the smoke sort of bounces down when it hits the ceiling but it should eventually start going up again. In my opinion. ;)

Once you have it all where you like it, you might be better off putting it in this site's "Movies" section (http://www.actionscripts.org/movies-categories.php) where more people are likely to find it.

-PiXELWiT
http://www.pixelwit.com

petefs
06-20-2004, 01:11 PM
it's not gravity, it's simply a -y velocity. negative gravity doesn't really seem to simulate smoke too well, it doesn't really accelerate much unless it's forced through a smaller area if I remember fluid dynamics at all. that's a BIG if ^_^

I think to keep it simple I should apply no force against the smoke from the top boundary and have the smoke fan out across the 'ceiling' until it dies. I should also probably keep the emitter from entering the repelling circle since that does some funky things :D

it was really a quick sort of project, my company has decided to move to AS2.0 so I wanted a fun project to practice AS2.0 OOP. I'll definitely be taking it further after some sleep and this launch. Having the emitter evolve is on the list, so when the emission starts it could either send out a high volume burst or reduce the randomness(Depending on CPU impact). That should eliminate the weird look from clicking quickly. It could also emit interpolated puffs when the emitter is moved quickly...stuff like that. More to come, more to come ^_^

And when I'm done I'll be certain to put it in the movies section!

Thanks for the comments : )

pixelwit
06-20-2004, 01:24 PM
Welcome.

Another option might be to wrap each cloud in a container clip then when it hits the ceiling you could start modifying the _xscale of the container rather than its _y position. The container is necessary so you can still rotate the cloud while stretching it out.

-PiXELWiT
http://www.pixelwit.com

CyanBlue
06-20-2004, 01:41 PM
WoW... Very nice... :)

Runs fine on my AMD 700... As a matter of fact, I want to see it abit slower than it is now because it looks like the velocity is way too high in my eyes...

I thought that the circular thing is the moon or something... I didn't know if it were to bounce the smoke...

Just out of curiosity... The each piece of smoke rotate as it goes up??? To me, they all look like they are rotating counter clockwise... If it is, maybe you need to make some go to clockwise and so on??? ;)

petefs
06-20-2004, 07:03 PM
pixel: My idea is more to form a good reusable particle system for a variety of effects. I could make make some subclasses that handle special sort of effects like that, though ^_^ I was actually planning on making a particle type that spawns another (ephemeral) emitter when it strikes a surface...to better simulate things like sparks, waterfalls, etc... Good idea : )

cyan: I did that after an all-night work binge and I <thought> I had them going in both direction but apparently I didn't :D I thought I used Math.Random()*10-20 but apparently I didn't ^^ I probably did something dumb like Math.Random()*10-10 because it just looked right at the time. I'll try slowing it down after I conform all the properties to less arbitrary units : )

CyanBlue
06-20-2004, 07:44 PM
Hehe... I have no idea what you have done in there, but I'd love to take a peek at it when you are done... Of course, there are pretty limited amount I can actually understand in there but why not... ;) The only problem would be that the file will be written in AS 2.0 and I am not there yet... Oh, some day... I'll keep this one bookmarked for that day... :)

I think you probably have had your peek at this one, but if you have not, check this cool particle system as well...
http://www.horsefish.net/ElementalFX/

petefs
06-20-2004, 08:49 PM
of course you can take a peek : ) It's really nothing particularly crazy, I was just very pleased with the result:effort ratio!

I have seen that ElementalFX thing. I'm just too much of a learn it myself and opensource kinda guy, so when I saw 'Buy elementalFX' I just skipped over it :b

CyanBlue
06-20-2004, 09:07 PM
Hehe... Ryan is not really the bad guy here... He's got to pay for his bill... That's all... ;)

At any rate, I think your version is really smooth and slick... (I am not trying to compare two here...) I am sure lots of people can use what you have... But I don't really want to see 100 webpages that I visit contain a man smoking cigar or rascals making small fire here and there... :D

petefs
06-20-2004, 10:14 PM
hahahahahaha, yes ... we hardly need that much fire & smoke on the web :b and I'm not criticizing Ryan -- just saying that that's not really what I'm about : ) His system is obviously very full featured, I'm just tryin to learn for myself ^^

CyanBlue
06-20-2004, 10:43 PM
Let me just put it this way... You've got good potential to generate something that could be a huge impact to lots of Flashers... :)

pixelwit
06-20-2004, 11:23 PM
Maybe I'm missing the point but I went to that site and it seems as if I've been making "particle systems" for quite a while, I just wasn't clever enough to give it a catchy name. ;)

Snow (http://www.pixelwit.com/temp/Snow_06.html)
Sparks (http://www.pixelwit.com/temp/Spark_01.html)
Orbit (http://www.pixelwit.com/temp/Orbit_05.html)
FishGun (http://www.pixelwit.com/temp/FishGun_01.html)

I guess all you need is one or more items on stage that mimic some aspect of Physics and you got yourself a particle.

Do nodes count as particles? If so you might want to read Bit-101's tutorial about them in the Tutorials (http://www.bit-101.com/tutorials/) section of his site.

I'm all for classes and stuff but I almost always seem to need some feature which isn't included so I'm almost always forced to customize the code to make it work the way I want or even more commonly; write a custom function. Trying to incorporate any feature which I might need later usually ends up making bloatware especially since every "feature" you add to a particle class has great potential to slow things down due to the sheer volume of the particles. Just something to keep in mind.

I'm done being the grumpy old man for now. Cary on. :D

-PiXELWiT
http://www.pixelwit.com

petefs
06-21-2004, 01:30 AM
I'll preface by saying again that I'm doing this for the sake of learning more than anything : ) It already uses Bit-101's particle class as the foundation :b

Anyway, if you properly organize the class you can eliminate overhead by subclassing features not always used. The whole idea is reusable code -- custom is great until you have too much work in the pipeline and not enough man hours (and not enough money ; ) ). And... to sleep with me ^_^

pixelwit
06-21-2004, 01:49 AM
I understand it's all part of a learning experience.

Is Bit-101's particle the same as a node? I thought they might be different and that the node class would allow you to better cluster your smoke clouds or allow more interactivity among particles.

I probably don't do a high enough volume of work requiring similar (reusable) code to criticize and should probably read Colin Moock's new AS2 book before saying much more. But.. I just have to say I'm against some of the fundamental concepts in AS2.

Okay, I feel better. Now I'll go back to being the quiet grumpy old man. ;)

-PiXELWiT
http://www.pixelwit.com

farafiro
06-21-2004, 05:12 AM
petefs
wow, this is realy cool and a very good piece

petefs
06-21-2004, 03:26 PM
as far as the english language goes, a particle (among other definitions) is the smallest discrete piece of something. Since I come from a visual effects background I'm used to using 'particle systems' in many of the applications I used to deal with ^_^ So that's the word that first comes to mind.

As far as coding with specific reference to Bit-101's work... his particle class doesn't have any implied communication between particles. Most high end animation tools that aren't intended for realtime rendering allow for particles to interact for higher amounts of realism. Even then, to reduce render times, you often only use collision.

In essence, though, a node is a particle that communicates. At least when we reffer to Bit-101's code : ) I would love to include subclassed particles that incorporate communication -- as you say, the more bells & whistles you add the more processing overhead there is ^^ In high volume realtime particle systems communication becomes rather taxing -- but low volume particles that communicate might yield better visual results in the end. I'll be sure to play with that concept, thanks for the great link pix!

Plus I'll say it again for the first time: the fishgun rocks hard :>

and to farafiro: Thanks!

pixelwit
06-21-2004, 03:39 PM
:D

-PiXELWiT
http://www.pixelwit.com