Posted by: pixelero | December 12, 2008

Pixel Bender: MetaBlobs

I have now been posting these demoes for about 9 months. According to blog stats, your most popular search terms leading here are ‘Metaballs’ and ‘Pixel Bender’ – so I think it’s about time to combine those two !

To render blobs aka metaballs with Pixel Bender I came up with a slightly different algorithm – to avoid the problems with solving an implicit equation in real time rendering. First a weighted average of the distances to each blob – eight of those – is counted,  then the output is rendered as a spherical surface. You will find more information on the comments of the code.

The blobs have diffuse rendering with a specular highlight by a fast Blinn-Phong -algorithm, and abilities to adjust the position of light source, colors for the material, shadow and light. In the demo you can choose from some preset materials – looking like oil, chocolate, blood etc … – on the left on the player. You can use mouse pointer as a torch, and clicking changes the rotations.


  1. Hi Petri,

    kinda nice little idea to extend the quasi ‘standard metaball-method’. You know I´m always attentive when someone plays along with those metaballic stuff.

    I think the whole piece may behave even smarter, if each blob reacts on the current mouse-position ( maybe moves into the mouse direction or the like ).

    But it´s still a tasty little snippet at the moment….


  2. wonderful demo!
    this is a really good start point for 3d shaders
    thanx for sharing! 😉

  3. Hi Petri,

    Looking great! Ever tried combining this with refraction or reflection, might give an interesting result 🙂


  4. Thanks for your comments,

    Frank: yes could be, so far I had the main focus on the pb-code, swf is ‘just something’ demonstrating it … I hope to have time to do something even crazier with this, so Be careful! He’s got metaballs. He might use them! !

    David: I tried this as a filter refracting or distorting the source image – but didn’t want to slow down the performance too much, although there would be so much stuff like bitmap texture, reflection or bump mapping to add.

  5. Sexy!! 😀

  6. SUPER NICE!!!

    Hyva Suomi.

    Sorry taala Kanadassa ei toimi “A” pisteet. 😉

  7. wow realy nice!pixel god^^

  8. […] snippet. Due to the fact that there are a lot of very good snippets out there (just have a look at Petri´s publications for example), dealing with Metaballs, I decided to add some 3D behaviours to my current release […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: