How should we represent leaves in 2D games?
MODULE CODE: COMP40321
MODULE TITLE : Research Methods
MODULE LEADER : Dr Wanqing Tu
SUPERVISOR: Dr Graham Tranfield
COURSEWORK TITLE : Assignment 1 Literature Survey STUDENT NAME : Yifan Song
STUDENT NUMBER : T2244939
DISTRIBUTION DATE : 22nd,April,2013
SUBMISSION DATE : 24th,May,2013
SUBMISSION METHOD : via NOW dropbox and hard copy to desk on the Ground Floor of ERD
WORD COUNT : 2552
PAGE COUNT: 8
How should we represent leaves in 2D games?
Section 1 - Literature survey
When autumn and winter comes, we can see leaves falling from trees everywhere. They swaying, rotating, fluttering and twisting with complex trajectories. These kinds of interactions between leaf and wind lead to complex behaviors of falling leaves. It is difficult to simulate this nature scene in games and animations since the research is ongoing. This project would try to build a simulation system of falling leaves, which is also one of the big challenge in computational fluid dynamics filed.
T.Aoki et al (2004) states the difficulties of this problem are “the strong interaction between the leaf and the air flow, the moving boundary of the leaves, the elastic deformation and so on.” This statement is highly accurate for this particular problem; however, it may be exceed my ability for this project to solve all those difficulties.
Pere-Pau and Marcos (2008) illustrate there are three objects should be achieved for this problem. Firstly, paths of falling leaves must be visually pleasing and natural, which means the simulation should presents a similar feeling as real scene does. Secondly each leaf must fall differently, which request each leaf computes its own trajectory to mimic the real leaf falling. Thirdly, computation cost and memory cost should be relatively low. Since personal computing devices are used to handle this kind of task, the low computation and memory cost is necessary while the performance of system should be satisfactory.
My project objects would partially follow objects declaration of Pere-Pau and Marcos. The obvious object one is simulate a plausible falling trajectory of leaves. During the falling, leaves would rotate, twisting or swaying which leads to the simulation shape of leaves transformed. Hence, the shape transformation of leaves based on frame and time changing should be explored. To successfully perform this project, the feasibility and cost of solutions will also play an important role.
As a student in multimedia field, I wish to develop a flash game in near future. In the game design, it is supposed to be a competition game that allows two users play together. The idea of the game is comes from my childhood memory, when I was a child, there was a popular game that requires two participants to use tree leaf to beat each other. Leaves’ falling is supposed to be a part of animation in this game design. In the author’s knowledge, there are no naturally leaves falling simulated for 2D games. Hence, this project is introduced to fill in the blank.
Besides, falling leaf is a type of challenge researched in aerodynamics and hydromechanics. (Paul and John, 1996) It is also related to subjects like virtual reality, game scene, animation and so on. The widely usage of falling leaves motivated the implementation of this project a lot. Except for its direct usage, the research result may also useful for others in related area.
This project would produce a falling leaves simulation system that consists of naturally falling path and shape transformation.
2. Literature review
This section would outline opinions of variety of authors that works in related area. More discussions would be delivered later.
2.1 Virtual reality
According to the Wikipedia explanation, Virtual reality (VR) is a term that use computer to simulate the physical presences of real world scene. (Wikipedia, 2013) Brooks (1999) defined the VR as a technology that makes user effectively immersed in a responsive virtual world. Both of them tells the nature of VR, it simulates the real world in virtual environment and brings up immersive experience for users.
In game design and animation, the importance of immersive experiences is raised up recent years. Users expected more on this kind of experience. As we know, 3D movies and 3D games exploded in these industries. The falling leaves represents a basic implementation of VR technology – the immersive environment simulation. The simulation of real world scene makes users trust and accept what they see in low mind level. To catch up with the development of VR technologies, this project would refer to existing products in industry.
2.2 Navier-Stokes equations
The Navier-Stokes equations, which named after Claude-Louis Navier and George Gabriel Stokes, are equations that describe the motion of fluid. As mentioned before, the falling leaves phenomenon can be define as the interaction between leaf and air flow. Hence, Navier-Stokes solutions are useful when solving this particular fluid problem.
Newton’s second law is applied to fluid motion to arise these equations. The general equation is shown as below.
Navier–Stokes equations (general)
where v is the flow velocity, ρ is the fluid density, p is the pressure, is the (deviatoric) component of the total stress tensor, and f represents body forces (per unit volume) acting on the fluid and ∇ is the del operator.
The Navier-Stokes equations can be used in games physical phenomenon as well. Simulations of small-scale gaseous fluids, such as fire and smoke are often appear in variety of games. It has to mention that those equations only admit simple case solution analysis. (Stam, 2003)
2.3 Review of Trajectory Construction
The trajectory of a falling leaf consists of a set of positions and orientations that ordered by frame or time. One of the goals is constructing nature falling trajectories for leaves. Here, what mainly found is for 3D scene， even my object is for 2D simulation. The research in this area is boosted after 1990, which mainly concentrate on 3D as no plain 2D related information found there. However, as human viewport, only a 2D image would be presented on the screen. Hence, It may use 3D simulation on the mathematical part and present it as 2D image per frame on the display.
Pere-Pau and Marcos (2008) introduced two methods to construct the path of falling leaves: 1) Capturing real time information from real world, 2) Simulating the motions of leaves based on physical algorithm. For the first method, it is considered to be high material cost and may cost more if a universal scene required to capturing. Especially, the required camera, which capturing the fast movement of leaves, is expensive. Hence, the second scheme is more realistic both for them and me. However, retrieve real data from nature and training those data to get more precise falling path could be a better choice when it is affordable.
Jin and Xu (2008) argues that falling objects like leaves, tree seeds and paper cards all fall along a complicated trajectory based on the effect of gravity and fluid flow force. In fact, leaves and paper that tumbling always reverses their downward direction, sometimes rising deny the gravity. To explore this natural phenomenon, a description of the instantaneous fluid force as well as the inertial and gravity influence should be clearly presented. It is difficult to calculate all force effect for each leaf in personal computer, which would be the experimental machine in my project. Also the goal of my project is to produce a reusable real world simulated falling leaves, it should be implementable in others’ project or games. Hence, just a plausible trajectory calculated is enough to handle this task and not much computation required.
Li et al (2010) explored a cheap and understandable way to generate the trajectories of falling leaves in animation films. They collected leaf falling clips from some animation films and constructed example database for the trajectories and postures of leaf. The postures of example leaf are stored as vectors based on time frame: L(1),L(2)…L(t). Each L contains a point set that describe the shape of leaf, which consists of leafstalk, midrib and margin. According to motion details, the trajectories are divided into 5 types: none, flutter, tumble, spiral and chaotic. Users select detailed example trajectories and input customized movement trend as well as new sketch of leaf, then the new falling leaf motion would be generated by their method. As follow Figure 1 shown how the generation is performed.
(Figure 1the example-based motion generation of falling leaf)
The synthesis method of Li et al reminds me that maybe only one example trajectory of falling leave should be constructed. Trajectory modification could be implemented in analogous way. Modified trajectories would be attached to each falling leaf to retrieve a natural autumn scene. It point out a lot about leaf shape transformation as well.
The center of mass elevation is another important factor that influence the trajectory. Figure 2 shows two different trajectories that have different values of the translational and rotational lift coefficients. It can be clearly observed that center of mass elevation occurs in (a) and absent in (b). Even (a) and (b) apply the same start position and posture; the whole trajectory is still different. (Umberto and Wang, 2004) From this figure, it is also clear that, the posture of a falling object and the trajectory are inter-related and influenced by each other, which implies that real time simulation need to think of the situation as a whole observation system and calculate each factors separately.
(Figure 2 trajectories obtained with different translational Cl and rotational lift Cr coefficients (a) Cr= 2.6, Cl =0.49; (b) Cr = 0, Cl = 1.5)
2.4 Review of Posture transformation
The shape of a typical leaf can be explained with figure 3 below. It consists of a leafstalk and a leaf surface. The leaf surface can be constructed by knowing its midrib, tip and blade shape. If we consider leaf as rigid, which means its shape maintains during falling, the Posture transformation is simple to calculate the rotations around each axis. If we consider the leaf as non-rigid body, which means the shape of leaf is changing related to the force handled, it needs to calculate the shape of leaf at certain time and compose with the posture of leaf at the same time.
(Figure 3 a simple ketch of leaf)
The logically easiest method to construct a non-rigid leaf posture at certain frame is sketching. The different shapes of leaf could be sketched at first and the synthesis of leaf shape and posture is the result image of a specific frame. Li et al (2010) used this non-mathematic way to generate a new falling leaves system. No thesis has been found as discussing the real time simulation of non-rigid leaves falling yet.
The problem of rigid leaves falling is that, when a leaf gets to its end of trajectory, the leaf may break into the ground plane with a straight posture or remain the last posture on the ground. If the ground covered by grass, it is fine that no one will notice it, but for empty ground, it lies obviously unnatural. The strategy is interpolating the natural lying posture just before leaf arrives to the ground. Some more posture could be interpolated properly to optimize it. (Pere-Pau and Marcos, 2008)
2.5 Languages and Tools
ActionScript 3.0 is an object-oriented programming language that used to build complex flash application. It is the only programming language that I have grasped yet. Different to OOP languages like java and c++, in ActionScript 3.0, objects are simply collections of properties. These properties are containers that can hold not only data, but also functions or other objects. If a function is attached to an object in this way, it is called a method. As a starter of programming, ActionScript 3.0 is more understandable to me.
Pere-Pau and Marcos used OpenGL with c++ which looks pretty well in their project. OpenGL(Open Graphics library) is a cross-language and cross-platform API for 2D, 3D drawing. The robust rendering ability allows it to be widely used. However, AS3 added limited support for hardware acceleration like DirectX and OpenGL. Another difference is that ActionScript does not translate to machine language, so it's less powerful. Flash movies are loaded in the RAM, which would be high hardware cost if the system implements lot of graphical rendering.
MAYA and 3d MAX are graphic model software that robust to build 3D models. The 3D model of leaf may be sketched with them. 3d MAX provides powerful physic engines to simulate variety of physical scenes. MAYA and 3d MAX could be used for initial construction and observation of falling leaves.
Adobe Flash Professional is the main editor and test program for this project. It provides full support to AS3. Although there are plenty of tools for creating the Flash content, such as Flash Editor, SwiSH and ViewletBuilder, Flash Professional is always consider to be the most popular and user-friendly one.
Section 2 – How I undertook the task.
To perform the literature survey, variety of searching schemes has been implemented. Initially, I just search the key words, like falling leaves and simulation, in the Google Search. The return page mixed with plenty of forum discussions or irrelevant information. After searching attempts of different combinations of key words, few documents that looks useful catches my eyes. Those documents have been downloaded and roughly read to determine its usability. When reading papers, more specific problems details that was ignored before has risen up. Hence, more key words like fluid flow, falling leaves rendering, have been implemented in literature searching. The amount of search result gradually grows up.
The searching terms that are useful: Fluid flow and falling leaves, trajectory of falling leaves, simulation of falling leaves, falling papers, ActionScript, tools for flash, tools for animation, and pdf.
The searching terms that are not useful: Falling leaves in games, path of falling leaves, autumn leaves falling, autumn scene.
There is an extremely efficient method to connect to a related paper – find references in reference. A useful reference paper would contribute several useful references with the same term. However, sometimes it is common that only few academic works widely cited by others. Wikipedia could be a useful tool for general explanation of professional terms as many understanding of terms mentioned above are from it.
Google Books, IEEE Explorer and the school eBook system is the main databases that I used to do literature searching. Google Books returns the most relevant results, for example journeys that contain Aoki’s paper. However, some important contents are not visible for me unless payment sent. IEEE Explorer is quite efficient to find documents that you already know the title. The school eBooks returns the most irrelevant result. I have also tried to search in tangible library. Papers found in library are either out of date to be referenced or mentioned limited information that I need. There is no doubt that Google Search gives the optimal result.
When doing literature review, some problems have been noticed. For example Aoki used the same result of simulating of falling paper in “Falling paper simulation”(Aoki, 2001) and “Fluid-Structure Interaction of a Falling Leaf Solved by IDO Scheme Using Intergrid and Overset Grid” (Aoki, 2004), few more discussion of falling leaves has been mentioned in the latter. Duplicated information repeatedly appears in variety of documents, like Li et al (2010) published two papers with almost the same content. References that listed in this assignment are most useful and relevant ones. Most papers are talked the falling leaves problem in a mathematical way, which is difficult to understand for a person not work in that area. Even the same mathematical representation, different authors have different background may represent it with Non-uniform format and symbols.
T. Aoki(2004).Fluid-Structure Interaction of a Falling Leaf Solved by IDO Scheme Using Intergrid and Overset Grid; Proceedings of Sixth World Congress on Computational Mechanics in conjunction with Second Asian-Pacific Congress on Computational Mechanics, 187-192
T. Aoki(2001)."3d simulation for falling papers",In Computer Physics Communication, 142:326–329
Pere-Pau Vazquez and Marcos Balsa (2008).Rendering Falling Leaves on Graphics Hardware. Journal of Virtual Reality and Broadcasting, Volume 5, no.2. Available from: http://www.jvrb.org/past-issues/5.2008/1295/520082.pdf. [Accessed: 18th May 2013]
Paul T. Jaramillo and John Ralston (1996).Simulation Of the F/A-18D "Falling Leaf".Bihrle Applied Research, Inc. Hampton, Virginia 23666. Available from: http://www.bihrle.com/pdfs/aiaa96-3371.pdf. [Accessed: 19th May 2013]
Brooks Jr., F. P. (1999).What's Real About Virtual Reality?. IEEE Computer Graphics And Applications, 19(6), 16. Available from: http://www.cs.unc.edu/~brooks/WhatsReal.pdf. [Accessed: 19th May 2013]
Assignment 1 Literature Survey 作业代写
Wikipedia (2013).Virtual reality. Available from: http://en.wikipedia.org/wiki/Virtual_reality. [Accessed: 19th May 2013]
Changqiu Jin and Kun Xu (2008).Numerical Study of the Unsteady Aerodynamics of Freely Falling Plates. Communications in Computational Physics, Vol.3, No.4, pp.834-851. Available from: http://www.math.ust.hk/~makxu/PAPER/Jin-Xu.pdf. [Accessed: 19th May 2013]
Li Haiyan, Sun Qingjie, Zhang Hui and Zhang Qin (2010).Example-based motion generation of Falling Leaf. 2010 International Conference on Computer Design and Applications. Available from: http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=05541287. [Accessed: 19th May 2013]
Li Haiyan, Sun Qingjie, Zhang Hui and Zhang Qin (2010).Example-based Stylized Trajectory Synthesis of Falling Leaf. 2010 International Conference on Computer Design and Applications. Available from: http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=5485603&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D5485603 [Accessed: 19th May 2013]
Stam, Jos (2003), Real-Time Fluid Dynamics for Games. Available from: http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf. [Accessed: 20th May 2013]
Umberto Pesavento and Z. Jane Wang (2004). Falling Paper: Navier-Stokes Solutions, Model of Fluid Forces, and Center of Mass Elevation. Physical Review Letters, Vol.93, No.14. Available from: http://dragonfly.tam.cornell.edu/publications/2004_PRL_Pesavento_Wang.pdf [Accessed: 20th May 2013]