-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.tex
178 lines (144 loc) · 7.63 KB
/
report.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{extramarks}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage[plain]{algorithm}
\usepackage{algpseudocode}
\usepackage{booktabs}
\usepackage{tikz}
\usepackage{hyperref}
\usetikzlibrary{automata,positioning}
%
% Basic Document Settings
%
\topmargin=-0.45in
\evensidemargin=0in
\oddsidemargin=0in
\textwidth=6.5in
\textheight=9.0in
\headsep=0.25in
\linespread{1.1}
\pagestyle{fancy}
\chead{\hmwkClass\ (\hmwkDetails): \hmwkTitle}
\rhead{\firstxmark}
\lfoot{\lastxmark}
\cfoot{\thepage}
\renewcommand\headrulewidth{0.4pt}
\renewcommand\footrulewidth{0.4pt}
\setlength\parindent{0pt}
%
% Create Problem Sections
%
\newcommand{\enterProblemHeader}[1]{
\nobreak\extramarks{}{Q \arabic{#1} continued on next page\ldots}\nobreak{}
\nobreak\extramarks{Q \arabic{#1} (continued)}{Q \arabic{#1} continued on next page\ldots}\nobreak{}
}
\newcommand{\exitProblemHeader}[1]{
\nobreak\extramarks{Q \arabic{#1} (continued)}{Q \arabic{#1} continued on next page\ldots}\nobreak{}
\stepcounter{#1}
\nobreak\extramarks{Q \arabic{#1}}{}\nobreak{}
}
\setcounter{secnumdepth}{0}
\newcounter{partCounter}
\newcounter{homeworkProblemCounter}
\setcounter{homeworkProblemCounter}{1}
\nobreak\extramarks{Q \arabic{homeworkProblemCounter}}{}\nobreak{}
%
% Homework Problem Environment
%
% This environment takes an optional argument. When given, it will adjust the
% problem counter. This is useful for when the problems given for your
% assignment aren't sequential. See the last 3 problems of this template for an
% example.
%
\newenvironment{homeworkProblem}[1][-1]{
\ifnum#1>0
\setcounter{homeworkProblemCounter}{#1}
\fi
\section{Q \arabic{homeworkProblemCounter}}
\setcounter{partCounter}{1}
\enterProblemHeader{homeworkProblemCounter}
}{
\exitProblemHeader{homeworkProblemCounter}
}
%
% Homework Details
% - Title
% - Due date
% - Details
% - Section/Time
% - Instructor
% - Author
%
\newcommand{\hmwkTitle}{Assignment\ \#3}
\newcommand{\hmwkDueDate}{Dec 5, 2015}
\newcommand{\hmwkClass}{CSC418}
\newcommand{\hmwkDetails}{Computer Graphics}
\newcommand{\hmwkClassInstructor}{Professor Karan Singh }
\newcommand{\hmwkAuthorNameA}{Ning Mao}
\newcommand{\hmwkAuthorStudentNumberA}{999055515}
\newcommand{\hmwkAuthorNameB}{Sherry Shi}
\newcommand{\hmwkAuthorStudentNumberB}{999064033}
%
% Title Page
%
\title{
\vspace{2in}
\textmd{\textbf{\hmwkClass:\ \hmwkTitle}}\\
\textmd{\textbf{\hmwkDetails}}\\
\normalsize\vspace{0.1in}\small{Due\ on\ \hmwkDueDate\ at 11:59pm}\\
\vspace{0.1in}\large{\textit{\hmwkClassInstructor}}
\vspace{3in}
}
%\author{\textbf{\hmwkAuthorNameA\ \hmwkAuthorStudentNumberA\ \hmwkAuthorNameB\ \hmwkAuthorStudentNumberB}}
\author{
\textbf{\hmwkAuthorNameA}
\texttt{\hmwkAuthorStudentNumberA} \\
\textbf{\hmwkAuthorNameB}
\texttt{\hmwkAuthorStudentNumberB}
}
\date{}
\renewcommand{\part}[1]{\textbf{\large Part \Alph{partCounter}}\stepcounter{partCounter}\\}
%%
%% Various Helper Commands
%%
%
%% Useful for algorithms
%\newcommand{\alg}[1]{\textsc{\bfseries \footnotesize #1}}
%
%% For derivatives
%\newcommand{\deriv}[1]{\frac{\mathrm{d}}{\mathrm{d}x} (#1)}
%
%% For partial derivatives
%\newcommand{\pderiv}[2]{\frac{\partial}{\partial #1} (#2)}
%
%% Integral dx
%\newcommand{\dx}{\mathrm{d}x}
%
%% Alias for the Solution section header
%\newcommand{\solution}{\textbf{\large Solution}}
%
%% Probability commands: Expectation, Variance, Covariance, Bias
%\newcommand{\E}{\mathrm{E}}
%\newcommand{\Var}{\mathrm{Var}}
%\newcommand{\Cov}{\mathrm{Cov}}
%\newcommand{\Bias}{\mathrm{Bias}}
\begin{document}
\maketitle
\pagebreak
\section{Part A: Basic Ray-Tracer}
Ray-Tracer was implemented first by transforming ray to world space by making use of viewToWorld matrix. Then UnitSquare and UnitSphere intersect methods were implemented. The UnitSquare intersection was determined by first transforming the ray.dir to local space, and compute its intersection with the plane, then finally check if the intersection falls within the unit square. The UnitSphere intersection was determined using basic trigonometry principles and the closest point is chosen if there are 2 intersections. Finally, shade method was implemented for PointLight. The basic logic was derived from Phong shading principles taught in class. Each lighting property was computed separately by taking into account of their corresponding material properties and then combined them together to determine the ray's colour component.
\section{Part B: Free-from Visualization: Game of Life 3D - Design Report}
The design of this project can be broken down into 3 parts. The basic game logic implementation, lighting effect implementation and native physics effect rendering.\\
This project is currently live at \url{http://neomorning.com/GOL_CSC418/gameOfLife.html}\\
\textbf{Basic Game Logic Implementation}\\
The skeleton of this game is a fork from \url{https://github.com/samlev/3DGameOfLife}. We made following alterations based on the original framework. First of all, we introduced the concept of virus into the game. If the "Inject Virus" button is pressed, a infected cube would be randomly injected into the group, and it is labelled by black. All the cubes and children cubes next to the infected cube would be infected in the next iteration. As a result, the viewer can watch the propagation of this viral infection in a span of several iterations. Secondly, we added user interactiveness in terms of the control of the evolution rules. Users can change the style or speed of evolution by changing the parameters to the fundamental Game of Life rules. Thirdly, we made major optimization in computing evolution iterations. We reduced many of the multiplication and division operations that were in the original project. Also, instead of searching all neighbours of all cells each time to determine the number of living neighbours the current cell has, we keep a count of the number of neighbours each cell currently has in memory. We update this information each time a cell is born or a cell dies. This way, the runtime for determining whether a cell is alive is reduced by up to 26 times, as it is now just a lookup instead of searching through up to 26 of its neighbours.
\textbf{Visual Effect Implementation}\\
There are several factors that determine the appearance of each block. By default, the blocks are single-coloured, and the colour is randomly chosen but somewhat related to its position. The materials are rendered using the Phong illumination model. By default, the specular component is set to 0xcccccc, and the shininess to 100. In "texture" mode, the blocks are texture mapped with a random texture, and the material properties are chosen based on the texture. For example, the brick texture has a shininess of 5 and the wooden floor texture is set to a shininess of 100.
For lighting, we included a soft ambient light and two spot lights to create shadows. All light sources emit grayscale coloured lights.
\textbf{Physics Effect Rendering}\\
We have coded up two major physics effects into this visualization. In "Gravity Fall" mode, 5\% of dead cells are put into a separate array. At each frame update, they are being rotated to a randomized direction and they are being translated a distance calculated using the acceleration due to gravity. The "explosion" mode is partially based on the code sample \url{http://codepen.io/Xanmia/pen/DoljI#0}. In this mode, 5\% of dead cells burst into particles at each iteration. The particles would first be dispersed into all directions, then at a certain distance, they would start to fall toward to the ground instead.
\end{document}