CSc 471 – Graphics Final Project

Wind Blown Tree – Particle Simulation

Ryan Weiss

 

Description | Implementation | Compilation Instructions | Usage Instructions | Screenshots | References

 

Description:

Trees (in nature) are a common challenge to implement realistically in computer graphics. This program generates a simplified tree that might not be geometrically rendered realistically, but aspects of its movement are indeed realistic according to a user-specified wind vector.

 

Implementation:

In particular, this particle simulation makes use of a pretty generalized particle class that contains mass, position, velocity, and force information about each particle in the system. Additionally, the program utilizes a set of functions and structures that comprise an ordinary differential equation (ODE) solver and contain information about individual forces and how they are manipulated and applied to particles with different properties. The Wind Blown Tree Sim considers the following forces as applied to some or all of the particles in the system:

 

-         wind force (a constant applied force)

-         gravitational force

-         drag (equivalent to air resistance)

-         spring force (uniformly for the top of the trunk and leaves attached to the tree)

 

The above forces have the following affects on “particles” in the system:

 

-         The tree trunk shears a certain amount depending on the magnitude and direction of the wind vector. It is handled like its own particle and restrained by spring force and drag.

-         Gusts of wind will cause the tree (leaves and top of trunk) to bounce/oscillate slightly until achieving equilibrium.

-         When the wind magnitude increases beyond magnitude + or – 40, leaves begin to peel from the tree, feel the affects of gravity and drag, but are no longer restrained by the spring force caused by being attached to the tree.

 

Compilation Instructions:

This program must be compiled with the following linker parameters in DevC++:

 

-lglui -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -lstdc++

 

Follow the instructions here for compiling in Microsoft Visual Studio:

 

http://www.css.taylor.edu/~btoll/resources/graphics/opengl/xp/visualc.html

 

Usage Instructions:

GLUI is used for the user interface to manipulate the wind vector and other interesting physical properties. In general, just experiment with the tweakable values in the GLUI window. Specifically, these values have the effects mentioned below:

 

-         Wind is the applied wind force vector (- values for right, + for left).

-         Gravity is the acceleration due to gravity (no particular units).

-         Drag is equivalent to air resistance.

-         Leaf density is the number of leaves in the scene. You can add leaves to the tree by increasing this number.

-         Stem strength essentially determines frequency of leaves falling off the tree when wind vector magnitudes are high. A smaller value causes more leaves to fall.

-         Stiffness is the spring constant of the spring force on particles. Ultimately, this is the force that keeps leaves/particles from just blowing away while attached to the tree. Higher values correspond to a stiffer trunk.

 

From within the display window, the user may allow use the following keyboard commands for setting world states and exploring the world.

 

-         w’ and ‘s’ move the camera forward and back, respectively. This is equivalent to zooming in or out.

-         ‘a’ and ‘d’ move the camera left and right, respectively, while also moving the point that the camera is focused on by the same amount. This motion may be recognized as “strafing”.

-         r’ resets the state of the world, but leaves camera/viewing settings as they were. In other words, any stray leaves are returned to the tree and all forces and vectors are set to their original values.

 

In addition, the mouse can be used by dragging within the display window to rotate the camera up and down or left and right to essentially change the point to stare at. These controls and the keyboard controls are similar to the controls specified for the 3D World of Program 4.

 

Screenshots:

Figure 1. Leaves falling from tree at high wind magnitude (after changing direction of wind).

 

Figure 2. Close up of leaves on the ground after falling from tree (ground-up view).

 

Figure 3. Randomization of leaf orientation from inside tree.

 

Figure 4. Leaves change direction mid-air as a result of a quick change in wind vector direction.

 

Figure 5. “Rubber” tree resulting from a small spring constant. Tree is wobbly and stretchy. Spring force also requires correct damping coefficient to prevent tree and leaves from oscillating/bouncing out of control.

 

Figure 6. Close-up of GLUI interface created for the simulation.

 

References:

This is the online resource I used most frequently. These are the Siggraph course notes for particle system dynamics.

http://www.cs.cmu.edu/~baraff/sigcourse/notesc.pdf

 

Otherwise, I used very little reference materials aside from various class projects on the 471 webpage and maybe even a physics textbook (just a little). ;-)