Flint Particle System Forum - Bird's Eye View Snowfall Sun, 11 Dec 2011 22:50:59 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=371#Comment_371 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=371#Comment_371 Mon, 08 Sep 2008 18:40:53 +0100 Matts
Thanks,
Matt ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=375#Comment_375 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=375#Comment_375 Mon, 08 Sep 2008 19:42:24 +0100 Richard
You could get a true perspective effect by using the 3D features of version 2 of Flint.

Or you could create a custom initializer that sets the particle's velocity based on its position, so particles move in towards the center of the stage.

Finally, yes you could use a gravity well, but you may find the acceleration of the particle's doesn't look right. ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=377#Comment_377 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=377#Comment_377 Mon, 08 Sep 2008 20:31:40 +0100 Matts
I am a bit of noob, hopefully not too much so get done that which I am trying to do. I used to be proficient at c++, but it's been a while. Sorry for the noob questions.

Yes, I want to look down on the snow falling, so it is moving away from me.

I would like it to look as realistic as possible, but bare minimum, the particles move in towards the center of the stage with realistic acceleration towards the middle and degradation of size as it does so.

I would prefer using the 3D features in Flint2. Given my unfortunate noob disposition, which would route would you recommend?

Thanks!
Matt ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=382#Comment_382 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=382#Comment_382 Tue, 09 Sep 2008 01:14:26 +0100 Matts
Thank you,
Matt ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=385#Comment_385 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=385#Comment_385 Tue, 09 Sep 2008 08:32:00 +0100 Richard
The 3D camera is initially placed at the origin, pointing in the z direction. So, you can just leave it where it is. Set the snowflakes up to look like in the 2D version. Set the velocity away from the camera, e.g. (0, 0, 50). Which leaves creating and removing the particles.

Two options for creating and removing...

1. Initialize using four line zones around the scene, as you suggest. Destroy with a death zone in the shape of a box far from the camera, or set a lifetime for the particles so they die after a short period.

2. Initialize using a thin box zone (I should probably add a rectangle zone for the 3D stuff, which is what you ideally need here) near the camera, set a lifetime on the particles, and use a fade action on the particles with a two-way easing function (see the TwoWay class) so particles fade in at the beginning and out again at the end.

I prefer the latter, but haven't seen what the results look like. ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=395#Comment_395 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=395#Comment_395 Tue, 09 Sep 2008 15:31:19 +0100 Matts
I implemented your second suggestion and its working! But it bogs down pretty quick because I haven't gotten the two-way easing function to work. I was unable to find an example of the two-way easing function in the examples. Can you give me an example of the syntax?

Here's what I have so far of you have a minute to check these out:

http://public.spaeth.sent.com/Frame1.as
http://public.spaeth.sent.com/SnowfallTD.fla

All the flakes are going into the corner near origin. I tried moving the Velocity PointZone to the middle but then it gives me what looks like an extreme closeup. Maybe my BoxZone is not setup right?

Best,
Matt ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=398#Comment_398 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=398#Comment_398 Wed, 10 Sep 2008 07:26:35 +0100 Richard
You need a lifetime initializer and age action (so the snowflakes don't live indefinitely) and you pass the two-way easing function to the age action. Add a fade action so the snowflakes fade in and out. Also, place the renderer in the centre of the stage, and place the box for the position initializer further away from the camera. The result is like this.

var emitter:Emitter3D = new Emitter3D();
emitter.counter = new Steady( 50 );

emitter.addInitializer( new ImageClass( Dot, 3 ) );
emitter.addInitializer( new Position( new BoxZone ( 1366, 768, 10, new Vector3D( 0, 0, 400 ), new Vector3D( 0, 1, 0 ), new Vector3D( 0, 0, 1 ) ) ) );
emitter.addInitializer( new Velocity( new PointZone ( new Vector3D ( 0, 0, 50 ) ) ) );
emitter.addInitializer( new ScaleImageInit( 0.5, 1.5 ) );
emitter.addInitializer( new Lifetime( 10 ) );

emitter.addAction( new Move() );
emitter.addAction( new Age( TwoWay.quintic ) );
emitter.addAction( new Fade( 1, 0 ) );
emitter.addAction( new RandomDrift( 15, 15, 15 ) );

var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
renderer.addEmitter( emitter );
addChild( renderer );
renderer.x = 684;
renderer.y = 384;

emitter.start();
emitter.runAhead( 20 );
]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=399#Comment_399 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=399#Comment_399 Wed, 10 Sep 2008 15:34:15 +0100 Matts
One more question: ScaleImageInit()? I can't find what package that function is in.

Thanks,
Matt ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=402#Comment_402 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=402#Comment_402 Thu, 11 Sep 2008 21:36:01 +0100 Richard
ScaleImageInit is a renaming of ScaleInit. In the SVN repository I've already renamed it, and the renaming will be in the next download (alpha 2) - it's because there's now a ScaleAllInit too. So if you're working off the alpha 1 download rather than the svn repository, change it to ScaleInit.

I've been meaning to add a donate button but I keep getting distracted with developing the library. You've spurred me into action - there's now a donate button at the bottom of the page.

Thanks
Richard ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=1422#Comment_1422 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=1422#Comment_1422 Wed, 03 Nov 2010 09:48:06 +0000 joel
http://public.spaeth.sent.com/Frame1.as is a dead link now so I am not sure where to begin. ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=1428#Comment_1428 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=1428#Comment_1428 Fri, 05 Nov 2010 08:38:09 +0000 Richard
Since this was written, I introduced the Point3D class to Flint's 3D geometry. So now the full script would be...

import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.common.counters.Steady;
import org.flintparticles.common.initializers.ImageClass;
import org.flintparticles.common.displayObjects.Dot;
import org.flintparticles.threeD.initializers.Position;
import org.flintparticles.threeD.zones.BoxZone;
import org.flintparticles.threeD.geom.Point3D;
import org.flintparticles.threeD.geom.Vector3D;
import org.flintparticles.threeD.initializers.Velocity;
import org.flintparticles.threeD.zones.PointZone;
import org.flintparticles.common.initializers.ScaleImageInit;
import org.flintparticles.common.initializers.Lifetime;
import org.flintparticles.threeD.actions.Move;
import org.flintparticles.common.actions.Age;
import org.flintparticles.common.energyEasing.TwoWay;
import org.flintparticles.common.actions.Fade;
import org.flintparticles.threeD.actions.RandomDrift;
import org.flintparticles.threeD.renderers.DisplayObjectRenderer;

var emitter:Emitter3D = new Emitter3D();
emitter.counter = new Steady( 50 );

emitter.addInitializer( new ImageClass( Dot, 3 ) );
emitter.addInitializer( new Position( new BoxZone ( 650, 500, 10,
new Point3D( 0, 0, 400 ), new org.flintparticles.threeD.geom.Vector3D( 0, 1, 0 ),
new org.flintparticles.threeD.geom.Vector3D( 0, 0, 1 ) ) ) );
emitter.addInitializer( new Velocity( new PointZone ( new Point3D ( 0, 0, 50 ) ) ) );
emitter.addInitializer( new ScaleImageInit( 0.5, 1.5 ) );
emitter.addInitializer( new Lifetime( 10 ) );

emitter.addAction( new Move() );
emitter.addAction( new Age( TwoWay.quintic ) );
emitter.addAction( new Fade( 1, 0 ) );
emitter.addAction( new RandomDrift( 15, 15, 15 ) );

var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
renderer.addEmitter( emitter );
addChild( renderer );
renderer.x = 275;
renderer.y = 200;

emitter.start();
emitter.runAhead( 20 );


(Yes, lots of imports!) ]]>
Bird's Eye View Snowfall http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=1430#Comment_1430 http://flintparticles.org/forum/comments.php?DiscussionID=84&Focus=1430#Comment_1430 Mon, 08 Nov 2010 11:33:17 +0000 joel
that is perfect, thank you very much for your help with this. ]]>