clip space: such that xyz [-1, 1] after division w [near, far] => [-near, far] -|w| < x/y/z < +|w| x and y have two valid regions (in front and behind the camera) z only has one valid region - load and transform triangle vertices - init interpolators - store in output buffer (6 words) clip buffer layout 0 pos[1] 1 coef[1] 0 0 1 0 2 pos[2] 3 coef[2] 0 0 0 1 4 pos[0] 5 coef[0] 0 1 0 0 VI03 input poly pointer VI04 input poly end/output poly start VI05 ?full clip flag VI07 output buffer pointer VI08 output poly pointer VI09 final vertex count Expand: poly: input buffer -> ExpandBuffer (NB: max 42 verts, 0x54 qws, bigger than buffer!) mesh ExpandBuffer -> ClippingBuffer Process: ClippingBuffer -> ExpandBuffer Zmin - near ----------- VF06.xy: p0.z, p1.z VF07.xy: p01.xy - near VF08: p2 (next p1) VF16: p0 VF17: c0 VF18: p1 VF19: c1 VF20.xyz: interpolated clip pos VF20.w: p1.z-p0.z interpolation: (p0.z * (p1.z-near) - p1.z * (p0.z-near)) / (p1.z - p0.z) = (p0.z * (p1.z-near) + p1.z * (near-p0.z)) / (p1.z - p0.z) Zmax - far VF06.xy: -p0.z, -p1.z VF07.xy: far - p01.xy interpolation: (p0.z * (far-p1.z) - p1.z * (far-p0.z)) / (p0.z - p1.z) = (p0.z * (far-p1.z) + p1.z * (p0.z-far)) / (p0.z - p1.z)