Representing Breaking Waves In Computer Graphics / Daniel Blacker / 07/03/05 / Page 5

 

1. Abstract 2.Introduction 3.Ocean Waves 4.Waves in CG 5.Tool Development 6. Conclusion 7. References 8.Code

5.1 Applying Techniques to Maya

Applying this method to the creation of a tool in Maya is not as straight forward as replicating each step in the paper with the software. The first hurdle is met when dealing with Maya’s fluid tools. Maya does include a working set of fluid tools including 2d and 3d Navier-Stokes solvers. What it lacks is the ability to generate a realistic 2d overturning wave using these tools.

‘Maya has a N-S solver suitable only for fluids situated inside a rectangular computational box, and that won't be able to handle free-surface simulations, like breaking waves. Unless somehow you constrain the density inside a region of the box to be very large (that would be the water) and in the rest of the box very small (that would be the air) and then have a surface tracking/capturing device, like a level set or a volume fraction, implemented as well.’ [8]

With this implemented the wave would exist as level-set data and would need an appropriate algorithm for building the surface of the water.

‘The level set method defines the surface as the zero level set of a scalar field, which is, say, positive inside the liquid and negative outside it.’ [1]

With this method the wave is described with a 3d voxel grid, or ‘scalar field’, each element either containing water or no water at any given frame. To convert this data into a renderable surface each voxel must be sampled and a surface must be constructed for each frame.

‘The surface is reconstructed at any time by means of an implicit surface reconstruction algorithm like marching cubes, for example. We should note that merging or splitting of the surface is “built-in” for such methods and one doesn’t need to do anything fancy in order to deal with them.’ [1]

Marching cubes is a method of constructing surfaces from scalar fields first described by W.E. Lorensen and H.E. Cline in their SIGGRAPH paper, ‘Marching Cubes: A High-Resolution 3D Surface Construction Algorithm’. The basic principle behind algorithm is to take data describing space subdivided into a series of small cubes, and then to take each cube in turn and build that part of the surface.

‘The algorithm then instructs us to 'march' through each of the cubes testing the corner points and replacing the cube with an appropriate set of polygons. The sum total of all polygons generated will be a surface that approximates the one the data set describes.’ [9]

Maya does not supply such an algorithm as part of its basic toolset. Plug-ins have been developed, such as Brian Townsend’s ‘Isosurface Generator’, that can replicate the process of the marching cubes algorithm inside Maya. Its suitability for this project however is limited:

My isosurface plug-in right now is implemented in such a way that it requires reading in the scalar field data from a text file. I do not think it would be much use to you in its current form. However, I have just recently begun working on my own fluid solver based on a 2005 paper by Song, Shin, and Ko called "Stable But Nondissipative Water". From what I can tell, this requires a similar algorithm to the one you require. Therefore, I am planning to modify my isosurface plug-in to receive the level set information from the fluid solver and then construct the appropriate surface. [10]

We must then take another approach if we wish to utilise the ideas discussed in ‘Animation and Control of Breaking Waves’ as part of our tool for Maya. The areas in which we encounter most problems are that of fluid dynamics, and the surfaces associated with them. We will take the core ideas behind the 2d slice method discuss how we apply them to a process much more suited to Maya’s surface tools.

As stated earlier our ideal generated surface would be NURBS, due to its computational speed and animation benefits. But from Viorel Mihalef’s paper we also know that we require the surface to handle the merging and splitting of the geometry. From this point on the actual control over the wave shape is considered foremost over the accuracy of the water’s dynamics. Remember that the waves we are creating are not intended at this stage for rendering but as proxy surfaces for character animation.

We can retain as much of the accuracy as possible of the 2d fluid solver information by utilising the slices generated from our footage. As opposed to level set data, the slices will be represented by animated NURBS curves (fig. 1). These curves are built by rotoscoping the cross section movies, dealing with the special case of the surfaces merging purely by intersecting the curves and being careful when keyframing not to produce any unnatural looking results. The curves are then provided to the tool as they are and further modification of the profile by the user is prohibited to retain the accuracy of the initial fluid calculations.

Fig.1 - NURBS animated profile of wave

To allow easy manipulation of the profile’s point of breaking the keyframes of the curve are controlled by an animation clip. The modification of a clip’s start frame attribute defines the frame on which the breaking process begins, for example:

setAttr "clip1.startFrame" 67.1;

Taking two or more of these profiles we can now loft a NURBS surface. The Axis symmetric wave generated will be almost identical to the equivalent created from the more complex fluid based process (fig 2). After the lip has plunged however the 3d Navier-Stokes solver will produce much more accurate results than our NURBS representation.

‘the 3d simulation yields the necessary and rich longitudinal instability that would be absent from a 2d simulation’ [1]

It is at this point we can begin to control the way our waves break. We can take the two profiles we used to loft the surface, and offset the start frame of the second profile by a number of frames. The resultant wave shape will try and mimic the peeling of a plunging wave that begins to break at one end (fig 3). We can extend this further by adding a third profile that has the same start frame of the first, and add this to the end of the loft. Thus creating a wave that has its lip break in the middle, and peel off in either direction. We can see that we can continue this method and create waves of any length that break at numerous points down their surface.


Fig.2 - Comparison of AxisSymmetric waves generated by (top) Viorel Mihalef's method [1] and (bottom) our method


Fig.3 - Offset of the second key profile to replicate a peeling wave

With this process we are replicating the slice method used in the paper ‘Animation and Control of Breaking Waves’, but are foregoing the dynamic accuracy of the 3d fluid calculation stage for the benefit of enhanced control and reduced computational time.

5.2 Building GUI

To create large and more complicated waves with multiple points of plunging, automation of the slice process is preferable. The tool should provide the user with the choice of the amount and distance between each key-profile, and also the initial start frame offset between each slice. With this implemented, long waves can be generated with ease and the user has complete control over the breaking shape of the wave (fig 4).


Fig.4 - Maya GUI Window showing key-profile controls

At this stage the loft that generates the wave surface simply runs from one key-profile to the next with no intermittent stages. This produces a pulse like effect as each key profile is met, which in some situations can look unnatural. To define a more accurate wave surface, more profiles must be included in the loft. The density of these profiles affects the resolution of the resultant surface, but adds to computing time when dealing with the NURBS surface.

 


Fig.5 - Waves generated showing the difference of interpolation
As a secondary stage to the tool, after the key profiles have been generated, the user can modify the offset of each via an array of sliders and when they are happy with the result, build the surface of the wave (fig 6). At this point the resolution of the interpolated profiles can be chosen and the program will provide the in-between NURBS curves that define the surface of the wave.
 


Fig.6 - Maya GUI Window showing the second level of control

< prev page
Page 5 - Tool Development
next page >