Status – Week 280 Victor Moya
Rasterization Setup triangles. Setup triangles. Fill triangle: Interpolate parameters. Fill triangle: Interpolate parameters. Parameters: R, G, B, z, r, s, t, q. Parameters: R, G, B, z, r, s, t, q.
Pixel Planes Calculate 3 edge functions: if all the edge functions are positive in a point (x, y) the point is inside the triangle. Calculate 3 edge functions: if all the edge functions are positive in a point (x, y) the point is inside the triangle. E(x, y) = (x – X)dY – (y – Y)dX E(x, y) = (x – X)dY – (y – Y)dX E(x, y) > 0 if (x, y) is to the “right” side. E(x, y) > 0 if (x, y) is to the “right” side. E(x, y) = 0 if (x, y) is exactly on the line. E(x, y) = 0 if (x, y) is exactly on the line. E(x, y) < 0 if (x, y) is to the “left” side. E(x, y) < 0 if (x, y) is to the “left” side. Incrementally: Incrementally: E(x + 1, y) = E(x, y) + dY E(x + 1, y) = E(x, y) + dY E(x, y + 1) = E(x, y) - dX E(x, y + 1) = E(x, y) - dX
Classification (xi, yi) 0 < i <= N (xi, yi) 0 < i <= N (x0, y0) = (xN, yN) (x0, y0) = (xN, yN) dXi = Xi – X(i-1) dXi = Xi – X(i-1) dYi = Yi – Y(i-1) dYi = Yi – Y(i-1) Ei(Xs, Ys) = (Xs – Xi)dYi – (Ys – Yi)dXi Ei(Xs, Ys) = (Xs – Xi)dYi – (Ys – Yi)dXi 0 < i <= N 0 < i <= N E(x + 1, y) = Ei(x, y) + dYi E(x + 1, y) = Ei(x, y) + dYi E(x - 1, y) = Ei(x, y) - dYi E(x - 1, y) = Ei(x, y) - dYi E(x, y + 1) = Ei(x, y) - dYi E(x, y + 1) = Ei(x, y) - dYi E(x, y - 1) = Ei(x, y) + dXi E(x, y - 1) = Ei(x, y) + dXi Ei >= 0 for all 0 = 0 for all 0 < i <= N Traverse the area of the polygon: bounding box or advance to the next line. Traverse the area of the polygon: bounding box or advance to the next line.
Olano and Greer Triangle Scan Conversion using 2D Homogeneous Coordinates Triangle Scan Conversion using 2D Homogeneous Coordinates Based in Pixel Planes (Pineda) approach but using homogeneous coordinates. Based in Pixel Planes (Pineda) approach but using homogeneous coordinates. Avoids the need of clipping. Avoids the need of clipping. Adds a hither edge function. Adds a hither edge function. Perspective correct interpolation. Perspective correct interpolation.
Algorithm To summarize the algorithm: To summarize the algorithm: setup: setup: three edge functions = M-1 three edge functions = M-1 = inverse of 2D homogeneous vertex matrix for each clip edge = inverse of 2D homogeneous vertex matrix for each clip edge clip edge function = dot product test * M-1 clip edge function = dot product test * M-1 interpolation function for 1/w = sum of rows of M-1 interpolation function for 1/w = sum of rows of M-1 for each parameter for each parameter interpolation function = parameter vector * M-1 interpolation function = parameter vector * M-1 pixel processing: pixel processing: interpolate linear edge and parameter functions interpolate linear edge and parameter functions where all edge functions are positive where all edge functions are positive w = 1/(1/w) w = 1/(1/w) for each parameter for each parameter perspective-correct parameter = parameter * w perspective-correct parameter = parameter * w