Jump to content
  • Advertisement
Sign in to follow this  
nardove

How to use a heightmap for particle motion?

This topic is 3151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, basically like the title say I am looking reference material to understand how to use a heightmap for particle motion in 2D. So I can draw a noise background, throw a bunch of particles, and the particles will move to the white areas, so as the noise background change the particles will move accordingly. Any reference material, links tutorials, will be much appreciated Cheers rS

Share this post


Link to post
Share on other sites
Advertisement
Just move the particle to the brightest neighbor of its current pixel...

Or are you looking for something different?

Share this post


Link to post
Share on other sites
Hi, basically I need to work out the following algorithm.

// INI

1->Generate Perlin in black and white

2->Generate text, place in center

3->Imagine the whiteness to be a height value. Darker == lower, ligher == higher.

4->Convert the bitmap into a slope / normal map. Follow this process :
1.Convolution with a 3x3 kernel, y-1 and y+1 as 1,div by 2 bias 127, copy to red channel
2.Convolution with a 3x3 kernel x-1 and x+1 as 1, div by 2, bias 127, copy to blue channel

Now red and blue are converted into slope values for every pixel. Use this slope value to accelerate or decelerate your particles.

Use a linked list with small datatypes for your particles. Read out from the slope map to move them, add some elastics...et voila.

A position on your normal / slope map has a color. This color encodes x in red and y in green. If you read the green value, you divide it's value by 128 and -1 one that value.

That will give you a value between -1 and +1. Depending on the speed you want to add to the particles, you multiply that value and add it to the velocity of the particle. Same goes for the red channel.

// END

Now 1, 2, and 3 are dead easy, but I am having problems working out how to build step 4, any advice will be great

Thanks
rS

[Edited by - nardove on March 2, 2010 10:51:37 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!