Computational Fluid Dynamics
by Jack Stone · in Game Design and Creative Issues · 12/06/2012 (3:54 pm) · 5 replies
I have recently been thinking about realistic water in games (In general, not just Torque Games), and I have come to the conclusion that it's quite underrepresented. I know that we have detailed Ocean and river effects, using shaders and other techniques, but I'm talking about genuine "flowing" water.
For Example: filling a bucket from a tap, water from a leaking pipe flowing down a staircase and puddling at the bottom, a player shoots at a barrel of water and it pours out into the room. This, to my knowledge, has never been done.
The reason for this, of course, it that water is composed of "particles", ie, molecules, and rendering enough particles for realistic water is a huge challenge for any computer system, and nigh-on impossible for a computer game running on average hardware.
The closest we can probably get is a 3D version of the "Falling Sand" type game:
fallingsandgame.com/sand/pyro.html
Which would be a lot of "fun" but not realistic looking, a player would easily be able to see the individual particles that make up the flow.
I found an excellent article from Intel, here:
Fluid Simulation for Video Games
This provides extensive documentation and sample code for a very complex fluid dynamics program, which is a lot more than a "game" would likely need.
Nvidia has also produced an excellent water pysics demo using physx:
n4g.com/news/183130/nvidia-physx-particle-fluid-demo-video
I created a simple 2d water physics demo (based on falling sand) in college for a physics project, and I had an idea to try to do something like that in torque. My question is, is it even possible to create realistic flowing water like "Falling sand", without the individual particles being visible to a player? Is there some kind of smoothing function that can be implemented quickly (in real time) like the Nvidia demo?
Would this be the kind of thing the torque community could use? I think it could open up a whole new area of games, in the same way that Havoc and Ageia did with their physics engines, or Volition did with the original Red Faction. They allow players to look at a game in a whole new way, in Red Faction, you can tunnel through walls and floors to flank an enemy or set traps. Imagine combining the with realistic water, you could plant an explosive charge on a reservoir, retreat to a safe distance, then detonate it and drown all of the enemies nearby.
Another point is that, if you look at Valve's Portal series, in those games a gameplay mechanic (namely, the portal guns) became the entire game! So it could be possible to do the same thing with water?
Thoughts?
For Example: filling a bucket from a tap, water from a leaking pipe flowing down a staircase and puddling at the bottom, a player shoots at a barrel of water and it pours out into the room. This, to my knowledge, has never been done.
The reason for this, of course, it that water is composed of "particles", ie, molecules, and rendering enough particles for realistic water is a huge challenge for any computer system, and nigh-on impossible for a computer game running on average hardware.
The closest we can probably get is a 3D version of the "Falling Sand" type game:
fallingsandgame.com/sand/pyro.html
Which would be a lot of "fun" but not realistic looking, a player would easily be able to see the individual particles that make up the flow.
I found an excellent article from Intel, here:
Fluid Simulation for Video Games
This provides extensive documentation and sample code for a very complex fluid dynamics program, which is a lot more than a "game" would likely need.
Nvidia has also produced an excellent water pysics demo using physx:
n4g.com/news/183130/nvidia-physx-particle-fluid-demo-video
I created a simple 2d water physics demo (based on falling sand) in college for a physics project, and I had an idea to try to do something like that in torque. My question is, is it even possible to create realistic flowing water like "Falling sand", without the individual particles being visible to a player? Is there some kind of smoothing function that can be implemented quickly (in real time) like the Nvidia demo?
Would this be the kind of thing the torque community could use? I think it could open up a whole new area of games, in the same way that Havoc and Ageia did with their physics engines, or Volition did with the original Red Faction. They allow players to look at a game in a whole new way, in Red Faction, you can tunnel through walls and floors to flank an enemy or set traps. Imagine combining the with realistic water, you could plant an explosive charge on a reservoir, retreat to a safe distance, then detonate it and drown all of the enemies nearby.
Another point is that, if you look at Valve's Portal series, in those games a gameplay mechanic (namely, the portal guns) became the entire game! So it could be possible to do the same thing with water?
Thoughts?
#2
Before you ask - I don't know how. Thinking on paper and hopefully one of you intelligent people with a little time to work on it will take it from here.
What I have yet to see is a good modelling of adhesion - how else do we render an accurate meniscus?
12/06/2012 (4:28 pm)
Theoretically, a "meta-blob" would look more liquid-like - anyone who's used meta-balls in 3DS Max knows what I mean. Basically, the particles have a radius and a render region (2D or 3D) is calculated as a sort of skin over the group of particles. Any particles - or group of particles - that is too far removed from the main group (viscosity or cohesion calculation I guess) would be rendered with its own skin.Before you ask - I don't know how. Thinking on paper and hopefully one of you intelligent people with a little time to work on it will take it from here.
What I have yet to see is a good modelling of adhesion - how else do we render an accurate meniscus?
#3
12/06/2012 (5:06 pm)
I like the work Cem Yuksel is doing www.cemyuksel.com/research/waveparticles/ .Some day I would like to try to incorporate this system in Torque.
#4
However, I love thie "Meta blob" idea! In fact, while thinking about this, I thought that if only there was a way to render some kind of "blob" in torque then I could make the particles themselves invisible, and use the blob as the visible surface.
This is something worth exploring I think, this would accomplish nearly all of the goals I described for a realistic fluid engine.
I think the idea of rendering the meniscus would be what I'd call a "10% step", it's not really vital... Realistic flowing water, even without adhesion, would be such a huge step forward for Indie games, or even big budget games, that the smaller details won't matter so much.
Joseph, the link you posted is excellent! That is some very powerful code at work there, you could do a lot with that!
Now, off to research meta-blobs...
12/07/2012 (1:06 pm)
I agree that water blocks can be quite powerful, but they still wouldn't allow "flowing" water like described.However, I love thie "Meta blob" idea! In fact, while thinking about this, I thought that if only there was a way to render some kind of "blob" in torque then I could make the particles themselves invisible, and use the blob as the visible surface.
This is something worth exploring I think, this would accomplish nearly all of the goals I described for a realistic fluid engine.
I think the idea of rendering the meniscus would be what I'd call a "10% step", it's not really vital... Realistic flowing water, even without adhesion, would be such a huge step forward for Indie games, or even big budget games, that the smaller details won't matter so much.
Joseph, the link you posted is excellent! That is some very powerful code at work there, you could do a lot with that!
Now, off to research meta-blobs...
#5
I think it's important to clean them up as fast as possible however, such as, hitting the ground should get the water absorbed in it, same for rivers and lakes.
But you could probably build a lot of puzzles around the concept of moving those "metalballs" around, as long as you don't try to be too open ended in how the liquid has to behave.
02/12/2013 (5:03 am)
Water particles could be simulated in a limited way i suppose.I think it's important to clean them up as fast as possible however, such as, hitting the ground should get the water absorbed in it, same for rivers and lakes.
But you could probably build a lot of puzzles around the concept of moving those "metalballs" around, as long as you don't try to be too open ended in how the liquid has to behave.
Torque 3D Owner Scott Warren
Really like what Ron was working on in this thread:
www.garagegames.com/community/blogs/view/22015/
I also think your thread about dealing with the dynamic water effects is a great idea and long over-due. T3D, specifically, is a beautiful engine that deserves this sort of attention.
My opinion is to advance the engine as far as the programmers talents will let you. People will upgrade eventually or be left behind without such things as dynamic water effects.
Sure I agree with trying to encompass as many older machines as you can but if it becomes a weak link for advancement then it's time to say good bye to the older machines and move closer to current Technology capabilities.