Custom Projection Matrix


I need to render some objects using a special projection, that is a like ortho in the x direction and like perspective in the y direction.

I’ve been looking for the math behind this issue, and I finally arrived to this page

which gives a nice introduction.

I thought it would be easy to come up with the matrix I need, but I was wrong. The equations used to derive each matrix (ortho an persperctive) differ in the w coordinate, so I can’t figure out how to mix them.

Can anyone give me some insight on this, or suggest o book or link where to look?

Thanks a lot

There’s no way to combine an ortho and perspective projection in the same matrix. Both kinds of projections are followed by a homogeneous divide determined by the product of 4th row of the projection matrix and the eye-space vertex position (which amounts to -1 for ortho, -z for perspective). See the redbook appendices for the actual matrices. As long as the division is a function of z, you’ll get perspective foreshortening.

What kind of effect are you after here?