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

In summary: However, I think you would want to model this by having a separate equation to calculate the buoyancy force only for objects BELOW the water's surface. This way, even if the object is deep under the water, it will still be affected by the water above. Otherwise, your system might work, but it would be inaccurate.
  • #1
DivisionByZero
17
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
  • #2
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?
 
  • #3


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
 
  • #4


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.
 
  • #5
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...
 

1. What is the difference between classical mechanics and quantum mechanics in a game engine?

In classical mechanics, the game engine uses Newton's laws of motion to simulate the movement and interactions of objects in the game world. In quantum mechanics, the game engine uses quantum physics principles to simulate the behavior of small particles, such as photons or electrons, that may affect gameplay.

2. How does a game engine use physics to create realistic environments?

A game engine uses physics simulations to calculate the movement and interactions of objects in the game world, such as gravity, collisions, and friction. This allows for more realistic and immersive environments, as objects behave more like they would in the real world.

3. Can a game engine accurately simulate all laws of physics?

No, a game engine can only simulate the laws of physics that have been programmed into it. While modern game engines can simulate complex physics, there are still limitations and simplifications that must be made for the sake of performance and gameplay.

4. How does a game engine handle interactions between objects with different properties?

A game engine uses collision detection algorithms to detect when two objects come into contact. Then, based on their properties such as mass, velocity, and shape, the engine calculates the resulting forces and movements of the objects. This allows for realistic and varied interactions between different objects in the game world.

5. Are there any new developments in physics for game engines?

Yes, there are constantly new developments in physics for game engines, such as advancements in real-time physics simulations and incorporating more complex physics principles into gameplay. Additionally, with the rise of virtual reality, game engines are also exploring ways to simulate the physics of human movement and interactions in a virtual environment.

Similar threads

Replies
5
Views
1K
  • STEM Academic Advising
Replies
11
Views
2K
  • Introductory Physics Homework Help
Replies
7
Views
1K
  • STEM Academic Advising
Replies
24
Views
2K
Replies
2
Views
863
Replies
10
Views
1K
  • STEM Career Guidance
2
Replies
47
Views
5K
Back
Top