# COMS W4162 Advanced Computer Graphics

Fall 2014, Columbia University

MW 2:40pm-3:55PM, 627 Seeley W. Mudd Building

Instructor: Changxi Zheng

Office Hours

## Schedule

3Sep Introduction slides
8Sep Raytracing slides Ray-box Intersection, Cook-Torrance Model, Rendering Concepts
15Sep Monte Carlo integration slides [Kajiya 86] Paper list available
17Sep Importance Sampling slides Multiple Importance Sampling
22Sep Volume Scattering
24Sep Participating Media   PA-1 released
29Sep Texture synthesis Texture synthesis in production
1Oct Paper discussion
6Oct Texture synthesis [Wei and Levoy], [Lefebvre and Hoppe], state of the art review
8Oct Mesh processing
13Oct Mesh simplification [Hoppe 99]
15Oct Surface reconstruction state of the art survey, [Alexa et al. 03]
20Oct --- No class ---   PA-2 released
22Oct Introduction of FEM FEM Tutorial
27Oct Paper discussion
29Oct FEM and Poisson Equation   Final Project Proposal due
5Nov Basics of Continuum Mechanics Infinitesimal strain
10Nov Physics-based Deformable Simulation
12Nov Model Reduction
17Nov Modal Analysis for Sound Synthesis Modal Analysis PA-3 released
19Nov Sound synthesis
24Nov Paper discussion
26Nov SPH Fluids SPH theory, SPH survey
1Dec SPH Fluids
3Dec Fluids
8Dec Introduction of vortex method a survey, [Weibmann and Pinkall]

There will be 3 programming projects during the semester and a final project. For the programming projects, you will be asked to implement some computer graphics algorithms. For the final project, you will propose a project which involves advanced graphics techniques and implement it. All projects will be submitted to courseworks.

In this semester, we will have three paper-presentation sessions (see the schedule). You will be read some research papers and present them in class.

#### Introduction

In this assignment, you will implement a few Monte Carlo rendering algorithms. To help you make progress, we split the whole assignment into two parts. In part 1, the focus is the multiple importance sampling algorithm. In part 2, you will implement a simple volume rendering algorithm.

#### Task 1: Multiple Importance Sampling

Due: Saturday, 4th Oct. 2014 (11:59pm)

In this task, you need to implement the multiple importance sampling as we discussed in class. A working rendering system has many components and details. And it will be quite a challenge to implement the entier system. To ease your start, I have prepared a starter code, which has most of the parts implemented except a few critical algorithms. The starter code is in Java. Once you downloaded it, you should be able to compile it. For example, if you have Apache Ant installed, then just type

ant
java -cp build/classes/ ray.ParaRayTracer scene/monkey.xml

to see a demo of Ambient occlusion renderer.

Code of Finish: There are three .java files which you need to fill in the code:

• ray.renderer.LuminairesIlluminator for a luminaire sampling algorithm.
• ray.renderer.KajiyaPathTracer for a Kajiya Path Tracer for global illumination that we discussed in class.
• ray.MultipleIlluminator for direction illumination but with multiple importance sampling.
I have labelled the code segments using 'TODO' to indicate where you need to start coding.

Usage of Renderer: All the rendering algorithms are implmented as a plugin in the system. In a XML scene file (many example scene files are located in scene directory in the starter code), you can specify which algorithm to use as well as the geometry and camera parameters. You should look at the files in scene/ to understand how to configure a renderer. To run the renderer, you can use either of two java classes,

java -cp build/classes/ ray.RayTracer "scene file"
java -cp build/classes/ ray.ParaRayTracer [-s N] "scene file"

The former is a single-thread renderer to ease your debugging, and the latter is a multi-thread parallel renderer to shorten your rendering time. You use the "-s" option to specificy the number of rendering threads, and by default, it uses all available CPU cores on your machine.

From left to right: images rendered using BRDF sampling, luminaire sampling and multiple importance

Images to Submit: In your submission, you should include at least 10 images:

• 3 of them are rendered using plates.xml with BRDF sampling, luminaire sampling, and multiple importance respectively,
• 3 of them are rendered using three-spheres.xml with the three sampling strategies,
• another 3 images are rendered using three-sphere-glossy.xml with the three sampling strategies,
• 1 images rendered using cbox.xml with ray.renderer.KajiyaPathTracer.
The width of these images should be at least 640px. You are also encouraged to include other images you created by your own to earn higher grades. Whatever images you submit, please also include the scene files that are used to generate them.

When you create your own scene files, you might need to create ".msh" file to describe a triangle mesh. To this end, I provide a simple python script obj2msh.py to transform a ".obj" mesh file into a ".msh" file.

Results of three-sphere.xml and three-sphere-glossy.xml rendered using multiple imporance sampling

Due: Tuesday, 14th Oct. 2014 (11:59pm)

In this task, you need to implement a basic volume rendering algorithm as discussed in class. In particular, you need to finish the code in java files:

• ray.render.DirectOnlyMediumRenderer to implment the algorithm of volume rendering.
• ray.render.LuminairesIlluminator for the direct scattering using phase function and incident radiance from the light source.

Images to Submit: In this part of your submission, you should include at least 2 images:

• One image rendered using cbox-vol.xml
• One image rendered using cbox-shaft-vol.xml
Again, the width of these images should be at least 640px. You are also encouraged to include other images you created by your own to earn higher grades. Whatever images you submit, please also include the scene files that are used to generate them.

#### Handing in

Submit a zip file containing your solution using Courseworks

You should include in your zip a few parts, including:

• A document discribing how you implment the algorithms, the mathematical formulas you are following, any reference you have used, and anything else you want us to know.
• A well-commented source code.
• A gallery of images that you generated (see details above).
##### Due: Wednesday, 29th Oct. 2014 (11:59pm)

In this assignment, you will implement a mesh simplification algorithm. The core algorithm is detailed in [Garland and Heckbert 97], which we also talked in class.

Code of Finish: There are two C++ files which you need to fill in the code (I have put a "TODO" in the functions where you need to add your code):

• EdgeCollapsibleTriMesh.hpp for collapsing an edge into a vertex in the half-edge data structure
• GarlandMeasurer.hpp to implment the quadrics and cost computation

Bonus Points: The full points is 100 for this assignment. In addition to that, there are 25 points for implmenting an advanced version, by considering attributes in the siimplification. The algorithm follows [Hoppe 99]. In particular, you need to finish the code in HoppeMeasurer.hpp. I have put a "TODO" in the functions where you need to add your code.

In this task, I have prepared the starter code in C++. The main directory where you need to add your implementation is in src/remesh. After downloading it, you should be able to compile it using most C++ compiler. In particular, if you have CMake installed, you can type

mkdir build && cd build
cmake ..
make


Required External Libraries: The starter code uses two libraries: Boost and Eigen. You need to install them if you haven't had them. If you install Eigen in some directory (say DIR), then you specify them by replacing the command line above by

cmake -DEIGEN_ROOT=DIR ..

After compiling the code successfully, an executable, mesh_simp is located in build/bin. And if you type "mesh_simp -h", it shows you how to use it
Usage: mesh_simp [options]
Simplify mesh based on vibration modes

Allowed options & arguments:
-h [ --help ]         display help message
-s [ --mesh ] arg     .obj file for the triangle mesh
-a [ --attr ] arg     file for the 3x1 attributes on each vertex
-o [ --out ] arg      output obj file name

The "-a" option is only used when you implement the advanced version for bonus points.

#### Handing in

Submit a zip file containing your solution using Courseworks

You should include in your zip a few parts, including:

• A document discribing how you implment the algorithms, the mathematical formulas you are following, any reference you have used, and anything else you want us to know.
• A well-commented source code, and make sure we can compile your code. We are going to use clic machine in CS to compile it. So test the copmile before you handle in your code. If we fail to compile it, you will loose some points.
• Input and output .obj files. We will run your code on your input .obj files, but it's easier for us to get sense what your results look like before running your code.

#### Task 1: Finite Element Solver of 2D Laplace Equations

Due: 27th Nov. 2014 (11:59pm)

In this task, you need to implement a simple finite element solver of Laplace equations on 2D. The starter code has already provide you the functinality to create a triangle mesh using a polyline boundary, as well as a sparse linear system solver (using Intel's MKL). You need to implement the discretization of the Lapace operator as we discussed in class.

Code of Finish: THere is only one file that you need to finish, the fem/LaplacianOpt.hpp. Look for the "TODO" comments in that file for where to start coding. But again, you need to understand the code first.

You only need to implement the 1st-order Finite Element solver as we discussedin details in class.

Bonus Points: The full points is 100 for this assignment. In addition to that, there are 25 points for implmenting an advanced version. Instead of implmenting a 1st-order FEM solver, you can implement a 2nd-order solver. I already put some pieces of code in LaplacianOpt.hpp currently disabled by C++ macros "#ifdef LAPLACIAN_2ND". If you decide to accept the challenge and implement the 2nd-order solver, you are exempted from implementing the 1-st order solver.

Required External Libraries: The starter code uses two libraries: Boost and Eigen. You need to install them if you haven't had them. If you install Eigen in some directory (say DIR), then you specify them by replacing the command line above by

cmake -DEIGEN_ROOT=DIR ..

There are many libraries for solving a sparse linear system. Even Eigen has the feature of solving a sparse linear system. In the starter code, it uses the Direct Sparse Solver (DSS) provided by Intel MKL. So you need to install it if you decided to use it (it's free for students). Otherwise, you can use other sparse solver, for which you need to modify the code in laplace_solver.cpp.

#### Handing in

Submit a zip file containing your solution using Courseworks

You should include in your zip a few parts, including:

• A document discribing how you implment the algorithms, the mathematical formulas you are following, any reference you have used, and anything else you want us to know.
• A well-commented source code, and make sure we can compile your code. We are going to use clic machine in CS to compile it. So test the copmile before you handle in your code. If we fail to compile it, you will loose some points. Note: we need to run your code when grading. Please make sure we can compile your code.
• Two output files from your code, containing respectively the printout from your code with the two test functions (TestFunc1 and TestFunc2).

## Exams

There will be no exam in this course. Instead, there will be a final project and a presentation.

Grading: Your final grade will be a weighted average of the grades on the programming projects, final projects and paper presentation. Each programming project will account for 20% of the grade, the final project will account for 25%, and the paper presentation and discussion will account for 15%.

Questions, help, discussion: The instructors are available to answer questions, advise on projects, or just to discuss interesting topics related to the class at office hours and by appointment as needed. For electronic communication we are using Piazza (link also available at the top of this page). Please sign up for the Piazza page. When posting questions, please keep them organized by posting them to specific folders.

You're encouraged to read any published sources—books, articles, public web sites—that help you learn. If you find an idea in one of these sources that becomes part of your solution (or even gives you the whole solution), that's fine, but it is imperative that you explicitly cite the source on your homework or state it in a comment of your code. Otherwise you would be falsely claiming to have invented the idea yourself.

Academic integrity: We expect complete integrity from everyone. We assume the work you hand in is your own, and the results you hand in are generated by your program. You're welcome to read whatever you want to learn what you need to do the work, but we do expect you to build your own implementations of the methods we are studying. If you're ever in doubt, just include a citation in your code or report indicating where some idea came from, whether it be a classmate, a web site, another piece of software, or anything—this always maintains your honesty, whether the source was used in a good way or not. The principle is that an assignment is an academic document, like a journal article. When you turn it in, you are claiming that everything in it is your original idea (or is original to you and your partner, if you're handing in as a pair) unless you cite a source for it. it's never OK for you to see another student's homework writeup or another team's program code, and certainly never OK to copy parts of one person's or team's writeup, code, or results into another's, even if the general solution was worked out together.

School can be stressful, and your coursework and other factors can put you under a lot of pressure, but that is never a reason for dishonesty. If you feel you can't complete the work on your own, come talk to the professor or the TAs, or your advisor, and we can help you figure out what to do. Think before you hand in!

Clear-cut cases of dishonesty will result in failing the course.