/
readme.html
74 lines (56 loc) · 2.37 KB
/
readme.html
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
<!DOCTYPE html>
<html>
<head>
<title>Exercise 5 - Introduction to computer graphics</title>
<style>
body {
background-color: #101010;
color: #F0F0F0;
font-family: Helvetica;
max-width: 800px;
margin-left: auto;
margin-right: auto;
padding: 10px;
}
h1 {
background-color: #F0F0F0;
color: #101010;
padding: 10px;
text-align: center;
}
h2 {
margin-top: 1.5em;
}
.center {
text-align: center;
}
img {
box-shadow: 0px 0px 15px white;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
</style>
</head>
<body>
<h1>Introduction to computer graphics</h1>
<p>
by Amos Wenger and Javier Martín de Valmaseda
</p>
<h2>4.1 Introduction</h2>
<h2>4.2 Toon-Shading</h2>
<p>In this exercise we only have to follow the instuctions of the assignement. </p>
<p>L and N was given to us, and we need to calculate the diffuse coefficient D = max(dot(N,L) ,0) to do a lookup in a 1D texture.
The final color is the 1D texture multiplied by the previous calculated color.</p>
<h2>4.3 Contour</h2>
<h3>4.3.1 Linear Depth</h3>
Since the camera is looking along the negative Z axis, taking the z coordinate of a given vertex and scaling it according to the far plane and near plane uniforms was enough.
<p>depth = - ( vertex.z - near ) / ( far - near );</p>
<h3>4.3.2 Edge Detection</h3>
<p>This exercise was a bit confusing at first, but reading articles from Wikipedia and careful review of the statement led us to the solution.</p>
<p>We added two auxiliary functions for the purpose of the Prewitt operator computation: I(i, j) retrieves a given point of the texture, using dx and dy - set in the C++ code to be the width and height of a pixel in world coordinates. And C(m, i, j), which computed 2D discrete convolution, given a matrix and x, y coordinates in the texture image.</p>
<p>Finally we computed the final color applying the equation 1 -10* M(i, j) as given in the statement to obtain a rudimentary contour of the edge.</p>
<h3>4.4 Blending</h3>
<p>As the assignement says we have to multiply the toon-shading image (cartoonColor) and the edge image (edgeColor) and that's it.</p>
</body>
</html>