UNC Pixel Planes designed by Prof. Henry Fuchs et al
Pixel Planes Henry Fuchs’ Idea: build processing into the frame buffer, a processor per pixel. –UNC designs are called enhanced memories, not SIMD processors Enabler was linear expression tree…
Representation of a triangle Oriented Triangles, three vertices A, B, C A triangle is defined by Lines AB, BC, and CA For example, let A = (0, 0), B=(10, 0), C = (2, 5) Line AB = (0,0) + (10, 0)*t Let X = 10t, Y = 0, so Line AB => Y =0; Line BC = (10, 0) + (-8, 5)*t = (10-8t, 5t) Let X = 10 -8t, Y = 5t, so, line BC => -5X-8Y + 50=0 Similarly Line CA = (2, 5) + (-2, -5)*t So, Line CA => 5X - 2Y = 0 Distance from point (U,V) to Line CA is ?
Point to line distance (2D) AX + BY +C = line K Point (U, V) What is the distance from (U,V ) to line K? Answer: (AU + BV +C)/M M = sqrt (A*A + B*B)
Distance with a sign: for a point within a triangle, all minus, or all positive signs for its distance, assuming each line with a normal vector.
Shading with fast evaluation of AX + BY + C = 0 Flat shading: constant color, A = B = 0, C = Color Gouraud shading (smooth shading): color interpolation, for example, Triangle with three vertices (x1, y1), (x2, y2), (x3, y3), each with red components R1, R2, R3 color is represented as (Red, Green, Blue) Assuming a plane (in 3D) with vertices (x1, y1, R1), (X2, Y2, R2), and (X3, y3, R3)
Gouraud shading Vector equation of the plane is (x,y) = s (x2-x1, y2 – y1) + t(x3-x1, y3-y1) + (x1, y1) solved for (s, t), then s = A1x + B1y +C1, t = A2x + B2y +C2 So, given point (x,y) in this plane, what is its color? Answer: color = Ax + By +C, where A = A1 (R2-R1)+ A2 (R3-R1) B = B1(R2-R1) + B2 (R3-R1) C = C1(R2-R1) + C2(R3-R1) + R1 So, we then broadcast A, B, C into this Pixel-Planes, and the red components for each pixel is done!
How is the color calculated? Since, (x,y) = s (x2-x1, y2 – y1) + t(x3-x1, y3-y1) + (x1, y1) Therefore, (x,y, R) = s (x2-x1, y2 – y1, R2-R1) + t(x3-x1, y3- y1, R3-R1) + (x1, y1, R1) or, color R = s (R2-R1) + t (R3-R1) + R1
Three vertices: (0,0) (2,4), and (6,2) with red colors 10, 50, 20 Given point (2,2) inside the triangle, the color is 28! (since s = 0.4, t = 0.2) Goven point (x, y), the color is ? Represented as Ax + By +C, what are the values of (A, B, C)? Hint:A = -2, B= 11 and C= 10
Implementation
Shading
Hardware design
Pixel-Planes Communications & Multimedia Lab23
Bit operation Binary representation: for easy hardware architecture/realization Right most significant bit, and shift left at each clock! Eg.: 011 equals 6 in Decimal equals equals equals 30 in Decimal (all zeros at the right ends: redundant, for pipeline operations) Communications & Multimedia Lab24
011 equals 6 in Decimal After left shift one bit, it is 110 (one 0 added to the right), the value is 3! equals 6, left shift one bit, becomes 11000, value is equals 10, left shift one bit, becomes 1010, value is equals 30 in Decimal, left shift one bit, becomes , value is 15.
One bit adder For example: = A 01010= C A+ C = Carry = 0 Value of A is 6, value of B is 10, A + C = 16 Left shift one bit (one time per clock trigger)