Flint Particle System Forum - Images in PixelRenderer? 2011-12-13T10:34:50+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=126#Comment_126 2008-05-08T22:29:47+01:00 2008-05-20T10:14:57+01:00 ericr http://flintparticles.org/forum/account.php?u=17 I came up with a crude way to convert BitmapData based images into pixels for the PixelRenderer to play with. This is all done with a new Initializer and some carefully considered settings. This ...
SharedBitmapData:package org.flintparticles.initializers
{
import flash.display.BitmapData;

import org.flintparticles.emitters.Emitter;
import org.flintparticles.particles.Particle;

public class SharedBitmapData extends Initializer
{
private var _bitmapData:BitmapData;
private var curX:uint = 0;
private var curY:uint = 0;

public function SharedBitmapData( bmd:BitmapData )
{
_bitmapData = bmd;
}

override public function initialize( emitter:Emitter, particle:Particle ):void
{
particle.x += curX;
particle.y += curY;

particle.color = _bitmapData.getPixel32(curX, curY);

// Update curX and curY.
if (curX >= _bitmapData.width - 1)
{
if (curY >= _bitmapData.height - 1)
{
curX, curY = 0;
}
else
{
curX = 0;
++curY;
}
}
else
{
curX++;
}
}
}
}

Example Implementation Snippet:var renderer:PixelRenderer = new PixelRenderer(new Rectangle(0, 0, 100, 100));
renderer.addFilter(new BlurFilter(4, 4, 1));
addChild(renderer);

var bmd:BitmapData = someBitmapDataObjectWotWasLoadedElsewhere;
emitter = new Emitter();
emitter.counter = new Blast(bmd.width * bmd.height);

emitter.addInitializer(new Position(new PointZone(new Point(renderer.width/2 - bmd.width/2, renderer.height/2 - bmd.height/2))));
emitter.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 30, 30)));
emitter.addInitializer(new Lifetime(1, 1.5));
emitter.addInitializer(new SharedBitmapData(bmd));

emitter.addAction(new Move());
emitter.addAction(new Age());
emitter.addAction(new DeathZone(new DiscZone(new Point(0, 0), 50, 50)));
emitter.renderer = renderer;
emitter.start();

Of specific import is the line involving the counter. You are essentially adding the number of pixels located in the image to the emitter (one particle per pixel). This is calculated simply by Width times Height. Cake.

The above effect will explode your loaded image into pixel-particles. They will blur and fade as they go. The entire effect lasts around 1.5 seconds.

Thoughts? Anyone have any ideas on how to better implement this kind of thing?]]>
Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=129#Comment_129 2008-05-10T15:59:34+01:00 2011-12-13T10:34:50+00:00 Richard http://flintparticles.org/forum/account.php?u=1 It seems this is an idea who's moment has arrived. I've had an email from another Flint developer about some similar ideas. Nice work. Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=130#Comment_130 2008-05-12T18:12:42+01:00 2011-12-13T10:34:50+00:00 ericr http://flintparticles.org/forum/account.php?u=17 Just came across this. How about creating an emitter that can handle that kind of thing ;) They apparently use a class called Particle3D. Are you working on something similar for the 3D-capable ... this. How about creating an emitter that can handle that kind of thing ;)

They apparently use a class called Particle3D. Are you working on something similar for the 3D-capable version of Flint or is it more making the particle effects renderable (put the renderers on texture/normal maps, etc)?

Also, did the other developer provide any test implementation code? I'd like to compare notes if so ;D]]>
Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=131#Comment_131 2008-05-12T23:11:48+01:00 2011-12-13T10:34:50+00:00 Richard http://flintparticles.org/forum/account.php?u=1 That's pretty. The plan for 3d is a full 3d space for the particle system, with particles rendered on billboards or as 3d objects, with stand-alone renderers plus renderers for Papervision3D and ...
The plan for 3d is a full 3d space for the particle system, with particles rendered on billboards or as 3d objects, with stand-alone renderers plus renderers for Papervision3D and Sandy in the library and a renderer interface that enables the creation of renderers for other 3d systems too. It may take awhile to get there but I believe it is a good plan and I hope to have something very rough to show by the end of this month - time permitting.

P.S. The other developer hasn't sent me any code yet. He was working on a more general system of zones and renderers that included initialising particles based on the properties of an image. I'm hoping he will send me some code or better still share it on this forum.]]>
Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=1198#Comment_1198 2010-05-12T12:30:32+01:00 2011-12-13T10:34:50+00:00 jmp909 http://flintparticles.org/forum/account.php?u=365 could anyone convert this to the new 2D API? I don't really understand it enough to extend the Initializers thanks j
thanks
j]]>
Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=1211#Comment_1211 2010-05-19T07:49:01+01:00 2011-12-13T10:34:50+00:00 Richard http://flintparticles.org/forum/account.php?u=1 There's now a utility method for creating pixel particles from bitmap data - Particle2DUtils.createPixelParticlesFromBirmapData(). Particle2DUtils.createPixelParticlesFromBirmapData().]]>