Difference between revisions of "Project6Fall12"
(New page: =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 t...) |
|||
Line 14: | Line 14: | ||
'''Notes:''' | '''Notes:''' | ||
− | * Ignore what happens when the user rotates the flag to look at the other side of it | + | * 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 ('''30 Points''')== | ==2. Add a Texture to the Flag ('''30 Points''')== | ||
+ | Add a texture image to the flag, stretching across the entire area of the flag. You will get points for the following things: | ||
+ | * [[Media:ucsd-logo.ppm | Download this flag texture for a UCSD logo]], or download or create a different image of your choice. | ||
− | * | + | * Compute texture coordinates in a range of 0 to 1 for the vertices of your mesh. |
+ | * Set the color of all your mesh polygons to bright white (<tt>glColor3f(1.0, 1.0, 1.0)</tt>), because this color will be multiplied with your texel colors. ('''5 points''') | ||
− | * | + | * Map the texture to the Bezier patch. ('''20 points''') |
− | + | ||
− | + | ||
− | + | ||
+ | '''Note:''' | ||
Use the following settings for your texture after your first <tt>glBindTexture</tt> for correct lighting, filtering, and to enable texture repeat mode: | Use the following settings for your texture after your first <tt>glBindTexture</tt> for correct lighting, filtering, and to enable texture repeat mode: | ||
<pre> | <pre> | ||
− | // Select GL_MODULATE to mix texture with color for shading: | + | // Select GL_MODULATE to mix texture with color for shading: |
− | glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | + | glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
− | // Use bilinear filtering: | + | // Use bilinear filtering for higher visual quality: |
− | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | + | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
− | glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_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); | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==3. Extra Credit: Accelerate Rendering with OpenGL's NURBS Functionality ('''10 points''')== | ==3. Extra Credit: Accelerate Rendering with OpenGL's NURBS Functionality ('''10 points''')== |
Revision as of 21:04, 8 November 2012
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 (70 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 connected Bezier patches with C1 continuity. This Java app might help, but does not display the control points numerically. The control points are not all allowed to 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.
- Place at least one light source that illuminates the flag. Tweak its position so that the curvature of the flag is clearly visible (5 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. (5 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 (30 Points)
Add a texture image to the flag, stretching across the entire area of the flag. You will get points for the following things:
- Download this flag texture for a UCSD logo, or download or create a different image of your choice.
- Compute texture coordinates in a range of 0 to 1 for the vertices of your mesh.
- 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)
- Map the texture to the Bezier patch. (20 points)
Note: Use the following settings for your texture after your first glBindTexture for correct lighting, filtering, and to enable texture repeat mode:
// 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