| |
|
|
||||
![]() |
||||||
| |
|
|||||
|
Deep-Water
Animation and Rendering
Shallow
Water Waves
Were G is gravity (and other global forces), h is the height of the water surface, d is the depth, and u is the horizontal velocity of a vertical column of water. We can also combine these two equations. Start by differentiate Equation 2-11 with respect to x and Equation 2-12 with respect to t:
Now substituting the partial cross-derivative of Equation 2-14 into Equation 2-13 we end up with:
Using finite-differences we can discretisate this as:
Now that we have turned the partial-differential equation into a second order ODE we will solve it using a first-order implicit method. First we will use finite-differences to discretisise the first- and second order time-derivatives of h:
We are solving for hi so we will rearrange Equation 2-17 and substitute it into Equation 2-18:
And substituting Equation 2-16 into this we get:
The last discretisation done is to treat the depth as constant during iteration, so one ends up with the following linear system:
Where A is given by:
Now this matrix gives a symmetric tridiagonal linear system, which can be solved relatively fast, see [6] for more info. Expanding Equation 2-14 to 3D is done by substituting the partial derivative of h with respect to x with the Laplacian:
And it’s solved exactly as the 2D case simply by splitting it up into two systems - one dependent on x and one on y. Surface
Waves
Where |V| is the velocity of the wave (across the surface). Let hx,yt be the height of the grid at position x and y at time t, then Equation 2-23 can be discretisised using central differences as [3]:
As shown in great detail in [3] this can be animated with just a few arithmetic operation per grid-element
Mixing of the models For mixing the FFT and physics water, we simply take the geometry from the FFT algorithm and superimpose on it the geometry resulting from the physics model (that’s computed only around floating objects). Although not physically correct, this provides us with the results we desire.
Buoyant Rigid Objects One method for approximating buoyancy is described for example in [3]. As known, according to Archimedes, the force of buoyancy is equivalent to the weight of water displaced by the floating objects. To approximate the displaced volume, we represent the object by a series of patches described by the coordinates of their centre, their area (a) and their normal (N). Then for a given patch (if it’s centre lies in the water), the volume of displaced water can be written as: V = a(Pwater - Ppatch_center)N where Pwater is the point on the water surface and Ppatch_center is the position of the centre of the patch. Now, for simplification, we can assume that this force has always direction of the water surface’s normal at the given sampling point. Thus the force applied to the centre of our patch is: F= rvNwater where r is the water density. We apply this force to the given point using the standard equation for rigid object physics, as described for example in [13]. There are also two other forces that we should try to simulate. First, floating objects don’t slide freely on the water because of drag. We approximate it for each patch using equation:
Fdrag= ßaV We use the following equation to approximate this effect: F = -ja(N.V)N where j is another constant. Note that we use bilinear interpolation of values defined in the grid, to obtain all quantities connected to the water surface, at arbitrary points on the surface. While this covers the way water affects floating objects, there should also be feedback going in the opposite way. The proper solution would be to take the object into account directly in the physical equations used for animating the water surface, but since values entering these equations don’t represent the complete mixed water anyway, we decided to use another approach. First, for all grid elements touched by any object, we temporally increase the damping factor in the wave model used for object interaction (this creates a wave “shadow” – i.e. place in which waves don’t spread). Secondly, we compute the change in depth of the floating object between the last and current frame, and feed this difference back to the water surface as direct displacement of the surface. With correct scale of this effect, we get both waves from objects that falls into the water and waves formed behind moving objects (such as boats). ______________________________________________________ |
||||||||||||
|
|