Dynamic Foam / Connecting Centroids / Generate Network / Position Based Dynamics

Hello,

I am trying to get a Dynamic Foam going and got help from a developer but we ran into some problems connecting centroids to establish a network in between the ‘foam bubbles’.

I have added extra information for why those centroids need to be connected and form a network, along with the problem (job) explained at the end.

I. Dynamic Medium
II. Fields and Boids
III. From Boids to a PBD Network
IV. From Curling Motion to Strings
V. Position Based Dynamics (PBD)
VI. The Problem (Job)

I. Dynamic Medium

The goal of my project is to create a kind on a Zero-player game, a bit like GoL, where cells fluctuate based on surrounding cells, and where the goal to generate Knots within a Dynamic Medium.

To get a sense of such a dynamic network think of a foam with bubbles where a fluid runs through the edges. These currents move from high to low pressure, forming circuits. The intensity of the fluid passing the bubbles can make the bubbles shrink or expand. Some currents will be able to line up and form closed circuits.

In 2D these structures are simple loops, in 3D these loops can form strings, and in a next step these strings form again closed-circuits -> knots.

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/foam_network_knots.jpg&key=6101fc5d332dd2bda8d59174bbf6085995fed2bb75f5d217cd57155238fc43a1



II. Fields and Boids


One way to get a model of bubbles and currents going was by using Boid-particles and Fields, which was tried in Processing. Here are short clips to show the interaction:

http://imgur.com/a/Mp0SG
https://vimeo.com/user37290268

A. In the first clip the Fields (red circles) keep their size while the small particles form a circuit.

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/Stable.png&key=63f4c5682e3f660f273f61959504c3bb20f4dac728c42eaaa9802e288d6fd4bb

B. In the second version the size of the Fields is influenced by the number of particles within: Expand <-> Shrink

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/chaos.png&key=a0cd100b6f881e8fb3490b083d366140224d49bf9ec9b81ddaf1dbfba123f8e6



III. From Boids to a PBD Network


The problem with using Boids is that they have their limitations whereby the quick expansion of Fields causes the particles to be splattered around, interrupting the steady current and are splashed around.

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/SteadyWild.png&key=522812176eb70dcc13315301a27bb70538f3087db6208af4d86eb20ed24f2888

Keeping the Boid-particles flowing is important, because a flow-circuit gives rise to organisational rules such as flows going against each other block each other, others can go along like an electronic circuit:

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/circuit_1.jpg&key=fd4432bdb8e088caece1e7ed41435895932a1c7a8d9d45e497a6101d02fdaada

To fix these problems a move to PBD was made and hoping to create a network model that replaces the small particles.

flow -> edges

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/Flow_2.png&key=a522c03662f4bc401ae441cc217eb0f42ac4d0917048e5d3530e35823b63916e

Fields changing size depending on the amount of flow through the edges:

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/Flow_1.png&key=5634d6a30c46750c5a42b1d368a8b64550ebb4a6897d20fd3afd897be615fedc

• Having two Fields A.B. and in between from point a. to b. an edge.
• This edges (a.b.) can replace all the boids moving in between (A.B.)
• Edge (a.b.) can represents 1 or 1 million small particles or more, simplification.
• Between Field A. and B. a measurement of tension •-VVVVV-• (A/B)
• The more tension between (A.B.) the less flow there can be in (a.b.)
• Inverse the more flow there is in (a.b.) the less tension between (A.B.)
• The edge (a.b.) runs through the Fields A. and B, cooling or heating up Fields A. and B.

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/Shrink2.jpg&key=63b403834d0f5e96dabfe0efbb401b14811572aa34ad25f8bfce4f646621a412



IV. From Curling Motion to Strings


The basic idea is to get the bubbles moving through the medium thanks to self-regulating currents in between:

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/bubble.jpeg&key=64b1673ea04183bb001dff3442e001df7053c677875e684df2bb621e4e74015b

Like a sliding-puzzle where the parts can move to where there is space created:

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/SlidingPuzzle.jpg&key=ad8b6b5b74657c4f6bd530e6dc6847a3e97c94548644b655d2ba579cbdb215f7

Thus bubbles shrink on one side and expand on the other, so they can move around and get a rolling-curling-motion:

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/Roll_Flow_bubbles.gif&key=c6f44d10b8ddea77e59a0c914b07ba59728e6db6f6e37edbfa17995036bdbd4f

The dynamic curing motion could also turn around and close-loop into knots:

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/Curling1.jpg&key=d209557b16b7ccd715e4ff063b2a28e573834b27806f140c35b7f2a0edae5563

In 3D the wind up curls would be like these dansers waving strings:

http://www.youtube.com/watch?v=uvE5yt83WPU (at 1:44)

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/strings.jpg&key=f68c0505196d95cda61d56cc9be28c6afd06894299f6c14e9c7adbc865a4f979

These strings can turn into knots etc. etc.



V. Position Based Dynamics (PBD)

For a look at my current situation you can check this short clip, where a small network is in place based on centroids, and the volumes fluctuate:

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/Dynamics.jpg&key=1ace20a3a4ca2212b267700c129eae3e70b9775058f9fc4abc2397844131c736

Here is are the project files on GitHub if you would like to have a closer look:

https://github.com/VirtualOrganics/PBD_DynamicFoam_Files
https://github.com/InteractiveComputerGraphics/PositionBasedDynamics (PDB code)



VI. The Problem

We took the PBD software from GitHub and modified the Demo example called ‘GenericConstraintsDemos’. All constraints are taken out except the distance constraint, and the simulation is limited to work on a 2D with the intention of extending to 3D eventually.

https://www.gamedev.net/applications/core/interface/imageproxy/imageproxy.php?img=http://www.800million.org/bullet1/circles1.jpg&key=589c403ef981ff58412c5877a22aea538aae09a1305e7db837274aea0081a68b

As you can see in the example, there are nine circles. The simulation allows for any number of circles. The green dots represent the centers of the circles; the red dots represent the centroids of the three adjacent/connected circles; the black dots represent some (outer) intersections between circles; and the blue lines connect either centroids with other centroids, or centroids to intersections in a particular pattern. In the simulation, the radii of the circles can change and, since a distance constraint is applied, the varying sizes of the circles causes the locations (and existence) of the dots and lines to change.

The code at this point is able to identify/calculate the locations of the black dots and the red dots, but he had trouble coming up with an algorithm that correctly connects the red and black dots. The diagram above shows the correct connections, but coming up with an algorithm to do this automatically and as the simulation runs stalled our progress.

So I’m now looking for a developer who can take it to the next level. It doesn’t necessarily need to be in PBD an other Physics Engine (Blender-Bullet-PBD) might do the job, one where on top of the physics-interactions a network-formula can balance out the weights and regulate the system.

All suggestions and questions are more than welcome!

Best,
m.

what about using a kdtree so each node only knows it’s neighbors?

each bubble/particle acting on it’s neighbors only adds up to the behavior of the whole?

also, should this be in paid work?

Yes, sure, before starting with PBD I got the suggestion to use ‘fast bvh’ or ‘octree’.

I just googled for the difference between ‘kdtree’ and ‘octree’, and the latter should be better for 3D so it’s preferable.

But I have no idea of how to tackle this in practice.

also, should this be in paid work?

I guess so because I am looking for someone to implement it and I have a (small) budget for compensation.

Sorry for the perhaps bizarre answer but I’ve been rather ‘creatively’ working on this concept, and had help from programmers to turn this concept into a reality and solve these ‘technicalities’.

So I can’t really comment on your suggestion of how to solve this issue, it’s a bit above my head, but if you think your solution can work and you want to give it a try, then we can come to an agreement.