Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Brian Washburn, posted on April 06, 2002

Image Description, by Brian Washburn

This IOTD demonstrates my 2d metaball engine I wrote in a couple days, rendered in OpenGL.

Rendering and calculating metaballs are very cpu extensive, 2d or 3d. My goal was to have many metaballs on the screen at once without slowdown, so I opted for 2d. To reduce the computing load and increase fps, the window itself is rendered in 320x240, and then is broken into 160x120 chunks. Even then, rendering a mere 10 metaballs would mean 192000 illiterations! (120x160x10). With certain optimizations I managed to reduce that number to around 15000.

Drawing the metaballs involves density/electrical fields. Density fields are usually used to display things such as air pressure or temperature but they can be used to display blobs also. Every point on my 160x120 graph is tested to see how far away it is from all the metaball's centers. If that value passes a certain threshhold the pixel passes, and is rendered. Surprisingly, the color of each pixel is determined almost the same way.


The 'A' key adds a metaball. The 'S' key subtracts a metaball. 'Enter' singles out a a certain threshhold value, and only draws it. (torus)

The demo is available for download here: (41k)

Brian Washburn, 2002

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 06, 2002, 05:45 PM

YOur right. But this web sight has other non-english
speakers; no.


April 06, 2002, 06:09 PM

my version (written 2 weeks ago):

but not my texture ;)

Mathieu 'POĻ' HENRI

April 06, 2002, 06:12 PM
this one displays ( if I'm not wrong ) 40x5 metaballs in 320x200 with 1pixel resolution and it's faster than Brian's ones

btw, the "additive sprite" method is ok if don't really bother of the error.


April 06, 2002, 06:17 PM

I think it's more worth it to buy another keyboard.. you're caps seems to be stuck.


April 06, 2002, 06:24 PM

I got about 10 going pretty fast on the gba (although not multi-coloured)- I have the intensity values stored in a grid which represents the ball. I then just run through this and add the values to the video buffer with the correct offsets for the ball position. Oh, and just clamp at 255 (which is dead easy to do in arm asm). One cool thing with this, is that I can bung odd shapes into my grid, smooth them out a bit, but have the values quite low, so they do not get draw until they come in contact with another ball. I think it should look quite cool with a ball rolling over some writing. (If you can imagine that..)

I really like the dot effect you have, I might give that a go.

Ah, I love metaballs however they come.



April 06, 2002, 06:36 PM

Dude, your an idiot.


April 06, 2002, 06:37 PM

I like metaballs. :)


April 06, 2002, 06:45 PM

dude, let me have my fun "First Posting" it isn't against the rules so back off


April 06, 2002, 07:12 PM

If you're going to post stupid shit go back to


April 06, 2002, 07:14 PM

fuck urself in the air.
right now.
a lot.
For THE FIRST TIME, if you wish so!!!!



April 06, 2002, 07:19 PM

If you feel stupid, come on, post those stupid "replies" and you'll
get famous.
I __MEAN__ ""famous"". Actually, Kurt should ban you despite that
it's not against the rules. Just because YOU_ARE_TOO_STUPID_TO_POST_
Don't you get it? Either you post smarter things or DON'T pos, PLEASE!



April 06, 2002, 08:19 PM

> Even then, rendering a mere 10 metaballs would mean 192000 illiterations!

Since when 192000 became a big number?
You program must fly at 200-300fps at least.
Can we take a look at your source code?



April 06, 2002, 08:22 PM

That is disturbingly amazing... or amazingly disturbing...


April 06, 2002, 08:23 PM

You use big words like frivolous, yet your command of the language doesn't warrant such use. No offense intended.


April 06, 2002, 08:23 PM

If you look hard you can see a sailboat............



April 06, 2002, 08:26 PM


Illiteration is not a word, and alliteration has no place in isosurface algorithms.


April 06, 2002, 08:34 PM

Iteration illiteration is an alliteration ;)=) - Wernaeh


April 06, 2002, 08:37 PM


Three words:

Got Milk?

Get your words straight!


April 06, 2002, 08:38 PM

"Dude, your an idiot."

please tell me you spellt "you're" wrongly on purpose :) stuff like this is always funny...


April 06, 2002, 08:47 PM

en flipcode is nie 'n plek vir vuil suid-afrikaaners nie...


April 06, 2002, 08:48 PM

Straight words form a grid of lies, yet there is truth to be found in the unbound world of the words ;)=) - Wernaeh


April 06, 2002, 08:49 PM

hahahah jou bliksem... kry vir jou!


April 06, 2002, 08:49 PM

Do the words Retard Choir mean anything to you?


April 06, 2002, 08:51 PM

If you actually read your post your brain falls in a wormhole to the dimension of befor you read your post. What? I like Pork!


April 06, 2002, 08:55 PM

Retard choir = group of singing retards? noo guess i am NOT able to sing in a choir ;)=)
yeah forum chat ;) guess ill leave u and dan alone.. n8 m8s ;) - Wernaeh


April 06, 2002, 08:56 PM

U know terry pratchetts discworld novels ? he got a similiar logic.. if u dunno them, u should perhaps buy one, guess ud like it ;)=) - Wernaeh


April 06, 2002, 08:57 PM

My metaballs itch.


April 06, 2002, 09:11 PM

Stop cocaine :-)



April 06, 2002, 09:36 PM

What are the uses of metaballs?

This thread contains 102 messages.
First Previous ( To view more messages, select a page: 0 1 2 3 ... out of 3) Next Last
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.