Research on Dynamic Water Surface and Ripple Animation
Автор: Yufen. Feng, Haiyan. Fan
Журнал: International Journal of Information Technology and Computer Science(IJITCS) @ijitcs
Статья в выпуске: 1 Vol. 2, 2010 года.
Бесплатный доступ
Dynamic simulation of waters is a significant research subject, but the research and simulation of the water drops generating ripples is relatively less. The research on the ripples motion is great significance due to the indispensability of it in the special environments. In our research, we study the method of adding dynamic water ripple effects in 2D image on Web page, 3D animation and virtual reality. By the means of shape simulation, we add animation effects for the web page through creating cells of table combined with transparent special effect files of Flash. we achieve the good reality ripple effect by using simple dynamics and kinematic principle to create models in the 3D animation. By using the combination of 3dMax and Realflow software, we achieve more realistic simulation of the effect of dripping ripple. In the virtual reality system, the appropriate algorithm is applied in program to simulate ripples correctly. These methods are applied to different environments and the results are realistic.
Dynamic water surface, ripple animation , flash in web, 3d animation, virtual reality
Короткий адрес: https://sciup.org/15011567
IDR: 15011567
Текст научной статьи Research on Dynamic Water Surface and Ripple Animation
Published Online November 2010 in MECS
Dynamic water simulation is a very significant issue, it is a hot spot of research for the surface reflection, refraction and surface wave effects of the dynamic simulation .With 3D games and the popularity and indepth of virtual reality applications, most of the games and virtual reality software is often the help of dripping ripple effects to enhance the game's friendliness and realism. Achieve dripping ripple simulation, the principle of particle system principle, the principle of light refraction and reflection wave propagation and attenuation characteristics are calculated, and as much as possible to achieve rapid and real display effect. How to simulate the natural phenomenon such as rain, snow, smog and flame is always difficult and important for computer graphics and virtual reality .The dynamic simulation of water surface is a research subject that it has great theory value as well as practical significance. The research of the reflection and refraction of waves has become a hot topic for researchers all over the world[1-5]. The research on the ripples motion is of great significance due to the indispensability of it in the special environments. On the calm and tranquil surface, the ripples will appear unless external objects perturb the water. If the perturbance stops, the surface will became calm again after some time. The wave moving of 2D wave equation is in concert with the phenomena, the literature references put forward a simulation method of ripples on small water surface which creates surface modeling by using the method of Johanson ’s projection grid, solving equation by the programmable GPU technology and simulating ripples perfectly by an appropriate algorithm[6-7]. The literature reference simulates the raindrops by solving 2D shallow water equation which describes flow phenomenon through SPH method, using the distortion form of Mon-aghan artificial viscosity according to the concrete model[8]. In the paper the drip ripple effects produced based on GPU ,Xia Yan used three optimization methods ,they are some approximation methods , simulating 3D effects by 2D bump texture and writing shader programs, he produced the described methods of ripple effects [9].In this paper we research on the method of adding dynamic ripples in 2D image on web page, 3D animation and virtual reality system. The simple dynamics and kinematic principles are applied in the 3D animation to simulate the ripples reality. In the 2D image on the web page and the virtual reality system we just used shape simulation effects but not complex physical models for the ripples effects. These methods are simple and practical, the effect is very vivid and realistic. These can be used for a variety of scenarios need to ripples or waves, such as rain water, pond or lake with fountains, etc.
-
II . RESEARCH OF RIPPLE EFFECTS IN 2D ENVIRONMENT
-
A. Flash animated raindrop ripples
In some wonderful films we often see the effects of the slightest rain which giving a warm and romantic feeling. When a piece of stone is thrown into the pond, water surface ripples are spreading around, the ripples in a circular form will get bigger and bigger and fade away slowly, the water will restore calm soon. According to this natural phenomenon, we simulate raindrops the ripple effects falling from the air into the river with flash software.
First we produced the formation of ripple effects of rain falling on the ground . Create a new movie clip symbol which is named ripple, open the editing area of the movie clip symbol, use the ellipse tool to draw a water cycle of circle round and fill gradient. Add some codes of action scripting language for the water cycle. The codes are as follows:
// Effect Codes , 1 is the static wave,2 is fluctuation code = 1;
n_a = 45; // amplitude factor v_a = n_a;
n_a_n = 8; // static volatile factor n_a_random = 100; // fluctuation amplitude factor scale = 20; // scaling factor n_scale = 10;
v_scale = n_scale;
n_alpha = 1; //alpha facto v_alpha = n_alpha;
mc._visible = 0;
i_max_random = 0; // the maximum number of factors water cycle i_max = random(i_max_random)+10;
i = 0;
time_max_random = 20; // copy the interval factor time = 0;
time_max = 8;
time_sin = 0; // still time factor volatility mc.duplicateMovieClip("mc"+i, i);
// create a new attribute s, the volatility factor this["staut"+i] = new Object();
this["staut"+i].s = 0;
i++;
onEnterFrame = function ()
{ time_sin++;
if (time_sin>360)
{ time_sin = 0;
} // hydrosphere copy the codes if (i if (time>=time_max) { time = 0; mc.duplicateMovieClip("mc"+i, i); this["mc"+i]._xscale = this["mc"+i]._yscale=scale; this["staut"+i] = new Object(); this["staut"+i].s = random(180); this["staut"+i].a = random(n_a_random)+n_a_random; if (code == 1) {this["mc"+i]._y } i++; } } // Hydrosphere zoom codes for (j=0; j<=i_max; j++) { this["mc"+j]._xscale= this["mc"+j]._yscale += v_scale; this["mc"+j]._alpha -= v_alpha; if (code == 2) { } // Initialization if (this["mc"+j]._alpha<0) { if (code == 1) {this["mc"+j]._y= } this["mc"+j]._alpha = 100; this["mc"+j]._xscale = this["mc"+j]._yscale=scale; this["mc"+j].swapDepths(i++); } } }; stop(); Second we created a movie clip symbol showing the raindrops dripping from above to the water surface and disappeared into the water ,and named the movie clip of the name as raindrop, the symbol of ripple and the symbol of raindrop were merged together to create a movie clip symbol named drop ripple. Finally, in the main scene ,create a instance named raindrop1, and add the following actions scripting languages: // define and initialize variables n = Number(n)+1; //continue to reproduce the object raindrop1 duplicateMovieClip("raindrop1", "", n); Add action in frame 2: gotoAndPlay(1); Fig. 1 shows the number of raindrops falling into the water produce ripples and ripples overlap. Figure 1. raindrop and ripple. B. ADDING RIPPLES IN IMAGE ON WEB PAGE In the web page, some photos and rendering pictures are used frequently to make beautiful picturesque scenes that the green glass looks like a carpet, the bouquets of flowers are a mass of blossom, the lake and the hills add radiance and beauty to each other, the mountains are clear against the sky and the waters is very bright. In most cases, the water is flat. If there are some ripples and waves on the water surface, it can make the whole web page full of variety and lifelikeness .When we process the picture, a method which can combine the effective ripple file of Flash with the picture is adopted to achieve the good reality ripple effect. First distribute the resource files of Flash, convert .fla format file to .swf format file. Then create a table in the web page, take the .swf format file as background of the table, the table size can be adjusted by the picture size, create cells in the table, insert the ripple special files in the appropriate cell, set the background color of the ripple animation to be transparent. The animation file can be used in the whole table, we can insert several ripple files in a table, too. Fig. 1 is ripple animation effect in Flash file; Fig. 2(a) is a photo with two fountains. Here are some resource codes after inserting Flash file in the cell on web page. AC_FL_RunContent( 'codebase',' on=6,0,29,0','width','200','height','120','align','absbottom',' src','image/lyxg','quality','high','pluginspage','http://www. ', 'movie','image/lyxg' ); //end AC code
The ripple effects animation file is called lyxg.swf, the file is in the image directory of the website. We use the transparent ripple effects animation file by inserting the sentence ‘‘wmode ’,’transparent’ ’before the sentence ‘'movie',' image/lyxg'’. The codes after the modification are as follows.
AC_FL_RunContent( 'codebase',' on=6,0,29,0','width','200','height','120','align','absbottom',' src','image/lyxg','quality','high','pluginspage','http://www. ', 'wmode','transparent', 'movie','image/lyxg' );
//end AC code

(a) Photo of lake

Figure 2. (b) Adding ripples animation
Fig.2 (b) is a picture added the dynamic ripples which will increase vigor for the web page.
-
III. THE KEY TECHNIQUES OF DEVELOPMENT OF RIPPLES IN 3D ANIMATION
The realistic water effect is a bit complicated in 3D animation. In a large water surface such as sea ,ocean , lake or broad river in the scene, the DreamScape of 3D Max landscape plug-in can be used and can generate the reality effect including the dynamic phenomenon such as foam and wavy etc. And the rendering speed is faster. When some objects drop to water surface, if you want to show the collision between the objects and the water, the reactor dynamic system in 3D Max can be used . To show rain or fountain effect we can use the super spray particle that the direction of injection is down under the action of gravity space warps and add some motion blur. If you want to show the details, the fluid dynamics simulation software RealFlow can be used. It can accomplish the projects which include the objects arousing waves, fluctuating with water, splashing, generating some ripples after the particles falling into the water, and producing wake by the rapid movement objects, spray and waves. It is used to simulate the sailing ships usually. The paper studies the general ripples, we can show the effect directly by the material, modifying the reflection and refraction coefficient, adding noise bump map to response the slight wave on surface, binding water into ripple space warp and modifying the correlative parameters in order to generate ripples animation effects[10-11].
-
A. Relative model
The surface is the plane divided into many small segments. There are more detailed segments; there is more realistic ripple effect. However, there are more surfaces, the rendering is slower. Therefore, we should consider the actual situation roundly to determine a reasonable value of segments. We Create a ripple space warp for generating ripples, the parameters of wavelength, amplitude, phase, and display should be modified according to the specific scene. Droplet model can be considered from two cases. First if the sense of reality is emphasized, the method which make a simple sphere bound to a FFD space warp can be used to simulate water droplets precisely by modifying the control point. Second, if the droplets model is too complex, it can affect the speed of animation rendering in the droplets too many cases, so we can use the multi-faceted sphere to simplify the droplet model, the noise space wrap can be added to the sphere ,then we change the shape by modifying the ratio , intensity and phase parameters to avoid the same shape of sphere in a large number of water droplets .

Figure 3. Water surface and droplet model
-
B. Lighting and Materials
Water is a transparent liquid basically, but water color of the rivers and lakes is affected by many factors, such as the intensity and color of external light, the depth of the water and the impurities of the water. All of the external factors affected the effect of the reflection and refraction of the water directly. And the reflection and refraction of the water is the key to describe the real surface. In the 3D software, we can set the surface material to adjust the reflection channel to add the falloff image, set the glossiness, set the subdivs, set the refractivity, and set the fog color to adjust the color of the water to change the parameters such as the fog multiplier. So lighting and material setting are the key factors to the realistic dripping and ripple animation, VRay is a small plug-in launched by the famous 3D max plug-in provider Chaos group, but it is a extremely powerful rendering plug-in. VRay lighting type is very rich, it provides the sun lighting, the sky lighting and VRay lighting, the user can use the standard lighting and photometric lighting in 3D Max, too. In the indirect lighting, you can set the parameters such as global optical caustics, global Light color, Quasi-Monte Carlo Global Light and light rebound etc to control scene lighting effects. VRay renderer provides a special VRayMtl material. Using the material in the scene can get a more accurate physical lighting, a faster rendering speed, a more convenient parameter adjustment of reflection and refraction. The different textures can be applied to control the reflection and refraction, adding the bump map and displacement map. In our research, the water material type is VRayMlt , this material should be reflective, the diffuse parameter controls the reflection effect of material, the Degree of the reflection controlled by the color of diffuse, the white color means the strongest reflection, the black means no reflection ,so we need to give the ideal reflection to water

Figure 4. Setting the water material parameters surface. The refract parameter controls the refraction effect of material, that is the transparency of the water, as with the refraction white means that the water is completely transparent, black means the opaque. Usually we set the refract color of the pool water material as white, revise the refractive index to 1.333, add noise in the bump map to show the microwave of surface effect , adjust the value of the right size and bump, add the falloff in the diffuse map to show the color change in the near and far surface. In addition, we can adjust the fog color to change the water color.
-
C. Animation implement
We can create large droplets by super spray in particle system; the particle type is solid geometry. Selecting the droplets as picked objects in the instance of the parameter in the dialog box, modify the axis offset and plane offset in the particle distribution dialog box, adjust the value of particles number and particle generation time and particle velocity and particle size in the particle generation dialog box . To enable the droplets landing, create a gravity space wrap in the position nearest the ground. The droplet model is bound to gravity space wrap, modify the intensity of gravity, the droplets are ejected to the surface and drip to water at a ideal speed. When the droplets are dripping onto the water, the ripple will be generated on the surface. The effect need to bind the surface models to distort the ripple space wrap, press the auto key button again in key frame which the water droplet is dripping. Then find the frame in which the ripple disappear, modify the value of the phase, so over and over again, until satisfied. Finally render output, and generate animation file.
Fig. 5 is a picture in the animation file, we can see the drippings and the water ripples on the surface clearly.

Figure 5. Droplets and ripples effects in animation

Figure 6. Modeling in Realflow
-
D. RealWave in RealFlow and simulation of ripple
RealFlow is a very good simulation of fluid computing software, RealWave dedicated to simulation of surface waves, such as sea water after an object thrown into ripples, driving the boat in the water (including waves and the spray of particles thrown water and drag generated tail). The project completed include: the object falling into the water after the waves stirred up and up and down with the water, but also generate splash; particles float to the surface of the ripples on the water fall; in the fast moving objects on the surface of the water generated wake, spray and waves, commonly used in the simulation of vessels; performance of dynamic, natural fluctuations in the water, such as lakes, ponds, oceans, waves splashing the shore can also produce water spray effects.
In Realflow software we add a Realwave entity to the scene to simulate water. By adjusting the parameters of scale and polygon size of the surface water to determine the precise extent of the model. Rain drops can be simulated by creating a simple sphere, the dynamics property of the sphere is set to rigid body, the daemon of gravity is added in the scene ,so the rain drops will fall in the water under the action of gravity. In order to create some small sprays when when the raindrops are thrown into the water, we need to add Rw_splash particle emitter in the scene. The raindrop spheres are specified for the objects of the Rw_splash , so that water droplets will splash when they are falling to the water surface. the size and number of spray can be determined by adjusting the parameters of Rw_splash. To make ripples on the water better, you can add control points on the real wave, set the control point parameters, such as frequency, amplitude, begin time, cycles and wave speeds etc. After regulation in the simulation ,the particles or the grid objects are exported to other mainstream 3D software from RealFlow software for lighting and rendering.
Fig. 6 is the simulation results in Realflow,Fig.7 is the rendering after export.

Figure 7. Rendering after export
-
IV. RESEARCH OF RIPPLES ANIMATION IN VIRTUAL REALITY SYSTEM
Virtual reality technology is a human-computer interacting technology which can simulate the human behaviors such as the visual, auditory, tactile and motor etc. Immersion, interaction and imagination are the main features of it. The ripple effects simulated in is off-line and non-real-time. In the first two application environments, virtual reality environment is different, it emphasizes the interactive and real-time. When a person goes into the virtual system, it seems that he involves in real environment. If there is a fountain in the lake, the user should be able to control the switch of the fountain. To experience some special effects in the virtual environment, users may add rain, snow and other natural phenomena to change the weather. In the paper we studied the effects of droplets and ripples in virtual reality system based on Virtools.
-
A. Implement of water surface,droplets and ripple
We can simulate the surface and generate more accurate reflections and refractions through adjusting light intensity and colorimchy by lighting and perturbing 2D texture mapping with normal mapping. A shader program in Virtools had been written and applied in virtual reality project. In the actual operation the effect is real and the rendering speed had greatly increased. Droplets generation is achieved by particle systems. According to the different condition of the launching Virtools provide us with nine particle system. In the paper we use a plane particle system to get the drippings in the natural environment by adjusting the particle rotation angle ,the particle velocity, the particle life cycle, the particle emission, and the particle size parameters.
The basic shapes of ripples are simulated by mapping the transparent texture material to 3D entities, when the droplet is falling, we will test whether it has a collision with the surface. If the collision happens, we will obtain the coordinate of the collision point. At this point we create a 3d entity with texture of ripple and assign the initial value of the entity size and the transparency of the material. Then we amplify the entity by a certain coefficient. At the same time, reduce the opacity of the material, when the ripple entity amplifies to a certain extent, the transparent coefficient will reduce to zero, the ripple disappears and the water becomes calm again. Finally, the ripple entity is deleted from the scene. This simulation method is not only simple, but also it is not high demand on the system resources. The animation effect is very realistic. Fig. 8 is the algorithm flowchart of ripple implementation procedure.

Figure 8. The algorithm flowchart of implementation
B . shader shader in virtools
With the GPU computing capabilities and the development of high-level shading languages, the vertex shader, pixel shader, the normal vector calculation and the dynamic fluctuations in the water, reflection and refraction of the operation can be completed by GPU. Virtools is a rich interaction module of real-time 3D virtual scene editing software. It can produce many 3D products with different uses[12]. Virtools support senior rendering language of DirectX9 fully. Virtools develops a shader reference, all kinds of usages and the value of the state parameters can be seen[13]. Writing programs for each shader is that some parameters are filled in, these parameters can be filled in material properties page and can be filled by BB( Building Block). A shader program can contain one or more techniques, but there is only one technique applying to render materials. Each technique may contain one or more passes, each pass execute sequentially according to their order defined. Each vertex and each pixel is executed in every pass in order to complete different purpose of render[14].
It is mysterious for us that one can obtain the intuitive visual feedback of code by shader programming at once. You can also realize a tree sway with real-time dynamic swaying effect of a leaf on the lake by shader programming. But it needs to consider the necessity using shader in order to utilize the computer system resources rationally.

Figure9. The shader editor interface in virtools
-
C. effect of implement
The algorithm has implemented by writing a program in the Virtools. Virtools is a real-time editing software with many rich interaction modules for 3D virtual reality, real 3D virtual reality editing. It can produce many 3D products with different uses, such as the Internet or computer games, multimedia, architectural designs, interactive television, education and training, simulation and product display [15-16]. In the paper, we increase the size of ripples intentionally to see the ripple effects clearly. When the viewpoint is close, we can reduce the physical size of the ripples. If the droplets generate intensively, the ripples will interfere with each other, so we only observed the emergence and disappearance of two ripples in the experiment, the effect is true and the speed is faster in running.

Figure 10. The effects of ripples in virtual reality scene
V. CONCLUSION
In the paper we use the method which can combine the effective ripple file in Flash with the table cell in web page. It is simple and general and can add animation effects for web page quickly and flexibly. In 3D animation environment, we create models by using simple dynamics and kinematic principle, using VRay lighting and VrayMtl. Water droplets model is generated by a particle system. The water surface is a plane with many small segments, it is bound a ripple space wrap, we adjust phase and wavelength of ripple on different key frame. In virtual reality system, we show the reflection and refraction of water by writing shader program, apply the shape simulation method to realize the effect. The method is simple and the effect is true. But its weakness is that the ripples size should not be too big and the number of water droplets should not be too much. These measures could offer a reference for the users who want to realize ripple animation in different environments.
Список литературы Research on Dynamic Water Surface and Ripple Animation
- Zhao Ping ,Chen Dingfang,Jiang yun. “The application of shader in the development of visual scence based on Cg”, Journual of Hubei University of Technology,Jun. 2007,Vol. 22,No. 3, ,pp.65-67(In Chinese).
- Cheng Yongxin,”The research and implementation of the large water surface realtime render and scene management” In 3D Engine,Master Dissertation,University of Electronic Science and Technology of China,2009.4 (In Chinese)
- Tan Xiaohui,Wan Wanggen,Yu xiaoqing,Cui Bin , “Real time simulation of large scale water surface based on GPU” in Computer Simulation., May. 2009, Vol. 26,No. 9 pp.211–214(In Chinese).
- Wang Daochen,Wan Wanggen,Tang Jingzhou,Chen Huajie.”Real-time rendering alogrithm for water surface based on GPU” in Computer Engneering,Oct.2008, Vol. 34,No. 20, pp.233–237(In Chinese).
- Zhang Long,Zhang Yubo,Chen Wei,He Jian “Real-time simulation of dynamic wetland scence” in Journal of Computer-Aided Design&Computer Graphics, Aug. 2008, Vol. 20,No. 8,pp. 1007–1010 (In Chinese).
- Cheng Tiantian,”Research on dynamic water scene modeling method for Tai Lake water area.”, Master Dissertation ,Suzhou University,2008.4(in Chinese)
- Lu Weiliang,Cheng Tiantian,”The simulation method of ripple on small waters”in Computer Engineering and Applications, Apr.2010,Vol. 46,No.19,pp.193-195,199(In Chinese).
- Li Yumei,Wang Jiwen, “Simulation of ripples based on smoothed particle hydrodymatics method” in Computer Technology and Development,May 2010,Vol. 20,No. 5,pp.56-58,62(In Chinese)
- Xia Yan, “Dripping ripple effects production based on GPU” in Computer Application, May 2007,pp.62-64
- Han Liang,Wang Wenyong,.”The rain simulation of virtual reality Scene based on particle system” in The Proceedings of the 14th National I Image & Graphics Academic Conference,2008 (In Chinese)
- Chen Qianhua,Deng Jiansong,Chen Falai. “Simulation of ripples” in Journal of Computer ReSearch & Develoption.May 2001,Vol.38,No.5,pp.524-528(In Chinese).
- Frank D.Luna Introduction to 3D Game Programming with DirectX 9.0 ,Copyright 2003 by Wordware Publishing.
- Fu Zhiyong ,Gao Ming, Three Dimensional Game Design by Virtools Dev 4.0,Beijing:Tsinghua University Press,(2008).
- Wang Dandong,Xu Yingxin etc.in: Treasury of Knowledge of Designer on 3D Game,edited by Ceap Electronic & Audiovisual Press(2009)
- Fu Zhiyong ,Gao Ming, Three Dimensional Game Design by Virtools Dev 4.0,Beijing:Tsinghua University Press,Oct.2008(In Chinese).
- Wang Dandong,Xu Yingxin,Xu Lin.Treasury of Knowledge of Designer on 3D Game,Ceap Electronic & Audiovisual Press,May 2009(In Chinese).