MV 3202: Computer Graphics - Announcements

Homework 8, due Wednesday 3/15/2006 in class and Sunday 3/19/2006 11:59pm

This homework considers computer graphics (CG) and the material that we learned this quarter in a greater context. The first part is good for 4 points - please bring it to class on Wednesday. The second and third parts account for 3 points each and are due Sunday.
  1. Where does CG employ techniques, methods, or approaches from more general computer science? And in which respects does CG provide a service to other computer science areas? Go through your lecture notes and find eight additional examples and explain them in a sentence or two.
  2. For many purposes, 3D visualizations are superior to their little 2D brothers. Why are 3D visualizations not a lot more prevalent? Name and explain three or more reasons why 3D CG programming and modeling is comparatively hard. You might want to consider the level of abstraction of common 2D and 3D APIs and tools, and our expectations about 2D and 3D visualizations, respectively.
  3. Now that you had a quarter's worth of CG introduction, let us address a question from the survey again. Given your past job experience, think of a task or a procedure, a system, or an event that would benefit from 3D CG. (If you absolutely don't have any job experience: think of another situation in your life.) Explain briefly the current situation/procedure/system and its objectives. Then, describe 3D computer graphics (a visualization, procedure, application, system...) that would improve some aspect or overcome some limitation of the current status. How does it improve it? Merely saying "C4I benefits from visualization" won't give you any points. Instead, pick a very specific problem and solution! Be concise in your description!

Homework 7, due Thursday 3/2/2006 11:59pm

Texture mapping theory is the topic of this homework.
  1. What is the texture matrix stack? What does it manipulate? Name one or more uses of this.
  2. What is a texture object? List the entire OpenGL state that is associated with a texture object, that is, the state that changes when binding a different texture object.
  3. What happens with texture object handles in OpenSceneGraph? What generates them? What binds the texture object? Are they used at all?
  4. We talked about lots of uses of texture maps - for images, projective lights, shadow maps... We did not talk about two important applications of texture maps: bump mapping and displacement mapping. Read up what they are. They are not supported in standard OpenGL, but we can implement both techniques with shader programs. Explain in a sentence or two for each of bump mapping and displacement mapping whether you would use a vertex shader, a fragment shader, or both to create the effect, and what the shader program(s) would have to do.

Homework 6, due Thursday 2/23/2006 11:59pm

In this homework we will add textures to our scene.
  1. Texture the rocking horses of homework 4 as in this image. To do this, modify the RockingHorse Drawable by adding OpenGL code similar to that in Primer 4. Do not use OpenSceneGraph classes or methods for this part of the homework. You can use the following code to create the checkerboard pattern:
      GLubyte checkImage[64][64][4];
      for (i = 0; i < 64; i++) {
         for (j = 0; j < 64; j++) {
            c = ((((i&0x8)==0)^((j&0x8))==0))*255;
            checkImage[i][j][0] = (GLubyte) c;
            checkImage[i][j][1] = (GLubyte) c;
            checkImage[i][j][2] = (GLubyte) c;
            checkImage[i][j][3] = (GLubyte) 255;
         }
      }
            
  2. Create a textured sphere in Blender. The texture image has to be of some spherical object, such as a planet's surface or a soccer ball. Export it as an OpenSceneGraph tree and render textured spheres in place of the rocking horses on the outer disk of homework 4: example image.
    If importing the texture does not work: a) check the .osg file if the image's filename is correct. b) check that the texture file is in the same directory as the osg file. c) if neither of those was the problem, remove the node "textureUnit 0 {...}" from the osg file and load the texture from within your OpenSceneGraph code with the following commands:
      osg::Texture2D* tex = new osg::Texture2D();
      tex->setImage( osgDB::readImageFile( "mytexture.jpg" ));
      osg::StateSet* ss = new osg::StateSet();
      loadedModel->setStateSet(ss);
      ss->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON);
            
  3. Lastly, create a set of 5 different textures from images of your choice and place them on a cube without a front. Stick the entire merry-go-round into the cube. For this part, do not use OpenGL directly or Blender, but use OpenSceneGraph instead. For example, use the code from above and have a look at the OSGTraining exercise 0060_Cube/Cube_5.cpp, which explains how to get the same texture(s) on every face. You will need one Geometry object for each face so that you can have different textures on every face. Your scene should look something like this and this.
  4. extra credit (2 points): Pick images with windows for the cube. Make the cube's polygons transparent where the textures' windows are so that one can see through the windows. You could use a second texture for that, which modifies the polygon's alpha value.
  5. extra credit (2 points): Add a true skybox to the scene: a skybox moves with the camera and always remains at the same distance from the viewer. The entire scene from above has to be contained in the skybox at all times. If you implemented the transparent windows, the skybox should be visible through them.
Submit the following files through Blackboard's Digital Dropbox, zipped (or tar.gz'ed) into one file named hw6_yourlastname.zip:
  1. main.cpp
  2. RockingHorse.cpp
  3. any other code and header files that you created/modified
  4. the Blender-created OSG tree (*.osg)
  5. a Windows executable (if you do not develop on Windows, the source code is sufficient.)
  6. all texture images that you used (6 or more)
It doesn't matter what the individual files are called.

Homework 5, due Thursday 2/16/2006 11:59pm

Übung macht den Meister! We will practice polygon illumination and shading. Given are: First, calculate the illumination at the points A, B, and C, using the Phong illumination model. Then, calculate the illumination at point D with each of the three shading models "flat", Gouraud, and Phong.
For your calculations, you can use tools such as Matlab or Excel, or just a plain old calculator. Your solution has to include the formulas you used and intermediate calculation steps. Hand in your solution on a piece of paper with your name on it.

Homework 4, due Sunday 2/5/2006 11:59pm

This is a combined modeling and scene graph project. Both parts can be completed independently. Only the scene graph part requires a bit of programming. A sample executable is here, and a sample osg graph with my initials (no periods though) is here.
  1. Create your initials as a 3D model in Blender. Create at least 4 objects, including two icospheres as the dots after the letters. Build geometry with non-zero volume, not just flat polygons. The normals have to be set correctly (Ctrl-N in Blender) on all surfaces. Save and submit the .blend file.
  2. Render the scene in Blender (F12) such that all letters are visible and well lit. Save (F3) and submit the image.
  3. Use Export->OpenSceneGraph (requires osgexport plugin) to save the geometry to a scene graph file. You may write all geometry to a single file or, if you plan on moving the letters independently in the programming part of this homework, you can write them to one file each. Tip: before exporting, scale and translate the objects so that they are in a known pose, for example, bottom on the x-axis and symmetrical in the x-y-plane. This will make things easier in OpenSceneGraph. (Note that some features like textures and armature will not be exported with osgexport.)
  4. Position the imported model (your Initials or some other model if you could not complete parts 1-3) in OpenSceneGraph: Implement a "Bouncer" class that is a child class of osg::NodeCallback. Its operator() has to continuously update a TransformMatrix to translate up and down. Set one instance of this class as the update callback of a node that will bounce around your Initials model at the center of the inner disk. The squishing is not necessary and the up/down motion need not be physically accurate.
  5. Once that works, replace all rocking horses on the outer disk with bouncing Initials, all with different bouncing speeds. Please put all Bouncer code in the main.cpp file and submit that, along with an executable.
  6. For extra credit (2 points), replace only the rocking part of the rocking horses with the bouncing Initials such that they swing and bounce. This requires modifying the RockingHorse implementation - submit both the header and the source file in addition to the other requirements.
  7. For even more extra credit (2 more points), tackle that squishing of the letters. The squishing must not start before the letter hits the disk and the letter must not penetrate the disk.
Submit the following files individually through Blackboard's Digital Dropbox:
  1. the Blender scene file, called hw4_yourlastname.blend,
  2. the scene rendered in Blender as JPEG, called hw4_yourlastname.jpg,
  3. the main.cpp source code file, renamed to hw4_yourlastname.cpp,
  4. a Windows executable, named hw4_yourlastname.exe, (If you do not develop on Windows, the source code is sufficient.)
  5. for extra credit only: the modified RockingHorse.h and RockingHorse.cpp, named hw4_yourlastname_RockingHorse.h and hw4_yourlastname_RockingHorse.cpp.
Please type "hw" in lower case. Don't zip them.

Homework 3, due Thursday 1/26/2006 11:59pm

Implement a "ghostly merry-go-round" similar to this program. Press the number keys (in bold) for the described functionality (you do not need to recognize these keystrokes in your program).
  1. Render a box without a lid as an OpenGL QUAD_STRIP primitive and place it on top of a disc-shaped GLU quadric. Make them spin at some constant speed. 0
  2. Write a function that renders a single "rocking horse" on a base and hinge. Place some horses on the spinning disc. (The placement of the horses is to happen outside that function.) The polygons are to be rendered filled on one side and as wireframes from the other, such that they are filled when on the near side of the merry-go-round, and as wireframes when they are at the far side. Render them in a different color than the disc.1
  3. Change the rocking_horse function so that it takes exactly two arguments: the rocking frequency in Hz, and the current time. (I suggest using the function "gettimeofday()" for timing on *nix systems, and _ftime on Windows. You can also use glutGet(GLUT_ELAPSED_TIME), which returns the milliseconds passed since the call to glutInit.) Make the horses rock with different frequencies. 2
  4. Now make the horses disappear entirely while on the far side of the disc instead of getting rendered as wireframes. The box should still be rendered filled and as wireframe, respectively. 3
  5. Add a glutSolidTorus around the disc, place some horses on the torus, and have it spin the opposite direction of the disc. Do not let the horses disappear when on the far side, but rendered as wireframes instead. 4
  6. Optional (no extra credit): add a GLUT mouse menu to your program that controls various parameters, such as the number of horses or whether they rock or not.
  7. Optional (no extra credit): turn on lighting and specify the normals for all primitives that you defined. 5

Submit exactly two files through Blackboard's Digital Dropbox: 1) the source code file, named hw3_yourlastname.cpp, and 2) a Windows executable, named hw3_yourlastname.exe. Please type "hw" in lower case. If you do not develop on Windows, the source code is sufficient.

Homework 2, due Thursday 1/19/2006 11:59pm

Write your first OpenGL program! Starting from the code we used in the lab, add some spheres and another key control:
  1. Make the red teapot smaller. If there still are "glScale" function calls in your code, remove them. Instead, use the parameter to glutSolidTeapot() to set its size.
  2. Use glutSolidSphere to add two spheres to our scene, the first one 1 unit above the center of the red teapot, the other one 1 unit below. Draw them in a different color than the teapot. I made them 0.2 units big.
  3. Add key controls "d" and "c" to make those spheres orbit around the x-axis of the red teapot. Leave the other key controls (a,z,s,x,q) intact.
  4. Add two more spheres of a different color to the left and right of the green teapot. Have those spheres orbit around the z-axis of the green teapot automatically, that is, without the need to press a key.
  5. Add two more spheres of a different color to the left and right of the blue teapot and have them orbit automatically around the y-axis of the blue teapot.
The function of the other keys should not be changed. You can try out what your program is supposed to look like.
Submit exactly two files through Blackboard's Digital Dropbox: 1) the source code file, named hw2_yourlastname.cpp, and 2) a Windows executable, named hw2_yourlastname.exe. If you do not develop on Windows, the source code is sufficient.

Homework 1, due Thursday 1/12/2006 11:59pm

  1. FCG Exercise 2.7: Show by counterexample that it is not always true that for 3D vectors a, b, and c (where "x" is the cross product):
    a x (b x c) = (a x b) x c
  2. Given a ray
    P(t) = (7; -9; 11) + t*(-1; 3; -5)
    and a plane
    H(P) = (8; 2; 4).P + 6,
    where do they intersect and what is t at the intersection? (In Matlab convention, the ";" semicolon indicates a new row, so the vectors above are 3x1 matrices, or column vectors.)

Homework 0, due Wednesday 1/11/2006 before class

This homework will not be graded.