A question about <triangle scan conversion using homogeneous coordinates>

Nemesis2k

Newcomer
A question about the rasterization algorithm presented in
Olano and Greer's paper <Triangle scan conversion using homogeneous
coordinates>

In section 4.1 of Olano's paper, it is said that if an attribute
linearly varies across the triangle in 3D, it must obey the equation:

u = a*X_eye + b*Y_eye + c*Z_eye (1)

But I think that 'u' should obey the following equation instead:

u = a*X_eye + b*Y_eye + c*Z_eye + d (1*)

That is, we have an additional constant 'd' term. After all, equation (1*)
is the general form of a linear function. And I really do not understand
why we are sure that 'd' is 0.

If the equation (1*) holds, then we will have (2*) and (3*) instead (2)
and (3) in Olano's equations:
u = a*X_prj + b*Y_prj + c*W_prj + d (2*)
u/w = a*x/w + b*y/w + d/w = a*X_ndc + b*Y_ndc + c + d/w (3*)

Then I don't know how to get Olano's conclusion on coefficients for
the perspective-correct interpolation because I don't know how to handle
the 'd/w' term :(

Can anyone help me explaining this? thanks:)
 
I believe the trick is that because we're talking about a triangle, Z_eye is a linearly dependent term, which could be written as

Z_eye = a_triz * X_eye + b_triz * Y_eye + c_triz

That makes

u = (a + c * a_triz) * X_eye + (b + c * b_triz) * Y_eye + c * c_triz

So with different coefficients you can get to the

u = a_foo*X_eye + b_foo*Y_eye + c_foo

form in eye space.

The important observation though is that computing the window space parameter coefficients can be done without projecting everything into window space first. That's a pretty neat result.
 
But from u = a_foo*X_eye + b_foo*Y_eye + c_foo, we only can derive that

u = a_foo*X_eye + b_foo*Y_eye + c_foo
= a_foo*X_h + b_foo*Y_h + c_foo

and

u/w = a_foo*X_h/w + b_foo*Y_h/w + c_foo/w
= a_foo*X_ndc + b_foo*Y_ndc + c_foo/w

There is still the 'c_foo/w' term which is different from the 'c_foo' term
in Olano's paper.

I know the advantage of that paper and I hope I can get a solid
understanding of why it works besides how to use it.
 
Let's start with a plane equation in 3D homogeneous coords

u = ax + by + cz + dw (1)

Note that the last term is 'dw', not just 'd'.

This gives you a u that can be evaluated anywhere in 3DH space.
But, we really want to evaluate it on the surface of a triangle whose
z can be derived as a function of other 3:

0 = a_t *x + b_t * y + c_t * z + d_t * w (2)

or

z = -(a_t/c_t) x - (b_t/c_t) y - (d_t/c_t) * w (3)

where the *_t notation means the coefficients of the triangle's
plane equation. Plugging back into the equation for u gives an equation of
this form

u = ax + by + cw (4)

Where the coefficients in (4) are *different* from the coefficients in (1).
But (4) can be divided by w to get

u/w = aX + bY + c (5)

without changing the coefficients.
 
Back
Top