A note on the dc/dx calculations in the example sources. [In the text c is used as a template for any variable that will be interpolated linearly, ie u and v in a linear tmapper and 1/z, u/z and v/z in a perspective corrected tmapper] (dc/dx = change in c per change in x, ie horizontal increase value for c) if p1, p2 and p3 form a triangle with an area > 0 (so that it is neither a line nor a point) and y1 <= y2 <= y3, then there is a point along the edge y1->y3 which has y = y2. Computing XYC for this point gives: x4 = (x3 - x1) * (y2 - y1) / (y3 - y1) + x1 y4 = y2 c4 = (c3 - c1) * (y2 - y1) / (y3 - y1) + c1 Then computing dc/dx from this gives: dc/dx = (c4 - c2) / (x4 - x2) dc/dy along one or two edges will later need to be computed; dc1/dy1 = (c2 - c1) / (y2 - y1) dc3/dy3 = (c3 - c2) / (y3 - y2) or dc2/dy2 = (c3 - c1) / (y3 - y1) Taking the expression for dc/dx in the above paragraph and performing a little formula rewriting gives the following expression: (c3 - c1) * (y2 - y1) - (c2 - c1) * (y3 - y1) dc/dx = --------------------------------------------- (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1) Swapping X and Y axes gives dc/dy: (c3 - c1) * (x2 - x1) - (c2 - c1) * (x3 - x1) dc/dy = --------------------------------------------- (y3 - y1) * (x2 - x1) - (y2 - y1) * (x3 - x1) Rewriting it a tiny bit gives an expression more coherent to dc/dx: (c2 - c1) * (x3 - x1) - (c3 - c1) * (x2 - x1) dc/dy = --------------------------------------------- (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1) After this the slopes along the edges can be written as follows instead, since a step along one of the edges means stepping dx/dy pixels along the x axis and 1 pixel along the y axis: (for 2 edges) dc1/dy1 = dc/dx * dx1/dy1 + dc/dy dc3/dy3 = dc/dx * dx3/dy3 + dc/dy (or if it's just 1 edge needing calculation) dc2/dy2 = dc/dx * dx2/dy2 + dc/dy One will probably use the "normal" dc/dy formulas though, as they are a little shorter, yet they provide almost the same accuracy and functionality. The advantage of the second method is that there are fewer special cases needed to check for (the dc/dx and dc/dy formulas work correctly even if any of the yb - ya expressions are 0). Numerical stability is another plus here (when deltas in Y-direction are very small). The main disadvantage is that it requires more computations.