How can I accurately simulate water buoyancy in my game engine physics?

  • Context: Graduate 
  • Thread starter Thread starter DivisionByZero
  • Start date Start date
  • Tags Tags
    Engine Game Physics
Click For Summary
SUMMARY

This discussion focuses on simulating water buoyancy in a game engine using a particle-based system with Verlet integration. The user proposes a dual-equation approach to calculate buoyancy effects based on local and average water heights, aiming for a balance between realism and computational efficiency. Key insights include the necessity of calculating buoyant force as a function of displaced water volume and the importance of considering wave effects on submerged objects. The conversation highlights the complexities of fluid dynamics and suggests that achieving realistic water physics may require advanced techniques.

PREREQUISITES
  • Understanding of particle-based physics simulations
  • Familiarity with Verlet integration for motion calculations
  • Knowledge of buoyancy principles and fluid mechanics
  • Experience with game engine physics implementation
NEXT STEPS
  • Research "Verlet integration in game physics" for improved simulation techniques
  • Explore "fluid dynamics algorithms for real-time applications" to enhance realism
  • Learn about "computational fluid dynamics (CFD) software" for advanced modeling
  • Investigate "particle-based fluid simulation tools" like 3D Studio Max for practical insights
USEFUL FOR

Game developers, physics programmers, and anyone interested in implementing realistic water buoyancy and fluid dynamics in interactive environments.

DivisionByZero
Messages
17
Reaction score
0
I was searching for equations on water bouyancy, and was very interested to find this forum for physics, etc. I'm currently writing the physics for a game engine, partially because I want to learn more physics and I would also like to see the game engine have some nice physics.

Todays personal computers are fast, but not quite fast enough to do 3d renderings along with a bunch of other stuff, with perfect physics. I would however like to make the physics as realistic as possible while still maintaining decent frames per second.

I'm using particle based system, where each particle moves based upon the verlet integrator, uses projection to handle collisions, and uses distance constraints to keep the particles in their correct positions.

Anyway, the main reason for saying all this is that I don't want utter perfection, but stuff that looks good, and is reasonably accurate.

Now, to my actual question.

I'm intending to implement reactions to water in my physics engine. The game engine already has a water object- using sine waves to generate the waves with a little randomness thrown in. Anyway, I was thinking on implementing the water physics, when I realized there would be a problem with simply making particles raise/lower proportianetly to the water height above. the problem with this is that even when the object is very, very deep, it is affected by the water motion above. I decided it would probably be best to basically have two equations. one that bases it's calculations on local water height, and one that works of average water height. then put the result in a weighted average, where the weights are based off the distance from the minimum water level. When above this level, the local water height equation is used, but when below, the average favors the average water level more as depth increases. eventually it is the only equation used.

I believe my method so far should pretty much work, but the question is how to store particle bouyancy. simply a constant that when multiplied by the adjusted water preasure(result of weighted average) to get acceleration? Where negative values will mean that the particle drops, and positive mean it rises.

Is there a better system than this that is not too calculation intensive?

Thanks for any suggestions!

--DivisionByZero
You know it makes sense
 
Last edited:
Physics news on Phys.org
No One?

:frown: Well, I guess I don't know what to expect, being my first question/post to this forum. I guess this forum focuses on molecular physics rather than General sorts of equations for large phenomenon.

Oh well. I don't know about bouyancy much anyway. How does it work? How might you find the force imparted on an object?
 


Originally posted by DivisionByZero
Oh well. I don't know about bouyancy much anyway. How does it work? How might you find the force imparted on an object?
What you're describing seems to not really be physics, but some sort of strange simulation mechanism that you hope will make realistic-looking waves.

The buoyancy force is simple: an object experiences an upward force equal to the weight of the water it displaces. For a drop of water in water, of course, the drop's weight is equal to the weight of water it displaces, so the net force on it is zero.

- Warren
 


Originally posted by chroot
What you're describing seems to not really be physics, but some sort of strange simulation mechanism that you hope will make realistic-looking waves.
Perhaps fluid dynamics on a particle level? Its extrordinarily difficult. It isn't buoyancy though.
Anyway, I was thinking on implementing the water physics, when I realized there would be a problem with simply making particles raise/lower proportianetly to the water height above. the problem with this is that even when the object is very, very deep, it is affected by the water motion above. I decided it would probably be best to basically have two equations. one that bases it's calculations on local water height, and one that works of average water height.
Sounds like you are saying water is compressible. It isn't (at least not on the scale of the motions you are describing). I guess you could model it that way for simplicity, but it wouldn't accurately reflect the way water works. It might look good though, which is probably all you need.

The motion of water molecules due to waves in the ocean is governed primarily by viscosity. Like I said though, its very complicated. Master's thesis type stuff. And I haven't gotten that far yet.

Have you tried finding some software tools? I haven't played with 3d graphics much, but I know programs like 3d Studio Maxx do particle level fluid simulation.
 
Yay finally responses!

Kind of a misunderstanding(sorry, my fault). What I mean is that the water is already semi simulated in the engine. It is WAY to hard to do liquid dynamics real time. It's just cheap sine wave water where each point of the water moves up and down in a sine wave motion.

My problem is that I have objects, let's say people, barrels, tables, crates, etc. Being simulated using a method known as verlet physics, which is popular for games. In most applications it is only important to simulate the exterior of the objects. It is basically just a network of interconnected points. Each of these points is assigned a mass. Although real points (if there are any) would not have mass, this is simply acting like that point represents a substantial part of the object.

Anyway, what I'm doing is checking if these points are submerged. if this is the case, then I need to be able to calculate the buoyant force applied to the object. I can get the point's depth based on the average water level, the point's depth based on the water level directly above (including waves).

According to chroot's definition, I *SHOULD* be able to simply store the volume each point is supposed to represent, and then multiply by a constant that converts from my volume unit to the force imparted by gravity. So basically, If I have a table made with 8 points(one for each corner of the top, and one for each leg), the points representing the table corners imart much more buoyant force than the legs. plus the friction would be much greater for the top of the table.

I'm sure the viscosity stuff is very complex, but surely objects far under the water do not fell the waves far above.

Oh yes, and what's with the charachter limit? is it per post? per week? per month? sorry if I'm wasting anyones charachter allotment...
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
28
Views
3K
  • · Replies 18 ·
Replies
18
Views
7K