Thursday, 8 September 2016

Water simulation based on Spring-Damper Grid Model

The video below shows my first approach on water simulation back in October of 2011 using a spring damper grid.
I chose this approach over many others due to the parametric model and the intuitive way of modeling the dynamics.
Though there are drawbacks in general and in my implementation such as unstable solutions to the equation of motion due to oscillations( resulting from explicit solver( just euler method )  and unstable eigenvalues ).
The values of stiffness and the damping of the elements become more influence the more elements you connect and therefore less predictable in the results.
figure1: interaction of elements (xm denotes position of middle Point, x3 that of direct right hand neighbour,
x_restLen is the resting length where no spring force occurs)

As can be seen in figure1 each element is connected to its direct neighbours in the grid by a spring and  damping element.
I used also the diagonal elements in adding all resulting forces acting on the element to account for the resulting interaction force. Additionally each element has also a "virtual" connection to its initial position cause we don't want the whole thing to drop when applying gravity which is the main driving force behind a stable settlement of all grid-elements.
In this implementation there is only one incident point possible, so you can't have multiple sources of external forces at a time.
The lighting in this demo uses bilinear interpolation of the normals of each grid quad to have a good highlight and overall lighting effect.
I am using forward rendering so transparency wasn't an issue. 

Figure: Water Animation through user interaction
(Engine and Graphics: Andreas Walenda)


Video: Water Animation Spring Damper
(Engine and Graphics: Andreas Walenda)