Computer Graphics

CSCI 440, Spring Semester, 2015

 

To the Bottom of the Page

 

Instructor:   Dr. Shieu-Hong Lin   LinEmail

Class time:      M W    1:30-2:45 pm at Busn 209

Office Hours: T Th 1:30-2:30pm

 

Syllabus: compact version, (full lengthy version)

 

Useful online references to C++ and C libraries

 

Online books and tutorials

 

*****************************************************************************************************

 

Week 1: Intro to Computer Graphics Using OpenGL.

 

Reading #1: due Monday, Feb. 2.

 

Lab #1: due Monday, Feb. 2.

 

*****************************************************************************************************

 

Week 2:  Basics of Glut: Event Loop and Registration of Call-Back Functions

 

Reading #2, due Monday, Feb. 9 (i) Chapter 2 of the OpenGL Programming Guide on state management and geometric objects. (ii) GLUT 3.0 specification:  Sections 2~3 on initialization and the event loop, Sections 7.1~7.6 on registration of basic callback functions,  Sections 4.5~4.6 on posting a redisplay event and the swapping of double buffer.

   

Lab #2: due Monday, Feb. 9.

 

Demo program: Icosahedron and subdivision to approach a sphere  from Chapter 2.

 

*****************************************************************************************************

 

Week 3: Introduction to Model-View Transformation and Projection Transformation

 

Reading #3, due Monday, Feb. 16: (i) Read Chapter 3 of the OpenGL programming guide.  (ii) Play with transformation.exe from Nate Robin’s tutor repository to explore the effects of 3D transformations and its relationship with the GL_MODELVIEW matrix stack. (iii) This brief review of 3D Geometry.

 

Lab#3A: A Simple Static Scene Viewed from a Moving Camera with Perspective Projection  (See this sample Windows executable solution zip file for Lab #3A and press the keys j, k, i, m, x, y, z to change the dynamics of the scene) Due: Monday, Feb. 16.

 

Demo program: Computer graphics and photo-realistic scenes: See an interesting video and the related news here.

 

*****************************************************************************************************

 

Week 4: More on Model-View Transformation and Projection Transformation.  

 

Reading #4, due Monday, Feb. 23: (i) Read this brief review of 3D Geometry (ii) Carefully reexamine Chapter 3 of the OpenGL programming guide again and reexamine transformation.exe and projection.exe from Nate Robin’s tutor repository to make sure you understand how model-view transformation and projection transformation are supported in OpenGL.

 

Lab#3B, Due: Monday, Feb. 23: A Dynamic Scene Viewed from a Moving Camera with Perspective Projection  (See the three sample executables in this solution zip file  for #3B). 

 

 

*****************************************************************************************************

 

Week 5: Viewport Transformation. 

 

Reading #5, due Monday, March. 2: (i) Play with this sample program about Sierpinski gasket fractal and watch the console application to see the difference between the windows coordinates you get from the mouse events and the world eye coordinates of objects in the world. Press the keys 1 and 2 to switch between two reshape event handlers to see two different ways to preserve the aspect ratio when the user resize the window. (ii) Read Section 11 of glut specification about the rendering of the teapot, cube, sphere and read the blue book regarding the use of GLUquadricObj, gluNewQuadric, gluQuadricDrawStyle, gluCylinder, gluSphere, gluDisk, gluPartialDisk. (iii) Play with this planet program (press d, D, y, Y to see the effects) from Chapter 3 of the OpenGL programming guide on mode-view transformation using glRotate, glScale, and glTranslate.

 

In-class programming test#1, Wednesday, Feb. 25.

1.      Consider the sample code here (from Chapter 2) that can approximate a unit sphere centered at the origin (0,0,0)  by applying the subdivision technique recursively for a number of times to the basic geometry of a standard icosahedron centered at the origin (0,0,0).

2.      (i) Develop a function void myUnitSpehere(float x, float y, float z, int depth) that will approximately draw a unit sphere with radius 1 centered at (x,y,z) by applying the subdivision techniques recursively for depth times to the geometry of a icosahedron now centered at (x,y,z).  (ii) Develop void mySpehere(float x, float y, float z, float r, int depth) that will do the same thing like myUnitSpehere but to approximate a sphere of the given radius r.  

1.      See the sample Windows executable in this zip file modeling a 3D bouncing ball, which call the sphere function in problem #1 to render the ball. Re-examine the main function in this zip file from CSCI 105 Intro to Computer Science that can render a 2D bouncing box contained in a 2D square using a collection of 2D drawing functions. Make sure you understand how they model 2D velocity, the change of velocity when hitting a 2D wall, and the effect of gravity when it is turned on.

2.      (i) Develop a program that can render a 3D bouncing ball contained in a 3D box using OpenGL from a fixed view. (ii) Incorporate the effect of a moving camera 3D like what you did on Lab #3A and #3B so that the user can view the bouncing ball contained from a camera rotating around the Y axis. (iii) Incorporate the keyboard commands such that the user can (1) stop the camera or keep it moving around its orbit, (2) increase or decrease the radius of the camera’s orbit, (3) increase or decrease the camera rotation speed, (4) stop the ball or keep it moving, (5) turn the gravity effect on or off, (6) set a random speed for the ball, and (7) increase or decrease the current speed of the ball.

 

Lab#4A, due Monday, March. 2: Composing Static Scenes Using Basic Geometric Objects and Model-View Transformation.

 

*****************************************************************************************************

 

Weeks 6-7:  Advanced GUI Features in GLUT + Mission Conference

 

Lab#4B on Model-View Transformation and Geometric Objects: Due March. 9.

 

Lab#4C on Menu Creation and Menu Callback functionDue March. 16.

 

·         Reading #6-7, due Monday, March. 16: 

1.      Download and play with this zipped source code and an executable to find a sample 3D scene modeler (S.H. Lin 2006). You can either right click to select different operational modes to press enter to rotate around modes. See snapshots 1 and 2 and use it to load this 3D scene model for viewing and exploration.

2.      To learn about new features used in the scene modeler, please read (i) the following parts of GLUT specification: section 6 on glutCreateMenu, glutAddMenuEntry, glutAttachMenu, section 7.5 on glutMouseFunc, and section 9.1 on glutGet, (ii) the related sections of Online OpenGL 1.1 reference guide on glGetDoublev, glGetIntegerv, and gluProject, (iii) the usage of acos and fabs  in <cmath> of C++, and (iv)  Chapter 4 of OpenGL 1.1 programming guide on colors.

3.      To understand how the new features are used in the scene modeler, (i) download and play with this compact XYZ movement example (sample code and an executable included) demonstrating the implementation of an advanced glut mouse motion function to translate dragging events into actions along X, Y, Z axes, and (ii) download and play with this example program on the setup of a menu system using GLUT. Examine the code to understand the underlying implementation.

 

 

*****************************************************************************************************

 

Week 8:  Lighting and Material. 

 

·         Reading #8 due Monday, March. 23 

(i) Chapter 5 on lighting and materials from the Online OpenGL 1.1 programming guide. (ii) Play with lightposition.exe and lightmaterial.exe from Nate Robin’s repository to get a sense of the issue of light and materials and do experiments with the sample code by trying different values for the related light and material parameter to create similar effects you see in Plates #13, 16, 17 in the appendix of OpenGL Programming guides. (iii) Examine this sample code as an example of the use of the depth buffer + depth test and the setup of light and material. You should do experiments with the sample code by trying different values for the related light and material parameter to create similar effects you see in Plates #13, 16, 17 in the appendix of OpenGL Programming guides based on your understanding of Chapter 5.

 

Formation Stage I, Monday, March. 23 

(i) You need to present your scenario (Task #1) and your prototype (Task 2) for Formation Stage I (see below about the details of Formation Stage I) in the class.

(ii) After the presentation, upload all your source code files and this Formation Stage I Progress Report as a single zip file under Canvas to get the credit.

 

*****************************************************************************************************

 

Final Project: Formation Stage I, due Monday, March. 23

·        Purpose: In this formation stage, we want to get a taste of developing a very basic 3D games by creating a prototype around the framework of the bouncing ball in Programming Test#1.

·        Basis: (i) The code framework of the bouncing ball you develop for Programming Test#1. (ii) Optional: Play with the executable in the castle example to see how the user can navigate in the environment through the keyboard (try the keys: a, d, w, s, x, y, c, v, f, r). As an example, you can examine the source code there to understand the ideas and the use of a camera class and keyboard controls to provide a basic user interface for navigation in a virtual world.

·        Task 1 (Formation of the Scenario): Describe your ideas of developing a basic 3D game based on the framework of the bouncing ball in the programming test#1. You also need to provide a coherent scenario of the game meeting the following two requirements.

·        Task 2 (Implementing a prototype): You should (i) implement a prototype of your ideas and (ii) provide a very simple user manual about the scenario and the commands for playing your game.

·        Submission: You need to present your scenario (Task #1) and your prototype (Task 2) in the class. After the presentation, upload all your source code files and this Formation Stage I Progress Report as a single zip file under Canvas to get the credit.

·        Demo examples: 1 (Shooting a basket ball)

 

 

**************************************************************

 

Week 9: Review and Test #2

 

In-class programming test#2, Monday, March 30.    Demo

1.      Basic geometric modeling: Write a bus function that (i) models the bus using geometric primitives and/or basic objects provided by glu and/or glutcan and (ii) renders the bus centered at the origin if no model-view transformation is applied when it is rendered. For example, you can model the bus in terms of (i) a scaled cube as the body, (ii) one torus for each wheel, and (iii) a rectangle for each of the windows, the front lights, the brake lights, and the plates.

2.      Animation through model-view transformation: Use model-view transformation appropriately together with the bus function to create the animation of the bus moving around a fixed point (0, 0, -4) in a circle with a radius 2.

3.      Lighting: Model two light sources. One is statically located at (0, 4, 4) that is behind and above the static camera. The other one is attached to the front of  the bus and thus should dynamically move as the bus moves. Set up an attached menu such that the user can turn each of two light sources on or off independently.

4.      Materials: Set up additional subjects in the scene, including at least (i) a couple static buses (by using the bus function together with model-view transformation) parking nearby at different locations with different orientations and (ii) things about the grounds and around. Set up the material properties differently for these subjects to render some of the visual effects in Plates #16 and 17 in the appendix of the OpenGL red book.

 

*****************************************************************************************************

Week 10: Spring Recess + Formation Stage #2

 

 

Final Project: Formation Stage II, due Monday, April. 13.

·        Purpose: In formation stage II, we want to add additional elements into the framework you proposed  in the previous stage and continue to  polish the prototype your 3D game.

·        Basis: (i) The code framework you develop for formation stage I. (ii) OpenGL functions for lighting and materials.

·        Task 1 (Adding elements into your scenario): Describe your ideas of adding new elements into your 3D game framework done in formation stage I.

 

 

·        Task 2 (Implementing a prototype): You should keep (i) polishing your prototype by implementing and adding more elements into the virtual world according to your ideas described in Stage I and Stage II and (ii) updating your user manual about the scenario and the commands for playing your game.

·        Submission: You need to present your updated scenario (Task #1) and your prototype (Task 2) in the class. After the presentation, upload all your source code files and this Formation Stage II Progress Report as a single zip file under Canvas to get the credit.

 

 

*****************************************************************************

 

Formation Stage II presentation: Monday, April. 13 and Wednesday April. 15.

Formation Stage II Progress Report due Wednesday April. 15.

·        Submission: You need to present your updated scenario (Task #1) and your prototype (Task 2) in the class. After the presentation, upload all your source code files and this Formation Stage II Progress Report as a single zip file under Canvas to get the credit.

 

Reading #9: due Monday, April. 13. (i) Read Chapter 5 on lighting and all the things in Reading #8 again to make sure you can handle lighting and materials as required in Formation Stage II. (ii) Play with lightposition.exe and lightmaterial.exe from Nate Robin’s tutors again. (iii) Examine and play with the code here.

 

*****************************************************************************************************

 

Week 11: Texture Mapping

 

Reading #10: due Monday, April. 20.  (i) Chapter 9 on texture mapping from the Online OpenGL 1.1 programming guide and understand these key OpenGL texture mapping commands. Play with texture.exe from Nate Robin’s tutor repository to get a sense of the issue of texture mapping. (ii) Carefully examine how we can generate a texture from a picture in the tga format using the CreateTexture function declared in tga.h and implemented in tga.cpp and map the texture onto surfaces in case (a) where multiple images are mapped onto various surfaces in a static scene and in case (b) where one images is mapped onto various surfaces in a dynamic scene. (iii) Also see in case (c): about the mapping of a checkerboard image onto a glutTeapot object, and case (d): about the mapping of two checkerboard images onto two rectangles.  (iv) Optional: You may also explore the Simple OpenGL Image Library that supports the loading of most popular image formats for texture mapping.

 

 

*****************************************************************************************************

 

Week 12: Faces and the Related Issues on Lighting and Materials + Blending and Fog

 

 

Lab#5: Due Monday, April. 27.

 

*****************************************************************************************************

 

Week 13: Intro to Interpolation and Surface Modeling  

 

Reading #12: Report Due: Monday, May 4.

 

 

In-class programming test#3: Monday, May 4. 

 

1.      Texture mapping: Revisit your modeling of the bus scene in Test #2 earlier and examine the texture mapping in Plate 29 and Plate 30 in the appendix of OpenGL red book. Incorporate texture mapping into your modeling of the bus scene in Test #2 such that we have hills and grass (and maybe buildings) textured in the scene somewhat similar to what we see in Plate 29 and Plate 30.

2.      Fog: Incorporate fog into the bus scene to create an effect somewhat similar to Plate 31 in the appendix of OpenGL red book. (Also see fog.exe in Nate Robin’s tutor repository.)

3.      Blending: TBA.

 

*****************************************************************************************************

 

Week 14: Formation Stage III for the Final Project  

 

Reading #13: Report Due: Monday, May 11.

 and glutBitmapCharacter to display text information in your 3D world.

 

 

 

 

Final Project: Formation Stage III, due Monday, May 11.

·        Purpose: In formation stage II, we want to add additional elements into the framework you proposed  in the previous stage and continue to  polish the prototype your 3D game.

·        Basis: (i) The code framework you develop for formation stage II. (ii) OpenGL functions for texture mapping, fog, and blending.

·        Task 1 (Adding elements into your scenario): Describe your ideas of adding new elements into your 3D game framework done in formation stage I.

 

·        Task 2 (Implementing a prototype): You should keep (i) polishing your prototype by implementing and adding more elements into the virtual world according to your ideas described in Stages I~III and (ii) updating your user manual about the scenario and the commands for playing your game.

·        Submission: You need to present your updated scenario (Task #1) and your prototype (Task 2) in the class. After the presentation, upload all your source code files and this Formation Stage III Progress Report as a single zip file under Canvas to get the credit.

 

 

*****************************************************************************************************

 

Week 15: The OpenGL Shading Language   (Things you need to know for using the current OpenGL 4.3 API)

 

Reading #14: Report Due: Monday, May 18.

 

*****************************************************************************************************

 

Final-Exam Week: (No class. Check with me.)

 

·         Monday, 1:30~2:30pm, May 25: Present your prototype if you haven’t done the presentation for the 3rd formation stage yet.

 

 

Final Project: Game Project  in 3-DVirtual World

 

 

*****************************************************************************************************

 

 

To the Top of the Page