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 08, 2002, 02:53 AM


havent seen so much childish shit in long time here in IOTD, where can i learn about them?


Mathieu 'POĻ' HENRI

April 08, 2002, 03:41 AM

basically there's 2 things that annoy me in stuffs like IOTD/FORUMS and such.

1) when people posting the initial thread are absolutely not aware of the state of the art of their domain. I mean, if they can post something on a forum, then they can surf the net and read some tuts/papers...

2) when you post an IOTD, I guess it's to learn what people think of your work, get suggestions from other coders... so why on earth is it so rare to see the original poster answering other's posts/suggestions ? ( this thread has 90+ posts and Brian didn't even took the time to answer 1 though there's some interresting ones )

and now I guess I annoy everyone here ^__^


April 08, 2002, 04:01 AM

Cocaine is God's way of saying that you make too much money :)

Wim Libaers

April 08, 2002, 09:36 AM

Perhaps he looked at the first series of replies and decided to become a hermit instead of answering?


April 08, 2002, 10:46 AM

I'm just gonna send my own IOTD real soon, that's why I worry...


April 08, 2002, 12:45 PM

Lalalal... faking stuff looks good.


April 11, 2002, 02:55 AM

I have not seen the program work because im at work now but.
What is the meaning of the metaball program??? What should it visualize ??? I may sound like a newby here but hey I how should i know what u mean by metaball. Maby i know it by a different name.


Mathieu 'POĻ' HENRI

April 11, 2002, 03:47 AM

ok, metaballs ( or blobs ) basically looks like some balls moving around and merging together as they get closer

it might not be crystal clear, so I suggest that you have a look @ the url JOLLE gave ( ) to see an exemple of 2D metaballs done in a JAVA APPLET ...

btw, you seems to have an internet connection @ work so why haven't you had a look at the above mentionned url or searched for "metaballs" in google and such before ?


April 11, 2002, 08:44 PM

um, "Mathieu 'POĻ' HENRI", the only thing I see when i scanned all the posts was pointless shit and people insulting my work. If you read my upper post, you can see that I sent the screensaver to the only person that complimented me, and that I commented on Madcows code. No one else deserved my time.

Mathieu 'POĻ' HENRI

April 12, 2002, 04:24 AM

doh! I thought the name that appeared below the IOTD was the nick and not the real name, so I hadn't noticed you replied to s1, sorry for that :|

yep, many posts are rather off topic

regarding the "insult", I still think you should have found tons of tuts/papers/sources.. on metaballs if you had spent ~10min searching on the net, and you might have learnt interresting things ( anyway reading code articles never hurts )

if you have already implemented something like what madcows suggested, I don't understand why your metaballs are slower than the ones in the 256b intros I noticed

Johnny Svensson

April 13, 2002, 07:33 PM

I agree:

(old shit :)
try the mousebuttons (no check for mouserelease, so u better press them buttons real quick ;)


April 14, 2002, 04:38 PM

Why are you giving this poor guy such a hard time?

Ok, he called the prog an engine and there are better metaball demos out there, but so what?

Unfortunately, I dunno if the flipcode IOTD cue is very long, is this the reason why you hammer him down? For taking up space?

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.