2021/10/13 An Interactive 3D Viewer
https://canvas.ucdavis.edu/courses/595787/assignments/718397 1/4
An Interactive 3D Viewer
Due Oct 22 by 11:55pm Points 100 Submitting a text entry box Available after Oct 5 at 10am
Start Assignment
Overview
In this assignment, you will create a 3D viewer application, which will become the foundation of the following three programming
assignments.
This homework will use Github Classroom.
IMPORTANT: Click on this link (https://classroom.github.com/a/uH3erzkG (https://classroom.github.com/a/uH3erzkG) ) to join the
assignment on Github and get access to your personal repository.
Requirements
The viewer reads the description of a 3D scene from several files that contain the definition (polygons and their vertices, color,
transformation, etc.) of at least one of each of the following 3D geometric shapes:
a cube
a rectangular prism
a pyramid
a triangular prism
a compound shape (e.g. a chair or a table) made up of above primitive shapes
The image below shows what a scene may look like. An example of the screen descriptor file (.json) and an example object file (.obj), as
well as the parser code for both is provided.
2021/10/13 An Interactive 3D Viewer
https://canvas.ucdavis.edu/courses/595787/assignments/718397 2/4
The viewer displays the scene from the translation found in the scene descriptor. From there, the user should be allowed to use their
mouse to manipulate the whole scene in the following ways:
Turn the scene around (center of objects, y-axis) or upside down (center of objects, x-axis) by dragging the cursor from left to right, or
up and down respectively. Move closer to or away from the scene
The user should also be allowed to select a particular 3D object in the scene by ray-casting and manipulate only that object in the
following ways:
Rotate the object (local y- and/or x-axis using a rotation matrix), enlarge or shrink the object (all axis, using a scale matrix), or move the
object (global x- and/or z-axis).
All objects in the scene may be viewed as flat-shaded or wireframe. The code for wireframe shading will be provided. The user should be
able to switch between perspective projection and orthographic projection. As with Assignment 1, window resizing and display refreshing
should be handled correctly.
glMatrix
In this assignment you'll create a few matrix functions on your own, but will also have access to a library called glMatrix (find the
documentation here (https://glmatrix.net/docs/) ). The starter already deals with imports, so you can use the functions of this library as
we explained in the lecture. This will really help you do some mundane vector / matrix calculations that are just very tedious to write on
your own. However, we want you to implement some of them to familiarize you with what's going on behind the scenes. Below is a list of
functions that you cannot use:
2021/10/13 An Interactive 3D Viewer
https://canvas.ucdavis.edu/courses/595787/assignments/718397 3/4
Any function to directly create a / an...
perspective projection matrix
orthogonal projection matrix
mvp / vp / mv matrices
Mind you're certainly allowed and encouraged to use basic matrix / vector functions to create the above constructs.
Bonus Points
If you didn't get the points you were expecting to get for the previous assignment, we decided to give students a chance to get a few points
back with this assignment. To get bonus points, you'll have to implement an FPS (first person shooter) camera mode. I.e. movement as
seen in first-person video games.
Requirements
Move by using W, A, S & D for translating up, left, down & right for making it look as if the camera was moving in the scene
Look around by moving the cursor either horizontally or vertically to rotate the viewport on the local y and x-axis
All transformations have to remain relative to the current position. I.e. when you move and look to the left, walking forward after will still
move the camera forward, not sideways (as it would be the case if you moved the camera globally)
Grading Criteria
10% A scene containing 3D shapes: cubes, rectangular prisms, pyramids, and a triangular prism as well an objects made of basic
shapes.
10% Flat shaded and wireframe rendering
20% Scene transformations: Rotate, Translate, Scale
15% Individual object transformations: Rotate, Scale, Translate
20% Projective Transformation: Perspective and orthographic
2021/10/13 An Interactive 3D Viewer
https://canvas.ucdavis.edu/courses/595787/assignments/718397 4/4
10% Interaction
15% Overall (robustness, programing style, documentation, etc.)
How to submit your work
Submit this homework by submitting the URL to your Github repository along with your Github username here on Canvas.
Structure your Canvas submission like this:
Github User: [your Github username here]
Repository: [your repository URL here]
Your work has to be submitted to Canvas and pushed to Github before the due date (11:55pm, 10/22/2021). We will consider the latest
commit for grading, so consider if your improvements are worth a late penalty.
Nota Bene
We do not grade a program that does not run. Late submissions will lose 10% per day.
You are encouraged to help one another, but you must write your own code. If you use somebody else's code, document it. You
must abide by. the UC Davis Code of Academic Conduct.