|
-
[Flash8] particles using bitmaps
in my eyes, the best parts of flash8 are the bitmapdata and filter methods.
now we are able to use well-known technics that come from opengl for example in flash.
i wanted to do some fire effect in flash.
a year ago i developed a simple particle system in flash7. this gave me the idea of what is possible using particles. but of course they are to slow to be implemented in a game.
http://www.je2050.de/fla.php?file=ParticleTest
now i wanted to do some fire effect in flash8.
the first thing that came to my mind was doing this using pixel access.
here is an example of an old-school fire effect. it is of course very slow so it is only 50x50 px and looks not very good
http://www.je2050.de/showroom.php?file=fire
(mouseclick changes blendmode)
then, there was a post on tinics blog. he also did a nice fire effect using flash8 filters
http://www.kaourantin.net/2005/08/li...ect-using.html
but because i really like particles i started with an idea that comes from opengl/directx whatever.
- load a greyscale bitmap
- colorize it
- draw it
a simple example with ugly textures and ugly code is
http://www.je2050.de/showroom.php?file=bitmapfire
and here some eyecandy and also to show the speed of this technic.
100 particles, changing color at runtime(!!)
http://www.je2050.de/showroom.php?file=bitmapparticles
i think they are now fast enough to be used in games for some eyecandy :o)
source:
http://www.je2050.de/stuff.php?p=/source/effect/
(fire.as is the pixel-fire and particle.as is used in the two other examples)
btw. two things i discovered about speed:
- it is faster to use _alpha insted of using a matrix
- it is faster to apply a filter to a movieclip instead of a bitmap
Last edited by joa__; 09-15-2005 at 08:27 AM.
-
Yes we can
i already told you mate,but no probs saying it here again, sweet stuff, looks and works delicious, keep it comin
-
Senior Member
Thanks joa, it seems very nice but most of the links doesn't work now. I have a "error" displayed on the last pages.
-
Senior Member
I couldnt view th elast two pages. Got "error".
Also, is anyone else getting the Flash player installation prompt when they try and view this one?: http://www.kaourantin.net/2005/08/li...ect-using.html
I already have 8,0,24,0 installed. Yet EVERY time I get the prompt on that page!
-
-= phil =-
It is fast enough to do games... if you are careful.
I made an engine using some pretty sick Bitmapdata usages and filters.. HOWEVER, while I would LOVE to show you guys how kick ass it is... specially since it runs at 800x600 at constant 30 fps i can't...
Now, as it turns out, what I need to do is too much for flash, but it's definitly possible to make use of the BitmapData stuff for a crazy particle engine.
Once I can, I will show what I mean,
peace out mans.
-
M.D.
i'd love to know more about particle engines with bitmapData, what i'm most interested in is dealing with multiple particles without each having an onEnterFrame, thats what slows it down the most, if i create particles with no graphics but still update positions according to different velocitys, the engine will still run slow, graphics are only a small part of the problem, its controlling the particles which is the tricky part.
I think i heard someone metion that they used a transform matrix to control all the particles? doesn't make sense to me anyone got any idas
-
Yes we can
well,the transform matrix is just used for applying transformations on the particles in this case. Like changing positions,scale etc. To update the whole thing you´ll still need to use enterFrame or intervals. You shouldn´t have one interval per particle object though but rather have the particles registered somewhere or just in an array and then iterate through that each frame refresh.
-
M.D.
yeah i'm just about to do a few tests on handiling alot of movieclips, i know that for in loops don't work, so i'll figure something out
-
Yes we can
nay,screw lots of mcs,you´d end up with way worse performance than if drawing the particles into a bmp
-
M.D.
hang on, so i should create a loop which goes through an array and draw the particles onto a bitmap the size of my movie, so does that mean after every draw i should fill that bitmap with transparent pixels? never thought of doing it like that, hmmmm
-
most of the links seem to be broken ?
-
-= phil =-
hang on, so i should create a loop which goes through an array and draw the particles onto a bitmap the size of my movie, so does that mean after every draw i should fill that bitmap with transparent pixels? never thought of doing it like that, hmmmm
Exactly.. that will give you the best performance.
As I said, I know 
Have proof.
The least amount of MC's the better, for the most part.
You particles should all be updated into 1 BitmapData and all updated in 1 loop.
Oh yeah, to clear the screen with transparent pixels, use the ColorTransform.. that messed me up for a long time. but ColorTransfrom, with an alpha multiplier of 0 will get you what you want.
-
M.D.
 Originally Posted by d3s_inc
Exactly.. that will give you the best performance.
As I said, I know 
Have proof.
The least amount of MC's the better, for the most part.
You particles should all be updated into 1 BitmapData and all updated in 1 loop.
Oh yeah, to clear the screen with transparent pixels, use the ColorTransform.. that messed me up for a long time. but ColorTransfrom, with an alpha multiplier of 0 will get you what you want.
found a better solution, tried your way but the fact is that i have much more going on than one bitmap being drawn to and filling it in 650x650 every frame with a colorTransform or fillRect plus other things goes really slow. There's alot to think about, cloning a bitmap, keeping references of bmp's, objects and such.
Now i use movieclips to hold the bitmaps and drawing which doesn't require a whole refresh of a 650x650 bitmap. Thanks anyway
-
Heli Attack!
 Originally Posted by mr_malee
Now i use movieclips to hold the bitmaps and drawing which doesn't require a whole refresh of a 650x650 bitmap. Thanks anyway
Sounds familiar =D
Using a huge bitmap is the worst way I can think, mainly because you need to implement dirty rects, or clean it up before you redraw. Also a large bitmap inhibits your ability to scroll.
-
M.D.
*cough* thanks iopred, its weird tomsamson and ds3Inc both say that it'd be faster without movieclips, i'd like to see an example of this, i can understand if the bmp your drawing to and erasing is like 200x200 but not 650x650
thansk again iopred (bloddy functions within movieclips, never again)
-
Heli Attack!
Tomsamson is smoking something, he's on too tight a deadline =D
But yeh, I can't see blitting 1000 bitmaps onto a static bitmap being faster than having flash handle it with attached movies. Flash's BitmapData functions are handy, but the cacheAsBitmap is the main gain, everything else runs slow (setPixel anyone?).
ps. The beauty of running all your code from one frame means you don't see weird bugs like that, I think you may have found one, it sounds weird.
-
ism
did you guys see this post over in the maths section regarding the v9 player;
http://board.flashkit.com/board/showthread.php?t=689481
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
Heli Attack!
Yup, makes me upset that I coded so much of my new engine in AS2, such wasted time.
But F9 is only speeding up code execution as far as I have heard, graphics wont see the speed increase that they did from 7 -> 8.
-
M.D.
yeah just downloaded the new player, works better in a browser than my desktop but yeah the gfx still slows it down a tad
-
Hype over content...
"But yeh, I can't see blitting 1000 bitmaps onto a static bitmap being faster than having flash handle it with attached movies"
Hmmmm I wish I didn't have more work than God atm, 'cause I wanna try this particle thing out.
I'm still interested to see if blitting rather than usings mc's will give the speed increase we want. I've got a feeling it may in some circumstances.
Squize.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|