Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Virtual Blob Like thingies (Also known as metaballs)  (Read 913 times)

malloc

  • Bay Watcher
    • View Profile
Virtual Blob Like thingies (Also known as metaballs)
« on: December 16, 2011, 11:19:42 am »

So.. Instead of writing that assignment that is important for my future, I decided to be creative write a little meta ball software renderer.

This is the results:


Is it useful for anything? Nope!
Did I learn anything from this? Yeah, a bit actually!
AMD processors are slow, I have a new high end AMD CPU, and my friend has a faster intel CPU despite having it being 4 years older. But I have not threaded the rendering, if I did it would probably be much faster.
Other than that, well I had fun. The code is messy and bad. But hey, if you feel like messing around with it, or just want to run and have a look at what this looks like in real time.

Source and compiled version in file below if you are interested:
http://www.mediafire.com/?vq8icagbvnwysad

Controls:
Mouse to push metaballs around.
F1 Toggles grid, debug feature.
F2 changes the way meta balls are drawn.
F3 Adds 10 more metaballs.
F4 Deletes (if possible) 10 meta balls.

Please note it will probably run slow if you do not have a fast CPU.
« Last Edit: December 17, 2011, 07:47:24 am by malloc »
Logged

Caz

  • Bay Watcher
  • [PREFSTRING:comforting whirs]
    • View Profile
Re: Metaballs
« Reply #1 on: December 16, 2011, 06:39:02 pm »

Entered thread expecting meatballs - did not deliver.
Logged

malloc

  • Bay Watcher
    • View Profile
Re: Metaballs
« Reply #2 on: December 16, 2011, 10:11:17 pm »

Entered thread expecting meatballs - did not deliver.

Haha. Metaballs is just a fancy way of saying virtual organic blob like shapes, maybe I should change the thread title :P?

Either way, I redid the rendering, now it's about 800% faster, also, the blobs now do blend additively.


For anyone interested in the more technical stuff, the blobs are basically different mathematical equations, in the first picture it was distance-1 (Inverse square) falloff, here I am using a simple polynomial (Radius-1 * distance2 + 1).
Logged

Trapezohedron

  • Bay Watcher
  • No longer exists here.
    • View Profile
Re: Metaballs
« Reply #3 on: December 17, 2011, 05:21:23 am »

Entered thread expecting meatballs - did not deliver.

Same here.

But, on topic, it looks wonderful. How long did it take you to program this?
Logged
Thank you for all the fish. It was a good run.

malloc

  • Bay Watcher
    • View Profile
Re: Metaballs
« Reply #4 on: December 17, 2011, 06:22:23 am »

Same here.

But, on topic, it looks wonderful. How long did it take you to program this?

Most of the time making this was spend fiddling with the blob rendering and making it run at a decent speed.
But I think I have worked on this for three or four hours in total.

I think when I am done doing "important" school related stuff, I will try out different equations, all parametric equations could technically be used.
I will be fun seeing heart shaped blobs :D.
Logged

klingon13524

  • Bay Watcher
  • The Mongols are cool!
    • View Profile
Re: Metaballs
« Reply #5 on: December 17, 2011, 07:33:50 am »

Entered thread expecting meatballs - did not deliver.
Same. And I have no idea what this software thing it's actually about is.
Logged
By creating a gobstopper that never loses its flavor he broke thermodynamics
Maybe it's parasitic. It never loses its flavor because you eventually die from having your nutrients stolen by it.

malloc

  • Bay Watcher
    • View Profile
Re: Virtual Blob Like thingies (Also known as metaballs)
« Reply #6 on: December 17, 2011, 07:54:04 am »

I've changed the title to be a little more clear for people who are not so well versed in graphical jargon.
Logged

Jay

  • Bay Watcher
  • ☼Not Dead Yet☼
    • View Profile
Re: Virtual Blob Like thingies (Also known as metaballs)
« Reply #7 on: December 17, 2011, 01:49:51 pm »

AMD processors are slow, I have a new high end AMD CPU, and my friend has a faster intel CPU despite having it being 4 years older. But I have not threaded the rendering, if I did it would probably be much faster.
Erm, I do hope those are separate statements.
If you thread it, the Intel chip will gain just as much, if not MORE of a benefit.

I don't mean to turn this into processor wars or anything, but AMD hasn't been making any claims of comparable performance recently, and for good reason -- the chips just plain don't compete right now.
Logged
Mishimanriz: Histories of Pegasi and Dictionaries