# Free flowing fluids?

This topic is 4451 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Does anyone have an idea of how realistically 'doable' this is? Basically I'd need to make a free flowing fluid that can interact with a world, i.e. collisions and stuff. Here's what I was thinking about. If anyone thinks back to Pipe Dream, I was thinking about how a full 3D version would be made. I'm not talking about something like this, but rather a full 3D version of that game. Now back to the question, ideally There would be let's say a large water tower that holds the water. When the game starts, the water starts leaking out the bottom into the pipes. The problem would then be how to make a fluid that would behave as if it were going though the pipes and such. To explain a little further to make sure it's clear what I'm thinking about, imagine if you had a ride at a waterpark. When the water starts at the top, it just follows down the entire course. (Let's ignore pressure and gravity considerations, just the liquid follows any path) Not knowing about graphic and stuff, I don't even know if that would be a valid approach to this problem, so that's why I'm asking. Any ideas/comments? FYI this is just a thought I have had. I have no immediate plans to implement this nor test it out. I have too much other stuff on my hands right now, but nonetheless I was curious about this [smile]

##### Share on other sites
You could try to just create a particle system.
Add interparticle collisions ( maybe through an octree to limit the number
of collisions you have to check )
The physics/collisions should allow particles to push eachother down the pipe.
(with a tight enough octree this would probably qualify as a voxel approach.
and each particle would only have to take on descrete locations, limiting the
collisons to each face instead of distances.)

Or you could use a fluid flow (Navier-Strokes [sp?]) on a 3d grid...
but you would have to use a small grid or end up waiting forever for each
frame to go by.

##### Share on other sites
Quote:
 Original post by KulSeranYou could try to just create a particle system.

That's a very interesting idea! Now that I think about it, I think that approach could very well work as a very efficient solution. I'll have to take a look into particle system design to see how to make particles act more cohesive rather than as 'particles'.

Quote:

Thanks for that! Looks like a great read, I'll have to definitly go over that. Those images in Figure 8 of the solver in action look very nice.

Well I have a basic idea of a few approaches to this problem. I'll have to keep a few mental notes if I ever come back to this issue. If anyone else has something to share, please do!

##### Share on other sites
You might want to read up on particle based cloth simulation. Typically, particles are connected by springs, which provides a fluid design. Baraff and Witkin did some of the original work on this.

##### Share on other sites
This might also help.

##### Share on other sites
The thumbnails seem to have disappeared, but the movie clips themselves still seem to be available from Meqon AB's future technology page. Just to let you know that it is probably fairly 'doable' ;-)
Obviously Meqon is at the forefront of this stuff, but I imagine similar options may be available for Free libraries like ODE in the not too distant future (of course, if you want to write an ODE extension for this and release it, I'm sure no one would object :-P)

-bodisiw

##### Share on other sites

edit: I was wondering as I was reading this thread if these algorithms/methods could perhaps be used to make some realistic shoreline rendering -- waves breaking, etc. All games I've seen to date have a flat shoreline with a "foam" texture that moves around or something similar. Highly unrealistic. That's sorta been my holy grail rendering technique. :)

##### Share on other sites
Awesome! Thanks everyone for the additional information. Right now I am thinking about some more 'original ideas' based on something with the aspect of this 'free flowingness'. This weekend, I'll revisit this thread and read some more into everything. Right now I was thinking about something with electricity and protons/electrons [smile]. So much to do, so little time... Thanks again guys!

##### Share on other sites
Personally, I'm not convinced that solutions based on velocity fields are ever going to be a general solution to water in game engines - Jos Stam's paper notes at the end that you've got to extract the boundary between water and air in order to render the water surface, and also, your water is constrained to the volume covered by the velocity field. That could need to be a pretty large volume...

I've reckoned for a while that it's possible to break a generalised water system down into subvolumes (probably convex ones) and then establish statistical averages for water in/out at each face of the volume, or pressure or something; by connecting volumes together you can run water through pipes, tanks, channels, and by differentiating between watervol/geometry boundaries and watervol/air boundaries you can pretty quickly establish the faces where you need to render the water surface. The difficult part is probably the 'realtime CSG' required to compute convex volumes... especially if you're looking at being able to drop objects into a volume (causing it to fracture into smaller volumes).

I've not tried any of that though, only thought about it. (If anyone knows of any work done with that kind of method I'd be interested).

##### Share on other sites
Well, I'm currently studying real-time smoke simulation for my Honours in B. Comp. Sci. (Computer Games) and have reviewed a bunch of papers concerning fluid simulation. I reckon there's a few different direction you could go in trying to model this water flow idea.
KulSeran's idea of utilising particle systems is a good one, especially for such a situation as the water almost always being in pipes. If you let each particle represent a 'packet' or small moving volume of fluid, with density, pressure, velocity and vorticity this method becomes known as a Langrangian fluid model -> a fluid is composed of many small volumes of fluid with particular characteristics.

On the other hand, Stam's system as linked by njpaul keeps track of the change of fluid flow past specified static points. This is called a Eulerian fluid model, and there are a lot of papers that use this model to solve the Navier-Stokes equations and get some attractive fluid animation. In particular, check out this paper on implementing them real-time on the GPU -> http://wwwcg.in.tum.de/Research/data/Publications/eg05.pdf

For world interactions, the Eulerian models are generally agreed to be better suited to handling boundary conditions. Both models have their strengths and weaknesses and there is a plethora of papers out there implementing them.
I'd say your idea is very much 'doable'.

[Edited by - PAiNIC on September 11, 2005 7:12:34 PM]

##### Share on other sites

novodex has fluids too, a couple of the physx demos has it
[and this paper is by at least one person from novodex]

http://portal.acm.org/citation.cfm?id=1073368.1073402

##### Share on other sites
Found a paper on 'Real-time fluid dynamics in games'. It's quite good.

http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf

There's also a website in the paper where you can go to download the code used in the paper.
I know of at least two games that have used this technique:

http://www-personal.umich.edu/~dratti/fluids/index.html

##### Share on other sites
Oh wow, thanks for that second site PAiNIC, that looks very nice. I need to come back to this topic, I've kinda left it in the dark with so much going on. I'll get around to it eventually...

##### Share on other sites
I came across this paper not a while go:
http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/

I haven't had the privilege of implementing it yet but the technique described in this paper looks pretty straight-forward and as for the results... well, you can judge by yourself.

##### Share on other sites
^

Wow. That's pretty impressive. I'm trying to resist the temptation to go off & implement this myself...

##### Share on other sites
Quote:
 Original post by superpigPersonally, I'm not convinced that solutions based on velocity fields are ever going to be a general solution to water in game engines - Jos Stam's paper notes at the end that you've got to extract the boundary between water and air in order to render the water surface, and also, your water is constrained to the volume covered by the velocity field. That could need to be a pretty large volume...I've reckoned for a while that it's possible to break a generalised water system down into subvolumes (probably convex ones) and then establish statistical averages for water in/out at each face of the volume, or pressure or something; by connecting volumes together you can run water through pipes, tanks, channels, and by differentiating between watervol/geometry boundaries and watervol/air boundaries you can pretty quickly establish the faces where you need to render the water surface. The difficult part is probably the 'realtime CSG' required to compute convex volumes... especially if you're looking at being able to drop objects into a volume (causing it to fracture into smaller volumes).I've not tried any of that though, only thought about it. (If anyone knows of any work done with that kind of method I'd be interested).

what you are talking about is using the more general finite element method, instead of the in computational fluid machanics commonly used finite differences.

##### Share on other sites

This topic is 4451 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628714
• Total Posts
2984353

• 23
• 11
• 10
• 13
• 14