Projection matrix
When I set a projection matrix with a 0.0 near and a 1.0 far:
D3DXMatrixOrthoLH(&newProjection, static_cast<float>(viewport.Width), static_cast<float>(viewport.Height), 0.0f, 1.0f);
My image seems to get clipped if it is set to a position of 1.0 z, via my world matrix.
However, it does not get clipped if it is set to a position of 0.0 z, via my world matrix.
Is that how it is suppose to work?
Small detail, but I was saying 0 to 1 inclusive in my documentation, which doesn't match the behavior. It seems I have a range of 0 to 0.9999999999 (however many digits in a float) Or perhaps I have a code error?
The vertices in my vertex buffer are created with a 0.0 z.
EDIT:
I suppose this might be true for all matrices?
I haven't tried it for other types yet. Stuck in my image code right now. I do believe I set up my 3D matrix using a 0 near and 1000 far and has the same. Clipping at the z equal to far, but no clipping at 0.
You can't have the near clipping plane be zero. If you look at the math involved, this results in division by zero.
Quote:Original post by smart_idiot
You can't have the near clipping plane be zero. If you look at the math involved, this results in division by zero.
Ok, it looks like my 3D projection matrix does have a near clip of 0.1f
However, the 2D projection matrix, indeed has a near clip of 0.0f, and it runs without any errors...
Sorry, what I said shouldn't apply to an orthographic projection.
The question comes down to, should something exactly on the clipping plane be clipped, or must it be beyond it?
In fact, it's moot, because you can't trust floating point numbers to come out exactly right anyway. You should always expect slight rounding errors, so if you want things at exactly 1.0 to remain visible, you should move it back slightly, just to be safe.
The question comes down to, should something exactly on the clipping plane be clipped, or must it be beyond it?
In fact, it's moot, because you can't trust floating point numbers to come out exactly right anyway. You should always expect slight rounding errors, so if you want things at exactly 1.0 to remain visible, you should move it back slightly, just to be safe.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement