I would love to hear some feedback. I have many ideas to further improve the look and feel but one can really waste time at these things… So I am interested in what bothers you most with them ^^. Mostly you should concentrate on the deformation, since verything else is not really visible in this video quality anyway or just a question of surface shader… [Moved Thread because I think it fits better in here]
Today I was looking at metaballs, a feature that I urgently need for my upcoming FPS game :). All existing approaches I know about are either incompatible with Unity or just far too slow. If anyone is interested I can also upload a sample project… I would be glad if someone is willing to play around with them too (but since making a project out of them consumes some time, I want to have requests first ^^). I have seen enough so far, and will now move on to other tasks and get back to metaballs in some weeks ;)…
The (crappy) video:
What you see there are fake metaball, which should just mimic real metaballs but in contrast come at “no” runtime costs. As a matter of fact they cause 0% CPU usage and the GTX 460 also laughs at them with about 500 fps…
They use triplanar texture mapping but also support custom uvs and come premapped with spherical UVs for low end hardware (triplanar is expensive). Naturally one can change anything about them ^^, also the textures are just picked for demo… So the scene sure looks crappy but that’s not the point here… Normals are of course also computed on GPU. Additionally they fully integrate with Unity surface shader and cast shadows (also animated), support cube reflections, and as you can see glass refractions… They are done by deforming an Icosphere with 3D perlin noise (prebaked on CPU per instance) and then with a funny combination of sin and cos waves…
To be critical, the real defining characteristic of Metaballs, at least for me, is that when two are placed near each other they combine into 1 entity.
That said it looks like the same effect as the Unreal BioRifle, and for those sorts of effects it could work really well.
one thing that could be improved would be to pass in a sort of delta velocity into the shader as a global value allowing the balls to deform a little differently when thrown around. It’d be a very cheap and add a really cool sort of smooshing effect when they are shot or hit objects.
Thanks for your replies ;). There still seem to be problems with the CPU side of surface deformation. The surface is much too sharp at some points… But I will fix that later.
What do you mean with the shadows ^^? You mean colored? Doesn’t seem to work, I now tried to output a color in the shadow pass but Unity simply ignores it :).
I don’t know about mobile ^^. I mean if you use a low poly icosphere and strip off all unnecessary computions it might actually work ;). But I can’t test it. The deformation is actually quite cheap to compute, but mobile might actually go nuds with vertex deformations? I am not sure if this is optimized that well on these devices…
Well I want to do something like in Portal 2 :). I haven’t recognized whether they connect there so it seems not too important… Also this is a major complification both in code and computationally…
That’s quite a nice idea… I think I will just pass some PhysX stuff directly into the shader… I also like the weapon ^^, didn’t know of that. Actually when they hit objects, they will later splash like in portal 2 with particle emitters and decals… At least the latter will not be included in the sample project though…
I will sure publish a full project (free of course) when it is integrated in my game in some weeks and works flawlessly with all the fancies ^^…
Woah. Math concepts well beyond my understanding. That much more impressive that you successfully moved the work to the GPU. They look awesome, I didn’t notice any aesthetic unpleasantness whatsoever.
The only thing that I’d offer is to agree that, to be true metaballs, support for merging and separation would be important. How are they actually represented? Are the deformations seen actually coming from the motions of individual metaballs in distinct clusters, or is it faked with noise?
Really cool stuff either way!
No the motions are plain on a per vertex base… Quite simple. This is why I was also stunned how close they come to the real metaballs I have seen so far ;). There will be no support for merging or separation though. These are just perlin noise icosphere with a cos/sin waving vertex shader… So far away from any metaball concept, that’s why I wrote “fake” metaballs but they fake it quite believable I guess :).
I just found your topic, more than a year after you posted it, it still looks very cool. Have you improved it further since then?
Also, I would love to see it in action on my own pc, so if you still have the code somewhere (or have an even more awesome version by now) I would love it if you made a sample project.