What you have to do is compute u/z and v/z (call these s and t) at the corners and interpolate those instead of u and v. Also interpolate 1/z (call that w) instead of z.
Then, at each pixel you need to get z, and this is where the divide comes in.
At each pixel
z = 1/w
u = s*z
v = t*z
If you're doing this in fixed point, be very, very careful about number precision and ranges. 1/z is difficult to compute in fixed point as well as having a good range and precision.
Jim
Bibo ergo sum
Then, at each pixel you need to get z, and this is where the divide comes in.
At each pixel
z = 1/w
u = s*z
v = t*z
If you're doing this in fixed point, be very, very careful about number precision and ranges. 1/z is difficult to compute in fixed point as well as having a good range and precision.
Jim
Bibo ergo sum
from here: http://p205.ezboard.com/very-fast-3d-duel-screen-demo/fyabasicprogrammingfrm25.showMessage?topicID=23.topic
^^ that guy explained it, but i didnt manage to implement it.
also here are some examples:
http://p205.ezboard.com/BlitzBasic/fyabasicprogrammingfrm22
http://p205.ezboard.com/3D-Engine-Source/fyabasicprogrammingfrm22.showMessage?topicID=167.topic
(i didn't manage to learn from them)
i sound like a noob right now, but believe me, it is harder than you think. also i dont want to copy&paste the whole source code.