curl noise for particles

Almost every particle system needs some kind of noise added to the movement of particles.

Usual you just alter the velocity (add some weak force) to every particles every frame like this:

particle[i].force.x+=random(-0.1,0.1);
particle[i].force.y+=random(-0.1,0.1);

If you need a wild random wobble of particles without clustering and flows this is the way to go. But I want to act particles like driven from a fluid, with smoorh movement and clustering.

Recorded demo movie:

What you need is a 3d perlin noise class. I do not want to describe perlin noise here, as there is a lot of stuff the then net like (perlin noise).

Basic implementation of curl noise:

particle[i].force.x+=perlin(particle[i].x*scale, particle[i].y*scale,1.352+time);
particle[i].force.x+=perlin(particle[i].x*scale, particle[i].y*scale,12.814+time);

What happens is, we pick out a perlin noise (-1.0,1.0) from particle position with some scaling to give us a smooth transition. Note that for x and y I used a different z coordinate orherwise x and y would be the same. At last you add a time to alter the noise field over time.

– syphobia

Advertisements

~ by syphobia on 2011-04-12.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s