mtx mat = world * cameraTranslate * cameraRotate * persp * ortho;float s = 0.0f;for (int i = 0; i <= 10; i++){ vec4 q(-5,0,0), Q(5,0,0); q *= mat; Q *= mat; float wt = 1.0f/q.w + s*(1.0f/Q.w - 1.0f/q.w); wt = 1.0f/wt; ... s += 0.1f;
(during wt computation, q.w and Q/w contain view-space Z-values [both are < 0 since I have right-handed coordinate system])
And the perspective and ortho matrices:
mtx persp(-near, 0.0f, 0.0f, 0.0f, 0.0f, -near, 0.0f, 0.0f, 0.0f, 0.0f, -near-far, 1.0f, 0.0f, 0.0f, -near*far, 0.0f);mtx ortho(2.0f/(right-left), 0.0f, 0.0f, 0.0f, 0.0f, 2.0f/(top-bottom), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f/(far-near), 0.0f, -(right+left)/(right-left), -(top+bottom)/(top-bottom), -(near+far)/(far-near), 1.0f);
Thoeretically, for such a positioning of points in screen-space:
q... . . .Q
I should get values like:
-10 -9.5 -9 -7 -3 -1
But I get:
-10 -6 -4 -2 -1.5 -1
So it looks a bit "inversed" and I can't figure out why
[Edited by - maxest on November 14, 2010 7:46:22 AM]