Project6Fall12

From Immersive Visualization Lab Wiki
Revision as of 22:25, 8 November 2012 by Jschulze (Talk | contribs)

Jump to: navigation, search

Contents

Project 6: Bezier Curves

In this project you will need to create a flag that waves in the wind. The project is due on Friday, November 16th. The assignment will be introduced in the lab by Sid on Tuesday, November 13th, starting at 3:30pm.

1. Create a Flag with Bezier Patches (60 points)

Create a single-colored flag based on two connected (along a horizontal or vertical edge) Bezier patches. You will need to accomplish the following things:

  • Create a set of control points for two seamlessly (C1 continuity) connected Bezier patches. This Java app might help, but does not display the control points numerically. The control points are not allowed to all lie in one plane: the flag needs to have visible curvature. (10 points)
  • Use uniform tessellation to produce a uniformly colored (use a bright color of your choice) triangle or quad mesh with at least 100 triangles/quads per patch. (20 points)
  • Compute the normals for the vertices of the mesh as the cross product of the partial derivatives at each vertex. (10 points) You only need to compute normals for one side of the flag, the one the camera looks at.
  • Illuminate the flag: set suitable ambient, diffuse and specular material reflection coefficients for the flag. Place a light source in your scene (in camera coordinates) that illuminates the flag. Tweak material and light source parameters so that the curvature of the flag is clearly visible (10 points).
  • Integrate your mouse control functions to spin the flag around its center. Rotations of the flag should not move the light source: the light source needs to remain fixed in camera space. (10 points)

Notes:

  • Ignore what happens when the user rotates the flag to look at the other side of it: due to the normals pointing in the wrong direction, lighting will be wrong, and if back face culling is on, the back side will be invisible.
  • Do not use any of the curve generating OpenGL routines for this part of the assignment (i.e., glMap, glEvalCoord, glMapGrid, glEvalMesh, gluNurbsCurve). These are reserved for extra credit.


2. Add a Texture to the Flag (40 Points)

Add a texture image to the flag, which stretches across its entire area. You will get points for the following accomplishments:

  • Set the color of all your mesh polygons to bright white (glColor3f(1.0, 1.0, 1.0)), because this color will be multiplied with your texel colors. (5 points)
  • Compute and set texture coordinates in a range of 0 to 1 for the vertices of your mesh with the glTexCoord2f command. Note that this range needs to extend across both patches: the bottom left corner of your flag should have texture coordinates (0,0), the top right corner should be (1,1). (10 points)
  • Add support for the 't' key on the keyboard: hitting it should switch between the texture and the solid colored flag from part 1. (5 points)

Note: Use the following settings for your texture after your first glBindTexture for correct lighting, filtering, and texture repeat mode settings:

  // Select GL_MODULATE to mix texture with color for shading:
  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

  // Use bilinear filtering for higher visual quality:
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

  // Set the wrap mode (but it doesn't make a difference in this project):
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

3. Extra Credit: Accelerate Rendering with OpenGL's NURBS Functionality (10 points)

Make the flag look like it waves in the wind by doing the following things:

  • Wave the flag in the wind: Use smooth mathematical functions (e.g., sin, cos) to move the control points in order to make the flag appear to wave in wind. Use random numbers where appropriate to make the motion less repetitive. Do not move the two interpolating control points at the end where the flag is attached to the antenna mast. (3 points)
  • Support the number keys 1 through 9 to change the wind speed from slow to fast, which should speed up the waving, but could even change your waving function to create an increasingly more dramatic effect with increasing wind speed. (2 points)

Animate the flag

Modify the control points with functions that make the flag look like it waves in the wind.

opengl commands

speedup measurement