Havchr's Sketchbook [Last Post: Pedagogical Metaballs in VFX Graph]

Hi - here is my introduction and also my sketchbook. I’m a game developer who mostly works in Unity on bugfixing, systems and other general game programming. But I used to do some OpenGL Demoscene coding when I was young, and I like experimenting with graphics and learning new things.

My last undertaking was to get started learning the VFX Graph by trying to implement a “naive” or pedagogical way of doing metaballs.

Spawn lots of particles with the positions of particles as the volume of a bounding box. For every “metaball” - divide distance based on metaball radius, and add all metaballs contribution together and smoothstep - let this drive the particle size.

I am sure this effect could be done much more efficiently, and if you have some metaball ideas, you are welcome to share - and look forward to learn new techniques.


A fellow demoscener! :slight_smile:

This is a really cool setup, looks awesome!

I’m not too familiar with Unity’s VFX Graph but it’s giving me some ideas. I’ve always wanted to get some old-school demoscene effects going when playing around in UE4.

1 Like

Oh that’s clever—so you’re using the particles to sample the function in a volume? Do you have a way to give them the right normals for lighting from the function’s gradient?

1 Like

Thanks mahalis - allthough I feel it must be a very slow and weird way of showing a volume, yes, I’m using the particles to sample it. If a particle is outside of the volume equation, I subtract the time to live for that particle… But There is a lot of particles that live and die just as a conveniece of this method.

Great question and great idea - It should in theory be to just take the derivative of the surface function - so something like :
normal = 2 r deltaVector / distance4
** Some hours passed and …
I tried to do it - didn’t manage to use it with the VFX lit output nodes , because I found no way to set the normal , but I did a dot product against my own light. It seems the graph now takes a really long time to compile. It is still above 60 fps but I feel like for what I am achieving visually , it is way overkill to do it the way I am doing it.

1 Like