Difference between revisions of "Discussion1S16"
(Created week 1 discussion note for spring 2016.) |
m (Kyl063 moved page Discussion1S2016 to Discussion1S16) |
Latest revision as of 00:40, 6 April 2016
Contents |
Overview
Week 1 discussion recap (03/28/16) For those of you who didn't make it to discussion or want a review, here's a recap of what went on.
Linear Algebra
Graphics is a branch of applied mathematics. Therefore, prepare yourself to do a lot of math this quarter.
Linear algebra—the math that deals with matrices and vectors—is especially relevant. Try to remember how to do matrix multiplication. One thing you should remember: multiplication order matters—in other words, matrix multiplication is not commutative! A x B usually won't yield the same result as B x A (and occasionally operand switching won't even give you a valid operation in the first place). You'll see more of this in lecture tomorrow (Tuesday 03/29).
Homework projects
The first homework project will be listed under the [section] on the course webpage. You have about two weeks, but get started as soon as possible; This project is not something you can finish in one or two days. There will be 5 homework projects this quarter, each 2 weeks long (with the exception of the final project being 3 weeks long). On all homework projects, you can score up to 110% (100% + 10% extra credit). Again, more info about grading will be provided tomorrow in lecture.
The first homework project is aimed at getting you familiar with the tools and libraries that will be your friends throughout the quarter. These will include GLFW and GLew. You are free to use any other graphics or window management library, however you must contact us first for approval, as we want to make sure that you are not using a library that does too much of the homework for you. For the first homework project, you will be:
- Writing a parser for the .obj file extension (more info to come)
- Rendering the 3D object defined by the .obj file
- Manipulating the object (translation (moving), scaling, rotating (orbiting), etc.) using the keyboard, and
- Implementing a way to switch between immediate mode (which is the code that we provide) and your own software rasterizer (just so you can know and appreciate what the GPU does for you), which will be discussed next week.
The OBJ file format
For the purposes of keeping your sanity intact, all .obj files we provide will have only information of vertices (lines starting with a v), normals (lines starting with a vn), and faces (lines starting with an f). You won't need to worry about normals and faces until project 2, but for those curious, this is very important when dealing with shading (lighting, colors, that kind of stuff). The general format for vertex lines is:
v v_x v_y v_z r g b
Where v_x, v_y, v_z are the vertex x, y, and z coordinates and are strictly floats. The values r, g, b define the color of the vertex, and are optional (i.e. they will be missing from many files). Like the vertex coordinates, they are strictly floats, but can only take on values between 0.0 and 1.0. All values are delimited by a single whitespace character.
The general format for normal is the same as for vertices, minus the color info—the r, g, b.
The general format for face lines for files you will be working with this quarter is
f v1 v2 v3
or
f v1//n1 v2//n2 v3//n3
Where v1, v2, v3 are the indices of the vertices (i.e. the order in which they appear in the .obj file, so the 5th line that starts with v will have index 5), and n1, n2, n3 are the indices of the normals. If the n1, n2, n3 values are missing, then it is assumed that the vertex and normal indices are the same. Please note that obj object indexing starts at 1, not 0; This means you'll have to offset the vertex and normal indices.
You can find more info about the .obj file format on Wikipedia. Again, you are only responsible for the v, vn, and f lines, however being able to parse other types of lines can be very helpful, as extra credit portions of the homework may involve more complicated .obj objects.
Homework 1
You will be able to download the starter code from the course webpage in the Basecode page.
When you run the program successfully for the first time, you will see a cube spins at a rate of 1 degree per frame, and on low end laptops, there's generally a frame rate of around 1000 per second, so the cube should be spinning wildly. Go through the starter code and make sure you understand everything. Change the spin rate of the cube (so that you can actually see it spin slowly) as well as its color(pick whichever color you like!), then get started on the rest of project 1. We anticipate that you will need around 2-15 hours of work for this project (and around 5-15 hours for future projects), depending on your level of confusion (at most an hour a day - not bad, right?). That being said, please don't wait until the very last day to start your project. Unexpected issues pop up so often, and none of the course staff would even be awake at 4am to answer your Piazza questions.
In regards to the development environment:
Windows users
Please use Visual Studio for developing. The starter code comes with a Visual Studio solution file. You are welcome to use any other IDEs as you please, though we likely won't be able to help you resolve linker/compiler errors. You can download Visual Studio for free on Dreamspark, or Visual Studio Community 2015 directly from the Microsoft website. You will need to install GLFW and GLew, as well as link to opengl32.lib and glu32.lib to get the code to compile. More detailed information is provided on the starter code webpage, linked just above.
Mac users
We highly recommend XCode. Instructions for setting up the projects on Mac computers will be provided on the starter code webpage when it goes live. Other operating systems: We've had students who successfully compiled and ran their projects on Linux machines, so it's definitely doable. Unfortunately we won't quite be able to help you resolve linker/compiler errors, so good luck with the project settings.
Lab computers
If you are working on the lab computers, do not use the Linux partition. All the libraries required to run are installed only on the Windows partition in lab rooms B260 and B270. When you attempt to run the starter code, it should very likely fail.
Final notes
If you are on the waitlist, don't worry too much. There has never been a quarter where we've had a student who couldn't clear the waitlist. For those of you who heard that this course will drive you crazy or is extremely hard, forget that you ever heard those rumors. The course has been completely revamped this quarter, and you now have twice as long to do your projects (though this also means that there will be more components to the homework projects). This is not necessarily bad, as we are also transitioning to modern OpenGL. This means that there is a lot of OpenGL calls you no longer need to worry about.
Lastly, if you are not familiar with C++, try and brush up on it. Look back at your CSE 100 notes/assignments and be excited to do a lot of C++ programming this quarter! Really, you're going to appreciate all those data structures you previously used in CSE 100. Especially std::vector. If you're not sure how to use std::vector, I recommend brushing up on it.