CHAPTER 3

WATER

 

    This chapter begins with a survey of different techniques used for modeling water surfaces. Later, the bumpmap technique for modeling water is described.

  1. Related work

  2. Mark Watt at Digital Pictures in London has done work on rendering light-water interaction [5]: how light is reflected at the surface of the water and how it is refracted by the surface. He presents a variation of backward ray tracing called backward beam tracing. There has been work done where the water surface is stored as a height map or 3D surface. We briefly discuss this method in section 3.3.

  3. The view

  4. The scenery we decided to model is a view of a sunset as we look into the horizon at a slightly wavy ocean that reflects the light from the sun as it sets.

  5. Model representation

  6. The straightforward way to create this sunset scene is to model a 3D surface or possibly a height map. The surface's reflectiveness, the direction of the sun and the surface definition can then be fed to a ray tracer. The problem with this approach is that it is a time consuming, slow process, and the definition of the topology of the surface requires a huge amount of memory, as the surface extends towards the horizon. It is possible to use the repeatedness of the waves and then map the waves over the area. The problem with this approach is that waves on the ocean consist of a number of superimposed waves with different amplitude, wavelength and direction and this is also how the surface should be modeled. We have used 5 waves in our implementation. The result is that the surface will not repeat itself over and over again as an exact copy of the previous wave. We use a modified technique of bump mapping in order to resolve this problem.

    fig4.gif (3219 bytes)
    Figure 4: Wavy Bumpmap

    A bumpmap is a pattern, or a (2D) matrix of normal vectors that are mapped onto a surface. These could be thought of as micro surfaces. The surface that the bumpmap is mapped to has one "general surface normal" (i.e. it does not consider small deviations), but the micro surfaces' normals will differ from this "general surface normal" when the surface is examined at a closer range. It is this difference that is stored in the bumpmap. This can represent a wave in a simplified format so that the normal vectors are just as they would be describing a wave, but the actual surface is completely flat as shown in Figure 4.

    Please note that the problem that the surface is not repeating itself as an exact copy of the previous wave is still to be solved.

  7. A new method of calculating surface normals

  8. Instead of using a matrix containing the normal vectors for the whole surface, the normal could also be calculated as a function of the position in relation to a reference point. This means that only the normals needed for displaying each pixel have to be calculated.

    A number of waves defines the surface. The waves in turn are defined, in terms of amplitude, direction and wavelength. It is also possible to specify the wave shape. In our implementation we use sine curves to obtain the wave shape.

    fig5.gif (4416 bytes)
    Figure 5: Top-down view of water surface.

    A simple ray tracer was created for this purpose.

    fig6.gif (2821 bytes)
    Figure 6: A simple raytracer.

    After specifying the viewpoint and the viewplane, rays are shot through every pixel in the viewplane. The intersection point and the intersection angle can be calculated since the viewpoint and the position of the pixel are known. The water is a flat surface with a bumpmap textured on it. The normal vector of the surface can be calculated using the point of intersection.

    Angle of surface normal vector = tan-1(Ai *sin((POI-R) Di) )

    If the surface normal is 0 it points straight up and if it is 90 is in pointing in the direction of the wave. The number of superimposed waves is set by n and Ai is the amplitude of wave i. POI-R is the vector from R to POI and denotes the dot product. Di (see Figure 5) is the direction vector of the wave and determines also the wavelength. Once the normal at POI is known, the reflecting ray R can be found.

    fig7.gif (2723 bytes)
    Figure 7: Reflection of a ray on a water surface.

    The angle between the direction vector of the sun and the reflected ray will determine the color of that pixel.

    fig8.gif (1000 bytes)
    Figure 8: The angle between a reflected ray and the sun ray will determine the color of the pixel.

    An angle of 0 will give the pixel a white color and angle greater than or equal to 90 => dark blue color.



    Figure 9: Ocean sunset.

  9. Evaluation

  10. The inputs that are needed for this technique are direction vectors, amplitude and frequency for the waves and a direction vector for the sun. The viewpoint and the viewplane must also be specified for the ray tracer. The information can be stored in less that 100 bytes!

    A reasonably realistic sunset was successfully model (Figure 9). There are some situations where this technique is not well suited. The fact that the surface is flat is a simplification that can reveal itself. If a wave form is created so that waves are breaking (typical for large waves when they approach the shore) then this technique will completely fail, since it only allows one surface normal per position on the (flat) surface.

    fig10.gif (1476 bytes)
    Figure 10: Breaking wave.

    In this simplified implementation the sun is reflected, but no cliffs or other objects will be reflected. The waves will also look unrealistic when they hit a shore. It is very easy to modify and create a variety of waves using the above method. The only restriction is that the waves can not be too large or be breaking.

    Because of the simplifications, this technique is fast in comparison to defining the whole topology of the surface or using height maps and ray trace the image. For example it takes approximately one minute and 20 second to create one 1024x500x256 image with six superimposed waves on a 100MHz 486 PC. Ray tracing the same quality image will take considerably more time according to our experience.

 

anarule.gif (1534 bytes)

 

naprev_cmp.gif (1754 bytes)nahome_cmp.gif (1799 bytes)naup_cmp.gif (1668 bytes)nanext_cmp.gif (1698 bytes)