Meta balls shader

I tried to add at the end of setup:

   physics.gravity(Gravity)

but this slows down the fps by x5! And it doesnt seem to work. Any idea of what is wrong?

That’s weird…you have to set physics.gravity(Gravity) in the draw() function, because it is updated each frame :wink:
I’m getting the same FPS value…it might not change anything…

@juaxix i’ve put it in the draw loop and now direction is ok when i tilt the ipad (of course, silly me!) and the FPS is ok too. => works fine, you are correct.

Very nice. I didn’t get time to look back at this, but I think the 2 pass method is much better for real world applications, especially as then you can just worry about coloring once in the final pass. The whole get the graphics processor to do it visually rather than mathematically is sooo nice.

Pity that won’t work for 3d metaballs :wink:

Dont be bad @spacemonkey :smiley:
You are right, we need another 3d metaball shader…i am studying a new way of doing this in 3D. And to improve the method I’m using with physics…

This could be interesting to implement with mesh API:
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch07.html

but the real thing would be to code a Runge Kutta 4 (RK2+RK2):
http://www.niksula.hut.fi/~hkankaan/Homepages/metaballs.html

I’m mixing some terrain generation over a sphere with 3d…
from this:
https://pbs.twimg.com/media/BSsGJUyCEAEE9JY.jpg:large
,to this:
https://pbs.twimg.com/media/BSsGPW5CcAI-Xnb.jpg:large

but if I use normals ( http://www.blackpawn.com/texts/metanormals/ ) it does not work…I would like to mix with metaballs so you can have terrains and 3d water mixed.

Ah, I have found the @SkyTheCoder method in this forum:
https://love2d.org/forums/viewtopic.php?f=5&t=9061
so, no copyright for him as it is copied :wink:
hehe

Ah! Runge-Kutta 4th order is music to my ears… :-B

@juaxix, I’m glad you are moving in the direction I’d like to be going myself too: towards simulation of real physical phenomena, like fluids flow, with games’ physics engines… 8-> pero me subí tarde al tren (I don’t know how to translate this) :((

I look forward to seeing where you get to. Good luck!