We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › converting pixel data into movement
Page Index Toggle Pages: 1
converting pixel data into movement (Read 828 times)
converting pixel data into movement
Feb 16th, 2010, 2:31am
 
hi, im going  to make a tool that allow to convert bitmaps into motion, i want that my pixel data defines the movement of a grapic element. So my quesiton is do anybody have tried something like this before ? are there some approaches for convert pixels into movement?  or something to begin?
Any idea would be nice


thanks


Pun
Re: converting pixel data into movement
Reply #1 - Feb 16th, 2010, 6:26am
 
A possible idea is to make a height field out of a bitmap: convert the image to levels of gray, then levels of gray to height. Then throw a ball on that and see if climbing down the slopes...
Or define the gray levels to positive or negative magnetic forces, so an object with an initial speed would be pulled or pushed during its travel.
Re: converting pixel data into movement
Reply #2 - Feb 16th, 2010, 9:02am
 
Yes its been done before, I have seen it but I havent try it myself. I am very interested in doing something like that, so I ask and this is what they said

Quote:
The process is as following.

1->Generate Perlin in black and white

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

3->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.


Like I said I havent try it, because I still dont understand how to make the particles move to the white areas using the convolution technique, any ideas how can be done?

I will be more than happy to help and share more ideas.

Cheers
rS
Re: converting pixel data into movement
Reply #3 - Feb 23rd, 2010, 12:48am
 
Hi, I am still looking in to how to do this, any ideas? Pun did you get it working?

Cheers
rS
Page Index Toggle Pages: 1