Fluid Interactions with Rigid Bodies

Started by
1 comment, last by Zeophlite 14 years, 6 months ago
I'm trying to make a puzzle game. I'm wondering how I'd firstly represent, and secondly draw fluids, in a realtime, interactive manner. Think of you have a pool filled with water, and you have a U shaped bucket in it. As you add rocks to the bucket, it begins to sink. If you add too much, the the top of the bucket drops below the waterline, water pours in, and the bucket really starts to sink! Also, I'm interested in different types of liquids and gases, so say oil and water (which wouldn't mix), or ink and water (which would). Obviously this is a large subject, but I'm wondering where should I start? I've had a look at Jo Stam's 2003 GDC paper (http://www.dgp.utoronto.ca/%7Estam/reality/Talks/FluidsTalk/FluidsTalkNotes.pdf , as well as http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf) on fluid dynamics, but I'm unsure of the following: 1) How do static and dynamic rigid bodies interact with the fluid? What forces do the fluids apply to the bodies, and the bodies to the fluid? 2) How do I incorporate mixes, like oil, ink and water? Are their any books, papers or online tutorials that I may find useful? I'm willing sit down, and read, but I want to first know that I will get where I want in the end. And finally (less of a physics, more of an visual), how do I draw fluids nicely? Cheers, Daniel
Advertisement
I'm also interested in this topic, especially for large bodies, like rivers and oceans, waterfalls and such.

Do you want to simulate fluids in 2d or 3d?
Depending of the quantity of fluids you want to simulate, you could represent a fluid as a particle system, at least for 2d, it would be easy to render and update. Diferent fluid types would have diferent densities/weights, and you would account for this in the particle interaction code. Like for the bucket example, the more particles that enter the bucket, more weight it would have, and faster it would sink.

If you really want, for 3d you could use something like the marching cubes algoritm to convert your fluid representation to a polygonal mesh. For 2d, you could also triangulate it, or probably just render the particles as alpha blended quads with some "liquid" texture would be enough.

I hope someone with more experience in this could give us some more info :)
Thanks for your reply Relfos.

I'm working in 2d now, but I'm interested in how you'd make it work in 3d.
Should I just model the fluid as heaps of rigid circles? That doesn't feel right... I saw this (
) and it seems to work. I'm looking for something a little less computationally expensive.

What other options are there?

This topic is closed to new replies.

Advertisement