Modelling foam - calling all ace coders

Blitz3D Forums/Blitz3D Programming/Modelling foam - calling all ace coders

MadJack(Posted 2006) [#1]
Hi all

Playing with the idea of foam - how it moves/expands/sticks to stuff. Would like to model it in my game, but also think it would be a great addition to the code library.

Spent some time last night using spheres with collision radi - but for the number of spheres needed, it's just too slow.

The other idea that comes to mind is to use a heavily subdivided mesh that conforms/covers the area where the foam will be contained. The foam 'balls' use the vertices of the mesh as 'waypoints'- with code that 'flows' the balls between the vertices.

Haven't come up with an idea for the 'flow' code though?

Any ideas?


Physt(Posted 2006) [#2]
google metaballs


MadJack(Posted 2006) [#3]
Perhaps another way would be to set up a static sphere at each 'node' and just scale the sphere according to the 'foam density value' that node holds...


Vorderman(Posted 2006) [#4]
You could try a spring-and-mass physics system, with a single surface particle effect for the visuals, where each particle would be a scaled sphere.

I posted code for a spring-type rigid body system ages ago, here -
http://www.blitzbasic.com/codearcs/codearcs.php?code=387

it produces wobbly and soft shapes so should look good for foam.


Rroff(Posted 2006) [#5]
Fluid dynamics :D I believe someone posted a novadex/ODE wrapper but this is a commercial product and needs the Ageia PPU for best results... I think your best bet would be something along the lines of metaballs.


Kalisme(Posted 2006) [#6]
I heard the use of the metaball is owned by (god knows... lol... I'm not sure)... but if you attempt it and get it working they can sue you... which sounds sooooo odd since it could probably be done a few differant ways..
Oh well... that's just what I read...
I hope it's just a stupid lie someone made up for the fun of it
<_<

>_>


Damien Sturdy(Posted 2006) [#7]
No lie, There is a patent on the method of "crawling vertices" i think they called it.
Fraid I don't have a link to remind myself.


Stevie G(Posted 2006) [#8]
Yeah, there is a patent on the "marching cubes" algorithm. If you google that you'll get confirmation.

Stevie


Damien Sturdy(Posted 2006) [#9]
"crawling vertices";
"Marching Cubes"

Lol, well, I was along the right LINES, get it? :D

The above also explains why my google found naff all :)


MadJack(Posted 2006) [#10]
Thanks for the suggestions all.


Steven Noyce(Posted 2006) [#11]
So, can you still use metaballs in a game if you just use a different method than the marching cubes algorithm?