Assignment 7: Rasterization solution

$30.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

Exercise 1 [7 points]
Let the camera opening angle be π/2 radians and the image be 10 × 10 pixels large. Which pixels does the
midpoint algorithm described during the lecture (without anti-aliasing) set for the line from p1 = (−1, −1, 2)
to p2 = (7, 1, 10), given in global coordinates? Assume that we index pixels starting from top-left corner, i.e.,
the top-left pixel has indices (1, 1) and the bottom-right one (10, 10).
• What is the z-value associated with the middle pixel (along the horizontal direction) of the line?
• Assuming that the p1 should be rendered in red, rgb = (1, 0, 0), and p2 in green, rgb = (0, 1, 0), what is
the color of the middle pixel?
Provide calculations using perspective interpolation.
Exercise 2 [8 points]
During the lecture, we discussed a triangle rasterization algorithm which uses barycentric coordinates to
determine whether the pixel center lies inside the rasterized triangle. One problem, which we discussed in the
class, is that the computation of the barycentric coordinates from scratch for every pixel is expensive. Derive
an incremental approach to solve this problem. More precisely, assuming that you know the barycentric
coordinates of the pixel (x, y), derive the formula that updates these coordinates such that they are valid for
pixels (x + 1, y) and (x, y + 1). Note that a similar trick we used to avoid unnecessary evaluations of the
implicit line equation during line rasterization. Using your derivation, write a pseudo code of the whole
triangle rasterization algorithm assuming that your input are three vertices in the global coordinate space
given in the counter-clockwise order. You can assume that your algorithm should color the pixels whose
centres lie inside the triangle, and there is no pixel centers lying exactly on one of the triangle edges.
Submission
Submit a single PDF including all the calculations you did do solve the assignments to iCorsi. You are allowed
to use calculator.
Solutions must be returned on November 10, 2022 via iCorsi3