Calculating ? (LOD)
From triangle slope calculations, we know
ds/dx, ds/dy, dt/dx, dt/dy
where (s,t) are the texture coordinates. Then
?u/?x = ds/dx * width ?v/?x = dt/dx * height
?u/?y = ds/dy * width ?v/?y = dt/dy * height
where width, height are the maximum size texture map (LOD = 0). Remember that width, height are powers of two, so the above multiplications are simply shifts.