CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi
Graphics Pipeline Transform vertices Light vertices Clip to Window extremes Setup edges Rasterize Fill and interpolate colors, depth Test against Z-buffer One entry per pixel: closest so far Update Color and Z buffers
Light Vertices Color Light Direction normal Point Directional Or Both View Direction
Lighting in which space? +1 -1 z=1 Near Plane Far Plane Projective? Distances get distorted Clip coordinates Normalized device coordinates Screen? World Camera -1
Homogeneous Space Clipping Clip coordinates = projective coordinates -1 < x/z < +1 (after perspective divide) -1 < x/w < +1 (clip) -w < x < w -w < y < w 0 < z < w
Rasterize x0,y0,z0 y = mx + c x = 1/m(y+c) =ay+b x2,y2,z2 x+1 = ay+a + b = x + a zp-zl xp-xl zr-zl xr-xl = x1, y1,z1 zp+1 = zp + k
Perspective Distortion z2 z1
Perspective Distortion
Perspective Correction Linear interpolation: p(t) = p1 + (p2 – p1) t, 0 <= t <= 1 Screen space interpolation: ys = y1s + t (y2s – y1s) y/z = y1/z1 + t (y2/z2 – y1/z1) But also: y = y1 + u (y2 – y1) z = z1 + u (z2 – z1)
Perspective Correction
Perspective Correction
Perspective Correct Z
Perspective Corrected