问题
I've got a game idea that requires some semi-realistic simulation of a fluid flowing around various objects. Think of a pool of mercury on an irregular surface that is being tilted in various directions.
This is for a game, so 100% physical realism is not necessary. What is most important is that the calculations can be done in real time on a device with the horsepower of an iPhone.
I'm thinking that some sort of cellular automaton or particle system is the way to go, but I don't know where to start.
Any suggestions?
回答1:
This is not my area of research but I believe this is considered the canonical work:
Fluid Simulation for Computer Graphics
http://www.akpeters.com/product.asp?ProdCode=3260
Also, look at the Berkeley Animation and Modeling Group
http://www.cs.berkeley.edu/b-cam/
I also recommend a tool like Google Scholar or Citeseer and persue the scholarly literature.
回答2:
Lattice-Boltzmann methods are a pretty common way to simulate fluid in a discretised, cellular automaton-like way.
However, for the sake of real time performance on an iPhone, it may be more effective to simulate the fluid as a particle system and then work out a way to render the particles as a volumetric mass. I suspect this is the approach taken by games like Aqua Forest.
回答3:
Probably a particle system is a good place to start. Along these lines you can look into SPH (smoothed particle hydrodynamics) as a somewhat more physical approach to fluid simulation that still relies on particles.
回答4:
Ron Fedkiw's work is quite stunning in this area.
One more comment: Fluid simulations is the stuff of numerical parallel programming and supercomputers, or at the very least, high power, multi-core desktops. An iPhone probably will not cut it.
回答5:
This might also be of interest (demo video, demo binary, source code).
回答6:
SPH with particles is probably the fastest to get up and running with a head start on extendability into visco-elastics and other stuff. I'll be publishing a guide on my blog tomorrow that I've been writing for the last few days on this very topic. (http://blog.brandonpelfrey.com)
回答7:
I wonder if you're thinking of something like Archer Maclean's Mercury or Mercury Meltdown for the PSP.
回答8:
As far as I know in the game De Blob a colored "blob" moves around a white environment, coloring objects it bumps into. This was somehow triggered in my mind when I read your description of what you seem to want to do. (Haven't actually played the game, so I have no idea how well that fit is.)
Having said that, I seem to recall that the fluidity of the blob is mostly artifical in that game: basically being a sphere, some slight size/shape transformations of it, some motion cues and added "fuidy sounds" that give the player the impression that something not quite solid is the main character of the game. No actual physics or simulation type programming was involved.
Sounds like a good fit for a iphone runnable piece of software, that. Would that perhaps be enough for you?
回答9:
It is so sparce you have to model particles?
If so I recommend having a look at Lattice-Gas Cellular Automata (LGCA, see example video here).
In short, LGCA are a subclass of cellular automata where cell states are tuples of binary values, each representing a channel between a cell and one of its neighbor, and through which particles can travel (channel is1
if it contains a particle,0
otherwise).
The updating scheme is then a synchronous parallel two-step function which reorganizes particles between channels within each cell (collision) and then propagate these particles to the corresponding channel of the targeted neighbor (propagation).
回答10:
Grid based Navier-Stokes solution is always faster and the computation speed is constant.
来源:https://stackoverflow.com/questions/427151/algorithms-for-simulating-fluid-flow