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.

Code Snippets / [DBP] Fluid Simulation

Author
Message
Turoid
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 25th May 2007 00:25
Hey guys,

As the title says I made a simple fluid simulation in dbp, I can't credit for it though. It is based on this article I found on the net:
http://local.wasp.uwa.edu.au/~pbourke/modelling_rendering/fluid/

It also is a bit buggy and quite slow (because of the SQRT calls), but I think that the final result is quite cool.

Here is the code:



Tell me what you think!

I am awesome and always right.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 25th May 2007 18:24
You should try vectors for checking the distance.

It is considerably faster than sqrt() distances.

r = make vector3(1)
set vector3 1, distX#, distY#, distZ#
and
distance# = length vector3(1)

are all the commands you need for that...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 25th May 2007 21:31
Or vector2 in this case.

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 26th May 2007 01:22 Edited at: 26th May 2007 01:22
Pretty neat, now that you've got that done;

Try figuring out all of the balls that are on the very top, and draw a line from each top of the ball to the next. Hide the balls, and you should have a wavy 2d line that you can swish around with your mouse ball.

Thats how 3D fluids work, a tonne of 3d mathematical spheres have physics applied to them, then a plain is positioned ontop of the spheres, and it's verticies are moved down to match all of the top sphere's.

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 26th May 2007 01:43
But what when the water breaks up?

Good job btw!

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 26th May 2007 01:52
Well obviously theres a little more to it than what I said... but this is a basic 2d fluid sim.

piXX3D
17
Years of Service
User Offline
Joined: 27th Mar 2007
Location: Nowhere
Posted: 26th May 2007 13:57
Woah, it's like some form of Brilliant freakish water physics. Very good.

http://www.ciphersoftware.co.uk/

Your signature has been deleted by a mod. It hasn't really, this is just me trying to sound funny. My attempts are pointless.
sp3ng
18
Years of Service
User Offline
Joined: 15th Jan 2006
Location:
Posted: 27th May 2007 10:54
Quote: "But what when the water breaks up?"


wouldnt you just delete the certain faces and then weld others on top
if u dont understand heres a pic:

Attachments

Login to view attachments
Azrael
19
Years of Service
User Offline
Joined: 2nd Mar 2005
Location: Germany
Posted: 9th Jun 2007 00:11 Edited at: 21st Jun 2007 14:13
Hey! This is a great inspiration
Well done.

It's a pitty that DBP is that slow in comparison with the original demo.

Indecom
17
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 9th Jun 2007 00:47
one thing you guys may be interested in tryiing is see if you cant manage to turn those into 2d metaballs. I have done this with game maker, and i am sure you could probably do something similar in dbpro.
Azrael
19
Years of Service
User Offline
Joined: 2nd Mar 2005
Location: Germany
Posted: 10th Jun 2007 01:14 Edited at: 21st Jun 2007 14:13
Check my website ... I've got some experience in metaballs..
I would be interested in that stuff you've done with game maker

Indecom
17
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 21st Jun 2007 13:12 Edited at: 21st Jun 2007 13:15
http://hotyg.com/downloads.php

in that site is a bunch of stuff i made with gamemaker, including an ectoplasma effect done using my form of 2d metaballs. its is fun to look at and i think it would work well if you could get that effect into dbp along with this fluid thingy.

Edit: turns out the ectoplasma was missing, so here is the download for that.
alucart13
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location:
Posted: 21st Jun 2007 19:00
Yea, it just starts and ends for me

Login to post a reply

Server time is: 2024-11-22 19:14:28
Your offset time is: 2024-11-22 19:14:28