Download

Metaball Implementation?

So this would be my first time posting here, and considering metaballs are a shader I assume this question would go here.

Me and a colleague are trying to implement metaballs as some sort of pseudo fluid physics, I’ve found the proof of concept files but it seems outdated.
Honestly we have no idea where to start in terms of implementation in this engine, I have some documents that outline how we generally could do it but from what I can tell the original author of the metaballs concept said that he had to modify the engine to use Geometry Shaders with Vertex Factories.

Has that functionality been implemented yet? Any Ideas where to start?

Nothing like that is currently implemented.

There are various ways you could approach this:

  • Your Geometry Shader based method, which might be difficult, though not impossible to implement.
  • Using the Procedural Mesh Component that was introduced in 4.8, this should be easier to use, but probably lower performance as the geometry would be generated on the CPU.
  • Faking the fluids in screen space without actual geometry.

This last option is often used when attempting to render a large number of fluid particles as metaball geometry generation can get quite expensive with high particle counts. For an example of this you should take a look at Flex in Nvidia’s Gameworks branch. This contains an example of such fluid rendering.

The volume decals will allow for cheap-ish pixel perfect metaballs (assuming you don’t mind feeding in all your metaballs positions through a dynamic material).

However, I think the absolute fastest way to go about metaballs is to use the new distance field nodes in the balls’ material to expand their meshes toward nearby things. Someone made a thread not too long ago for distance field soft bodies. This would be the opposite of that effect.