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 & HelpOther Libraries › Tweaking & expanding the Fluid Demo code...
Page Index Toggle Pages: 1
Tweaking & expanding the Fluid Demo code... (Read 778 times)
Tweaking & expanding the Fluid Demo code...
Sep 28th, 2007, 10:57pm
 
Hi, I've been working with one of the Fluid Demo sketches that comes with Processing -- cleaning and speeding it up a bit as well as trying to add some additional functionality, such as boundary interaction within the vector field.

I haven't started the boundary interaction yet, but this version is pretty fun to play with so I'm posting a link to the applet:

http://www.tinrocket.com/projects/programming/processing/00251/

I'm interested in working with someone on this fluid code so that it could be ultimately released as tiny library containing a Fluid class. I don't wish to create 100% accurate, physically-correct simulation code, but rather something that looks empirically correct and runs quickly and is easily adaptable. I see the following functionality to be added to make the code useful as a library:

*Meaningful parameter's assigned to control the fluid behavior

*Collision response of shapes within the vector field.

*Collision with fluid particles and a boundaries

*Particle density diffusion (diffusion of dense particle concentrations)

*Possible replacement of floating point maths with of fixed or integer maths, where accuracy can be cheated.

For collision between the vector field and boundaries/shapes, I plan on using a 1-bit image as a edge/boundary source. This image would then be run through an X & Y Sobel filter to produce a image map containing the normals for the edges of the image. If I recall the vision research, the Sobel filter is reasonably accurate for calculating these angles, and plenty accurate enough for this project. This filter process should be fast enough to occur in realtime, so that the boundary source image could be dynamic (shapes and fluid both moving).

This normal map would then be used to deflect the vector field when it intersects with boundary mask. Since the vector field and the boundary masks are at different resolutions, a multi-resolution fluid field might be necessary or perhaps just an elegant hack.

I can code everything but the physics simulation stuff, so collaborative help with that code would be appreciated -- don't be shy!
Page Index Toggle Pages: 1