WPI Computer Science Department

Computer Science Department

CS 543, Spring Semester 2018 Homework 3

Homework 3: Due Wednesday, March 21, 2018, by class time (10/100 points)

Homework 3 Overview

In this project, we will explore hierarchical modeling of 3D meshes. We will also explore lighting and shading. The goal of this part of the assignment is to familiarize yourself with transformations and hierarchical modeling in OpenGL using a matrix stack. You will be modeling and animating a kinetic sculpture such as Alexander Calder's hanging mobiles. Example images are given below:


Here is a [ Video ] that shows such a kinetic sculpture in motion. Your task is to model and animate a kinetic sculpture. In order to do so, you need to first construct a scene containing several objects, then you need to organize them hierarchically and simulate their motions according to the hierarchy you define. Use several of the PLY models you rendered in project 2 in your hierarchy. All models should be properly sized so that they do not look disproportionate or display awkwardly. All models should have approximately the same size. In the video, you should have noticed multiple axes of movement for each model, where the PLY model may rotate about it's own axis while rotating around a larger arm off which it is hanging. Implement this effect!! To draw the arms connecting the meshes, you can just draw horizontal lines and to connect the meshes to the ends of the arm, just draw vertical lines. Also, make sure you set up perspective projection

Per-Pixel Lighting (smooth shading) Draw all your meshes in your hierarchy as solid meshes (not wireframe). Implement shaders for per-pixel lighting and flat shading. You will switch between shading types using keystrokes below. Apply some interesting colors and material properties to your 3D meshes. Don't forget to enable depth testing (Hidden surface removal)

Implement a spotlight (described on pages 263 and 264 of your text) The spotlight is like a cone and light only reaches objects inside the cone. Objects outside a certain angle, called the cutoff angle, phi, gets no light (only ambient component). Make the cutoff angle a variable that can be controlled with a keystroke

Matrix stack You will need to implement a matrix stack, including PushMatrix( ) and PopMatrix( ) routines. You may use a simple linked list to store the stack or use a more sophisticated tree structure.

Animation Define a suitable frame rate such as 30 FPS and animate your model at that speed. Every 1/30 of a second, the animator will call the display callback function to re-draw everything. By displaying objects at slightly different locations (corresponding to camera or object movements) every frame, you can simulate an animation. Be mindful of performance issues while you implement this homework. As your scene size grows, avoid unnecessary re-initialization, buffer recopying, and file reopening that could slow down your program considerably.

Requirements: Your sculpture must consist of at least 6 unique meshes with interesting colors. Each mesh should have a different color. Your sculpture must contain at least 3 levels of hierarchy. See the second image above. The animation should move all parts of the sculpture. It should be physically plausible and make sense. --- that is, there are no magical, free-flying shapes or disjointed movements. Objects should remain connected in whatever way you connected them as you animate them.

All mesh models should rotate counter-clockwise about their own Y axis. The arm of Level 1 of the hierarchy should rotate clockwise, the arm of level 2 of the hierarchy should rotate counter-clockwise, the arm of level 3 should rotate clockwise, and so on. Basically, the arms of consecutive levels of the hierarchy should alternate between rotating clockwise and counter-clockwise.

Additional Keystrokes

Also implement the following additional keystrokes.

Submitting Your Work

Make sure to double-check that everything works before submitting. Submit all your executable and source files. Put all your work files (Visual Studio solution, OpenGL program, shaders, executable and input files into a folder and zip it. Essentially, after your project is complete, just zip the project directory created by Visual Studio. Submit your zip file using InstructAssist at [ https://ia.wpi.edu/cs543/] . Do not email me your program or submit it via dropbox. To make your submission smaller, delete the \ipch folder in the visual studio. On recompilation, Visual Studio will regenerate this folder without problems.

Create documentation for your program and submit it along with the project inside the zip file. Your documentation can be either a pure ASCII text or Microsoft Word file. The documentation does not have to be long. Briefly describe the structure of your program, what each file turned in contains. Explain briefly what each module does and tie in your filenames. Most importantly, give clear instructions on how to compile and run your program. MAKE SURE IT RUNS IN THE ZOOLAB before submission. Name your zip file according to the convention FirstName_lastName_hw3.zip

[Feedback] [Search Our Web] [Help & Index]

[Return to the WPI Homepage] [Return to CS Homepage]