Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Fast 2D Metaballs

Author
Message
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th Jun 2009 02:08 Edited at: 8th Jun 2009 18:58
I made this shader, which can do up to 8 interacting meta-balls per instance.

Screeny:




It comes with these DBPro functions to make using it REALLY easy:


Just call 'InitMetaBalls', and then use 'MakeMetaBall' and 'DeleteMetaBall' just like you would any other DBPro object. The ids can range from 1 to the number you used for 'maxBalls' in 'InitMetaBalls', as long as it is no more than 8.

Here is some sample media-less code to show you quite how simple it is to use:


Enjoy (And I welcome any mods)

Tell me what FPS you get and your specs for the standard 4 meta-balls in the example.

I have attached the shader file, project file and example source code so that you can try it out easily.

edit:
There is also a lava lamp demo a few posts down:


Attachments

Login to view attachments
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 8th Jun 2009 02:14
These are the best meatballs I have ever tasted.

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 8th Jun 2009 02:40 Edited at: 8th Jun 2009 02:42
Those are some sexy metaballs!

I get 2000 FPS with a C2D E6850 3.0 GHz and an 8800GTS.

i like orange
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th Jun 2009 02:40
Quote: "Benjamin (translated): That was the most awesome demo ever!"


Thanks

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th Jun 2009 11:36
Quote: "I get 2000 FPS"


Wow, nice!

Seeing as all the processing for this is done on the graphics card, it could be feasible to use it in a 2D game, seeing as they are usually heavier on CPU processing than graphics processing

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th Jun 2009 18:56 Edited at: 8th Jun 2009 18:57
I made this lava lamp demo to show off the metaballs:


Just replace the example code in the download with that code, and run it.
You should get something that looks like this (these are 4 separate screen-shots)



Attachments

Login to view attachments
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 9th Jun 2009 15:03
Nice I always wanted to see shader metaballs seeing as they are very slow in just DBP.

Make a 3D version maybe?
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 1st Jul 2009 03:24
Ooh .



Diggsey: I have a spine and memory, but one memorable guy says he hates me. What am I?
Dragon Knight
17
Years of Service
User Offline
Joined: 10th Jan 2007
Location: Newcastle
Posted: 1st Jul 2009 03:55
Pretty cool diggsey!

flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 1st Jul 2009 23:21
That is amazing.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Jul 2009 00:41 Edited at: 2nd Jul 2009 00:47
Very nice.

2400-2700 FPS!!! [Edit: 3500-3600 FPS for your original code.]

Hope to see many more fantastic shader demos from you.

Login to post a reply

Server time is: 2024-03-29 10:35:05
Your offset time is: 2024-03-29 10:35:05