• Tidak ada hasil yang ditemukan

Water ripple simulation using height field and wave equation

N/A
N/A
Protected

Academic year: 2024

Membagikan "Water ripple simulation using height field and wave equation"

Copied!
26
0
0

Teks penuh

(1)

WATER RIPPLE SIMULATION USING HEIGHT FIELD AND WAVE EQUATION

)

SHARIF MOHD. RAZIF SHARIF KAYONG

w '.' • • ' ; ,.,~-~~:\.~~

~'':I:''-r''('~'" '' -, : ·'~~1~'.,'·r'f ,,,

"; ' l

A PROJECT REPORT SUBMIrrED IN PARTIAL

FULFILMENT FOR THE AWARD OF BACHELOR OF SCIENCE DEGREE IN MATHEMATICS WITH COMPUTER GRAPHICS

MATHEMATICS WITH COMPUTER GRAPHICS SCHOOL OF SCIENCE AND TECHNOLOGY

UNIVERSm MALAYSIA SABAH

2012

UMS

UNIVERSITI MALAYSIA SABAH
(2)

DECLARATION

"I hereby dedare that this project entitled "Water Ripple Simulation Using Height Field and Wave Equation" is the result of my own research except as cited in the references. The project report has not been accepted for any degree and is not

concurrently submited for any other degree"

ii

MOHO. RAZIF SHARIF KAYONG

(BS09110423) 16

MAY

2012

UMS

(3)

APPROVED BY

Signature

Supervisor

DR ABDULLAH BADE

iii

UMS

(4)

DEDICATION

To my beloved parent, brothers, sister and all my friends.

iv

UMS

I I i

I

I

(5)

Acknowledgement

I would like to take this opportunity to express my gratitude toward the people that helped me and gave me support in order to complete this thesis. I would not be able to finish it without the mass of support directly or even emotionally.

Firstly I want to express my gratitude and thanks to Allah the Almighty who is the great Creator to all the things in this world and the one who gave! me the ability to finish my project. Without His will I will not be able to achieve what I have achieved now. I would also like to express my sincerely thanks and appreciation to my supervisor Dr. Abdullah Bade for his attention, guidance and meaningful advices that really helped me alot to increase my knowledge especially in computer graphics field.

To my beloved father Sharif Kayong bin Sharif Amang who have and will always been my motivation to focus on my study and never give up in whatever things that I do, and to my lovely mother Normalah binti Etih who have been very supportive of me and loving me since the day I was born. I am very thankful to God Almighty as I was destined to be their son.

lastly, to all my brothers and sister, and to all my friends and partners, thank you all for standing by me and helped me to accomplish this task. I will never forget each and every one of you.

Sharif Mohd. Razif Sharif Kayong, 2012.

v

UMS

(6)

Abstract

Water ripple is produced when an object disturbs the water surface. It is a form of wave which is drcular and is also known as capillary wave. The natural attributes of water ripple are small amplitude wave, roll waves will not be formed, the gravitational pull on the water surface can be ignored during mathematical equation derivation, and the waves formed are standing waves. Water ripple

• simulation is usually used in video games or even animation film: Therefore, realistic and low computational cost water ripple simulation techniques are very important.

The purpose of this project is to produce a water ripple prototype by using height field technique to create the water surface and the wave equation to simulate the wave behaviour. The average framerate of the simulation is 40 frames per second with 10,000 vertices generated on the height field. The framerate is quite high oonsidering the number of vertices generated. The hope for this project is that it can be benefidal to others especially those interested in water Simulation.

vi

UMS

(7)

TABLE OF CONTENTS

CHAPTER TITLE PAGE

DECLARATION ii

DEDICATION iv

ACKNOWLEDGEMENT v

ABSTRACT vi

ABSTRAK vii

TABLE OF CONTENTS viii

UST OF FIGURE xiii

UST OF TABLES xvi

UST OF SYMBOLS xvii

UST OF APPENDIX xix

1 INTRODUCTION

1.1 Preamble 1

1.2 Problem Background 2

1.3 Problem Statement 3

1.4 Aim of Study 4

1.5 Objectives 4

1.6 Scope of Study 4

viii

UMS

(8)

1.7 Justification 4

1.8

Report Organisation

5

2 LITERATURE REVIEW

2.1

Introduction 7

2.2

Water Ripple Properties

8

,

2.2.1

Interaction between Object and Water

8

2.2.2

Restoring Forces

8

2.2.3

Frequency of Waves 9

2.2.4

Wave Amplitude 9

2.2.5

Wave Velocity

10

2.3

Water Simulation History

10

2.4

Applications 11

2.5

Previous Techniques

12

2.5.1

Particle System

12

2.5.2

Height Field

15

2.5.3

Beta Spline

18

2.5.4

Hybrid Method 19

2.6

Discussion

21

ix

UMS

(9)

3 METHODOLOGY

3.1

Introduction

23

3.2

Project Approach

24

3.3

Methods and Development of Water Ripple

Simulation

25

3.3.1

Water Surface Height Field Construction

25 3.3.2

Solving the Wave Equation

26

3.3.3

Wave Propagation Display

28

3.4 Conclusion

28

4 WATER RIPPLE SIMULATION SYSTEM

4.1

Introduction

29

4.2

Simulation. System

30

4.3

Lighting Module

33

4.4

Wave Generator Module

34

4.5

Height Field Construction Module

37

4.6

Drawing Module

41

4.7

Menu Module

43

4.7.1

Color Options 44

4.7.2

Water Surface Types

4S

4.7.3

Tra nsformation 46

x

UMS

(10)

4.7.4

Drop Size 48

4.7.5

"Ripple Now" Button 48

4.7.6

"Reset" Button

49

4.7.7

Quit button

49

5 HEIGHT FIELD AND WAVE EQUATION

I

5.1 Introduction 50

5.2 Height Field Surface Construction 51

5.3 Wave Equation Implementation 56

5.3.1 Wave Initialization 58

5.4 Combination of Wave Equation and Height Field

Surface

59

5.S Simulation Analysis 62

5.6 . Results and Condusion

6 CONCLUSION

6.1 Summary

66

6.2 Contributions

67

6.2.1 Representation of Water Surface Using

Height Field

67

6.2.2 Implementation of Wave Equation Onto

the Height Field

67

xi

UMS

(11)

6.3 Future Work Suggestions 67

REFERENCES 68

APPENDIX 70

xii

UMS

(12)

List of Figures

Figure 1.1 Natural water ripple (Nave, 2011) ... 2

Figure 2.1 Properties of wave (Nave, 2011) ...•.. 10

Figure 2.2 Taxonomy of water simulation ... 11

Figure 2.3 Fishing Simulator game (Ast~agon, 2010) ... 12

Figure 2.4 The wavefront formation (Yuksel, 2010) ... 13

Figure 2.5 (a) Original wave partide (Yuksel, 2010) ... 14

Figure 2.5 (b) Warped wave partide (Yuksel, 2010) ... 14

Figure 2.6 Implementation of the wave equation (Kass & Miller, 1990) ... 16

Figure 2.7 (a) Raindrops (Loviscach, 2002) ... 17

Figure 2.7 (b) Kelvin ship wakes simulation (Loviscach, 2002) ... 17

Figure 2.8 Ocean waves (Ts'o & Barskey, 1987) ... 19

Figu.re 3.1 Thesis framework ... , ... 24

Figure 3.2 Water ripple simulation framework ... 25

Figure 3.3 Height field surface triangle mesh ... 25

Figure 3.4 Column simulation algorithm (Muller, 2008) ... 27

Figure 3.5 Discrete height field representation (Muller, 2008) ... 27

Figure 4.1 Simulation system where Figure 4.1 (a) user interface ... 30

Figure 4.1 (b) menu ... 30

Figure 4.1 (c) main loop ... .... ~. "\ ~',.:' ...( 7 .... .-... 3

M S

xiii ; ~ ~

(13)

Figure 4.2 Ripple class UML ... 31

Figure 4.3 Ripple dass ... 33

Figure 4.4 Lighting module ... 33

Figure 4.5 Effects of the lighting module ... 34

Figure 4.6 Ughting () function ... 34

Figure 4.7 Wave generator module diagram ... 35

Figure 4.8 Initialize () function ... 35

Figure 4.9 Calculate_Wave

0

function ... 36

Figure 4.10 Reset () function ... 36

Figure 4.11 Height field module diagram ... 37

Figure 4.12 Height field vertices generation ... 38

Figure 4.13 Height field color implementation ... 39

Figure 4.14 Height field surface oonstructions ... 40

Figure 4.15 Calculate_Normal () function ... .41

Figure 4.16 Drawing module diagram ... .42

Figure 4.17 Display () function ... 43

Figure 4.18 Menu module diagram ...•• 43

Figure 4.19 Water simulation menus ... 44

Figure 4.20 Different oolour options ... .45

Figure 4.21 (a) Fill type ... 46

Figure 4.21 (b) Wireframe type ... 46

xiv

UMS

(14)

Figure 4.21 (c) Point type ... 46

Figure 4.22 Different viewing angles ... 47

Figure 4.23 Translated objects ... 47

Figure 4.24 Outputs after scaling the objects ... .48

Figure 4.25 Different amplitude of wave due to different drop sizes ... 48

Figure 5.1 Vertices generation along the x-axis ... 51

Figure 5.2 Vertices generation on the second z-axis level... ... 52

Figure 5.3 A height field surface with 250 vertices ... 52

Figure 5.4 Triangles construction to form the surface ... 53

Figure 5.5 Height field construction algorithms ... 54

Figure 5.6 Triangulated surface ... 54

Figure 5.7 Normal vector calculation algorithms ... 55

Figure 5.8 Completed height field surface with lighting ... 56

Figure 5.9 Plane grid disaetization scheme ... 56

Figure 5.10 Water height calculation using wave equation ... 58

Figure 5.11 Different wave forms ... 59

Figure 5.12 Implementation of wave equation onto the height field surface ... 59

Figure 5.13 Height field surface algorithms with wave equation values ... 60

Figure 5.14 Simulation flowchart ... 61

Figure S.15 (a) The static water surface ... 62

Figure S.lS (b) The ripple formed on the water surface ... 62

xv

UMS

(15)

UST OF TABLES

Table 5.1 Analysis result using the gDEBugger software ... 62

Table 5.2 CPU related bottleneck test result.. ... 63

Table 5.3 Raster operation test result.. ... 63

Table 5.4 Ughting test result ... 64

Table 5.5 Shader test result. ... 64

xvi

UMS

(16)

UST OF SYMBOLS

w Angular velocity

(1 Surface tension

p Density

k Wave number

9 Gravitational force

I

Wave frequency T Wave period

A Wavelength

d Water depth

h Height of water surface

Tlt Any given time 'II Kernel function

a Amplitude

p Direction variable q Direction variable

x

X-axis coordinates y Y-axis coordinates

t Time

It Distribution function

et Corresponding velocity vector

U Velocity

Wi Weightage

9L Distribution function v Velocity of fluid G Gravitational force hOff Height offset havg Average height

usurf

-

Water surface velocity

xvii

UMS

(17)

c

m

v

Wave speed Mass

Wave propagation direction

xviii

UMS

(18)

UST OF APPENDIX

APPENDIX TITLE PAGE

A Sample Source Codes for Water Ripple Simulation 70

xix

UMS

(19)

CHAPTER 1

INTRODUCTION

1.1 Preamble

Water ripple also known as capillary wave is a natural phenomenon that occurs whenever an object disturbs the water surface. The displacement of water as the object disturbs the water surface will produce a small scale drcular waves that propagate outwards from the point of impact which possesses the characteristics of transverse waves (Nave, 2011).

The amplitude of the wave will then became smaller which is known as dampening effects as the surface tension of the water and gravitational force which can be ignored as its effect on the wave will be very small will attempt to restore the water surface into its equilibrium state (Kenyon, 1998). Eventually the wave will disperse as the wave propagation reaches some distance from the initial point where the ripple started.

This phenomenon which falls under a much larger topiC which is wave formation is an interesting field of study especially in the simulation part. Water ripple simulation can be implemented into several fields such as video games,

UMS

UNIVERSITI MALAYSIA SABAH
(20)

movies, or just to create simulation of scenery. However, the techniques that are chosen to create the simulation will be different depending on how high the level of details that the developer wants to achieve and the computational cost must be reasonable for the user's computer and graphical tools.

Water ripple simulation is usually implemented to simulate calm water surface reaction when disturbed by an object such as water puddle during rainy day, a fishing line being cast into a lake, a water strider moving on the water surface, or a larger scale ripple phenomenon such as Kelvin Ship Wakes which is formed as a result of a ship cruising on water surface (Loviscach, 2002). All of these may require different algorithm being implemented to create a realistic and believable simulation of the scene. Figure 1.1 shows the natural water ripple that is hoped to be simulated in this project.

Figure 1.1 Natural water ripple (Nave, 2011)

1.2 Problem Background

The basic problem in water simulation is to create an algorithm which is low in computational time but maintains a realistic effect which can be used to simulate water ripple in a variety of situations.

Water surface simulation is a field of study in the area of water simulation in which instead of simulating the entire volume of water, only the water surface is simulated (Drasek III, Bookout & Lake, 2009). Because of the reduced computational

2

UMS

(21)

romplexity, most game developers focus on this field of study to create a realistic water effect which ignores the properties of water below the surface.

One of the techniques that can be used to simulate water ripple is by using height field. This technique is done by moving each point in a mesh that represent the water surface up or down with values that are calculated for each point and stored in an array. This technique is suffident to simulate water ripple but not suitable for breaking waves (Muller, 2008).

Other technique that can be applied is by using particle system. In this technique, the particles are displaced separately with respect to physics based ronstraints. The partides then can be simulated according to the desired motion such as circular motion to simulate water ripple or shoreline waves. This technique is suitable to simulate most fluid conditions and easier to inrorporate interactions between water and floating objects (Yuksel, House & Keyser, 2007)

The curvy appearance of drcular waves also allows us to simulate it by using beta spline technique. This technique requires only small set of control points to ronstruct smooth wave's surface that looks quite realistic (Ts'o & Barsky, 1987).

1.3 Problem Statement

. .

Low romputational cost and realistic water effects are very important especially in the gaming industries. Gamers nowadays demand for more realistic gameplay to provide more immersion experiences to them while they are playing the video games (Oleng & Cairns, 2005). Therefore, to achieve realistic simulation at an interactive frame rate, low computational cost algorithm needs to be implemented.

Through the advance technology of GPU's, this problem is partially solved whereas the GPU's can provide advance rendering to produce much realistic effects for many of the latest video games but soon the computational problems will catch up as the new generation of gamers expectations of what is realistic evolves to a higher level.

3

UMS

(22)

1.4 Aim of Study

The purpose of this study is to simulate realistic 3D water ripple effects by taking the natural appearance of water ripples into accounts.

1.5 Objectives

i. To construct the water surface height field by generating a series of triangle mesh using triangulation technique.

ii. To apply the wave equation onto the height field surface.

iii. To develop

a

prototype of water ripple effect simulation using height field and wave equation.

1.6 Scope of Study

i. Only the water surface behaviour will be simulated.

ii. There will be no external factors such as wind or gravitational force that will be considered in the simulation.

iii. Lighting effect will be Implemented to improve the surface properties.

iv. Only a single water ripple will be created.

v. Wave reflection on the wall will be implemented.

1.7 Justification

This study hopefully will be beneficial to others especially for those whom interested in computer graphics simulation. Creating a simulation of natural phenomenon is an interesting field of study in computer graphics and water simulation is one of the major parts of it. There are a lot of techniques to simulate different types of water surface. Some techniques emphasised on the physical properties of the water surface which involves a lot of computational data to represent the mathematical model of the natural water surface. These techniques are useful especially in the analytical study of water surface.

4

UMS

(23)

Other researchers on the other hand are more interested in the appearance of the water simulation. They focus only on the appearance of the water surface instead of the behaviour of full water volume. Their aim is only to create believable water simulation but with less computational complexity. This water simulation project falls under this category which is done by approximating the natural appearance and simulates only the surface of the water to reduce computational cost.

1.8 Report Organisation

Report organisation will briefly explain about the contents in each chapter.

Chapter 1 is the introduction part which consists of preamble of this project, the background of the problem, aims, objectives, scope of study, and the importance of the development of algorithms to produce realistic simulation of water ripple.

Chapter 2 will be discussing on several techniques that have been developed by previous researches to create water ripple simulation. This is done through the process of literature review. Then a technique will be chosen to be used to create the prototype for this project.

Chapter 3 will be focusing on the methodology of this study. The technique chosen in the last part of Chapter II will be discussed in details in this chapter.

Starting from the planning stage, through the explanation of each step and finally the expected result will be discussed in this chapter.

Chapter 4 will be presenting the water ripple simulation system. Each module that is implemented on the simulation such as lighting, wave generator, drawing and menu will be discussed thoroughly. Sample outputs and code fragments are also presented in this chapter.

5

UMS

(24)

Chapter 5 indudes the implementation of the wave equation onto the height field surface plane. Some analysis will be done to measure the computational romplexity of the simulation prototype.

Chapter 6 is the general condusion of the whole project and the rontribution to the project will be discussed. The future work that can be done to improve the water ripple simulation is also stated.

6

UMS

(25)

REFERENCES

Oleng, K., & Cairns, P. A. (2005). Behaviour, Realism and Immersion in Games.

Portland.

Drasek 111,1. V., Bookout, D., & lake, A. (191une, 2009). Real-Time Parametric Shallow Wave Simulation. Retrieved 2 November, 2011, from Intel Software Network: http://software.intel.mm/en-us/artides/real-time-parametric- shallow-wave-simulation/

Fournier, A., & Reeves, W. (1986). A simple model of ocean waves. Computer . Graphics (proceedings of SIGGRAPH 86), vol.20, 75-84.

Kass, M., & Miller, G. (1990). Rapid Stable Fluid Dynamics for Computer Graphics.

AOf Computer Graphics, Vol 24, No.4.

Kenyon, K. E. (1998). Capillary Waves Understood by an Elementary Method. Journal of Oceanography, Vol54, 343-346.

loviscach, 1. (2002). A Convolution-Based Algorithm for Animated Water Waves.

EUROGRAPHICS 2002 Short Presentations, 383-389.

loviscach, 1. (2003). Complex Water Effects at Interactive Frame Rates. WSCG;

Vol11, No.1, 1-8.

Miklos, B. (2004). Real-Time Fluid Simulation Using Height Fields. Swiss Federal Institute of Technology Zurich.

Muller, M. (2008). Fast Water Simulation for Games Using Height Fields. Game Developers Conference, (pp.t-24). San Franasco.

Nave, R. (2011). Waves On

a

pond Retrieved 1 October, 2011, from Hyperphysics Web site: http://hyperphysics.phy-astr.gsu.edu/hbase/sound/wavplt.htrnl Peachey, D. (1986). Modelling waves and surf. Computer Graphics (Proceedings of

SIGGRAPH 86) vol.20, 65-74.

Schneider,

J.,

& Westermann, R. (2001). Towards Real-lime Visual Simulation of Water Surfaces. VMV 2001, 211-218.

Thurey,

N.,

Rude,

U.,

& Stamminger, M. (2006). Animation of Open Water Phenomena with coupled Shallow Water and Free Surface Simulations.

Eurographics/ACM SIGGRAPH Symposium on Computer Animation (2006).

Ts'o, P. Y., & Barsky, B. A. (1987). Modeling and Rendering Waves: Wave-Traang Using Beta-Splines and Reflective and Refractive Texture Mapping. ACM

Transactions on Graphics Vo/.6 No.3, 191-214.

68

UMS

(26)

Yuksel, C. (2010). Real-Time Water Waves With Wave Particles. 1-221.

Yuksel, C., House, D. H., & Keyser, J. (2007). Wave Partides. A01 SIGGRAPH 2007 Conference (pp. 1-8). ACM.

UMS

Gambar

Figure 1.1 Natural water ripple (Nave,  2011)

Referensi

Dokumen terkait

Validation of ANUGA hydraulic model using exact solutions to shallow water wave problems.. This article has been downloaded

This research focused on the flushing of high water surface or pressure flushing to know in what height the water surface will produce the most effective flushing from

The spectrum energy and wave function of the particle affection in modified Poschl Teller potential are obtained by solving the Schrodinger equation, using hypergeometric

The modified Riccati expansion method and Adomian decomposition method were applied to the weakly nonlinear shallow water wave equation for constructing the exact traveling and

ABSTRACT Hydroelectric power plant PLTA is a generator that utilizes the flow of water discharge and the height of the water fall to produce electrical energy, but the results of

2 The general Poincar´e-Rossby wave equation and the low frequency Rossby wave The linearised shallow water equations in a rotating layer of fluid of depthH x, ymay be written Gill,

While other objectives are to simulate the thermal performance of the stratified water storage tank under varying hot water tank temperature and to analyze the charging and discharging

Comparisons of significant wave height a, peak period of regular waves, mean period of irregular waves between miniature wave buoy and wave gauge.. d is the amplitude response transfer