Exercise 5 of Introduction to Computer graphics course.
C C++ Other
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
src
visualstudio
.gitignore
ICGexercise5.pdf
readme.html

readme.html

<!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>