- #1
LemonScented
- 2
- 0
Hello,
I'm new here, and have a confession: I'm not a physicist, merely a games programmer. Please be gentle with me, and speak slowly The stuff I'm looking into seems to be outside the scope of all of the games programming forums I know of, so I thought I'd try here.
I'm working on a 2D game which heavily features fluid physics. I'm basing my work from the paper "Particle-Based Viscoelastic Fluid Simulation" http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/pvfs.pdf" , although because I'm modelling paint rather than goo/jelly I've ignored the sections on viscosity and plasticity, and replaced the prediction-relaxation method of integration with Verlet integration, for speed and simplicity.
I'm having some difficulties with section 6.1 of the paper, which concerns interactions with rigid bodies, and I can't find anyone else who might be prepared to answer my questions. There are a few parts of the description which aren't clear but which I've made educated guesses at, but there are two main issues I'm strugging with:
1) Slip Friction. Equation 11 in the paper describes how an impulse is calculated by taking the relative velocities of a particle and the corresponding contact point on a body, splitting it into normal and tangential components, and then recombining them into a force which negates the normal velocity component and removes a fraction of the tangential (that fraction being dictated by "Mu", the slip friction parameter). However, when I take the velocity of a point on the body to calculate the relative velocity, the tangential component points in direction in which anybody with angular velocity is spinning anyway, so adding a scaled torque in this direction only serves to accelerate the angular velocity until the body spins out of control, rather than to dampen it. I've looked at this for a couple of weeks, and it seems to me that either I've made some kind of mistake and my tangential component points in the wrong direction, or it's a misprint in the paper and "Mu" should range from -1 <= Mu <= 0 rather than 0 <= Mu <= 1. Can anyone confirm or refute this?
2) Buoyancy. Based on my findings for 1, I've tried various negative values of Mu to dampen the angular velocity rather than accelerate it. All values seem to have the same effect, which is remove almost all angular velocity unrealistically quickly and cause the body to sink slowly in the fluid, regardless of its density. I don't know how to make bodies float, although the video that accompanies the paper indicates that it should be possible. It occurs to me that the method in the paper effectively cancels/ignores the mass of the particles from the equations, and no mention is made of the density of the body. I had hoped that buoyancy would come out as an emergent property of the simulation, but this doesn't seem to be the case. How would I go about adding buoyancy into this model?
I hope I've worded this okay, and that my questions aren't too stupid. If it would help, I can post some screenshots or videos to illustrate things better. As I said, the ability to do these kinds of fluid simulations in realtime for games seems to be a relatively new thing, so it's not been easy to find help or second opinions.
I'm new here, and have a confession: I'm not a physicist, merely a games programmer. Please be gentle with me, and speak slowly The stuff I'm looking into seems to be outside the scope of all of the games programming forums I know of, so I thought I'd try here.
I'm working on a 2D game which heavily features fluid physics. I'm basing my work from the paper "Particle-Based Viscoelastic Fluid Simulation" http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/pvfs.pdf" , although because I'm modelling paint rather than goo/jelly I've ignored the sections on viscosity and plasticity, and replaced the prediction-relaxation method of integration with Verlet integration, for speed and simplicity.
I'm having some difficulties with section 6.1 of the paper, which concerns interactions with rigid bodies, and I can't find anyone else who might be prepared to answer my questions. There are a few parts of the description which aren't clear but which I've made educated guesses at, but there are two main issues I'm strugging with:
1) Slip Friction. Equation 11 in the paper describes how an impulse is calculated by taking the relative velocities of a particle and the corresponding contact point on a body, splitting it into normal and tangential components, and then recombining them into a force which negates the normal velocity component and removes a fraction of the tangential (that fraction being dictated by "Mu", the slip friction parameter). However, when I take the velocity of a point on the body to calculate the relative velocity, the tangential component points in direction in which anybody with angular velocity is spinning anyway, so adding a scaled torque in this direction only serves to accelerate the angular velocity until the body spins out of control, rather than to dampen it. I've looked at this for a couple of weeks, and it seems to me that either I've made some kind of mistake and my tangential component points in the wrong direction, or it's a misprint in the paper and "Mu" should range from -1 <= Mu <= 0 rather than 0 <= Mu <= 1. Can anyone confirm or refute this?
2) Buoyancy. Based on my findings for 1, I've tried various negative values of Mu to dampen the angular velocity rather than accelerate it. All values seem to have the same effect, which is remove almost all angular velocity unrealistically quickly and cause the body to sink slowly in the fluid, regardless of its density. I don't know how to make bodies float, although the video that accompanies the paper indicates that it should be possible. It occurs to me that the method in the paper effectively cancels/ignores the mass of the particles from the equations, and no mention is made of the density of the body. I had hoped that buoyancy would come out as an emergent property of the simulation, but this doesn't seem to be the case. How would I go about adding buoyancy into this model?
I hope I've worded this okay, and that my questions aren't too stupid. If it would help, I can post some screenshots or videos to illustrate things better. As I said, the ability to do these kinds of fluid simulations in realtime for games seems to be a relatively new thing, so it's not been easy to find help or second opinions.
Last edited by a moderator: