;

PDA

Click to See Complete Forum and Search --> : blurry particle trails


mlecho
04-16-2009, 07:15 PM
i am creating a very simple particle system. My only issue is trying to create a blurry trail effect on the particles in motion. I started by creating a large bitmap container, and applying a colormatrix filter and a blur filter . It seems to do the trick , but the issue now, is i have to make this container cover the stage, which has a two unwanted a effects:
-it's slower
-it covers all the content beneath. Perhaps my approach to creating trails is wrong?

i can post the whole class, but before i litter this post with long lines of code, is there a way to place a bitmapdata drawing over content and still get the desired effect. NOTE, if make transparency false in the bmdata, i loose the effect

Phix
04-17-2009, 02:43 AM
there's really no way around the slowness. that's a very heavy process. maybe importing sprites (image files) that are already blurry?

try changing the blend mode on the holder clip.

diuck
04-17-2009, 07:48 AM
I didn't catch the "cover" issue, maybe a picture or some code will be more clear...

Anyway, the solution with the slowness is often to precalculate bitmaps as Phix said : ie to cache all states of you particle in an asset and load it to a BitmapData.
Also, you can do it dynamically by code : I m working with Shapes drawing API and filters too for my sprites, for each state, I draw the Shape, apply the filters, etc. and use the BitmapData.draw(myShape) to "convert" it to BitmapData.
As I prefer to work with one BitmapData for all the states I memorize position of each sprite within the BitmapData with a Rectangle. At the end of the precalculating process, I end up with one Array of Rectangle and one BitmapData. Maintaining an index, I loop through the Array and use copyPixels accordingly to animate my sprite.

Btw, try first to use powers of 2 on your blurX/blurY and don't exceed 8 to see if it speeds things up.
And also, it s better to deal with little Bitmaps (each with one paticle) than one big Bitmap, you accelerate things by copying less transparent pixels.

Hope that s clear... if not, I ll post an example.