Oblique projections

Hey all,

I’ve been banging my head against this problem all day, so I guess it’s time to call in the cavalry. :slight_smile:

I’m working on a game that requires an oblique (forced depth) camera view and I can’t for the life of me figure out the correct projection matrix. My many attempts have centered around taking a standard orthographic projection and modifying the third column of the first two rows of the matrix (as shown in the Wikipedia article on Cabinet Projection) so that the x and y coordinates are projected at a fixed angle based upon the z coordinate. While this does force all of the scene geometry to be rendered from the desired oblique perspective, the view frustum gets all messed up. And by all messed up, I mean being translated several hundred units away from the camera’s origin point for no apparent reason. :stuck_out_tongue: This is shown both in Unity’s Scene view and by the values returned from the screen-to-world coordinate conversion functions. Oddly enough, this doesn’t affect the rendering at all, which has led me to believe that I’m improperly constructing the projection matrix in a way that OpenGL/Direct3D is fine with but Unity’s internal matrix math isn’t so keen on.

I’m hoping that some kind soul can spare some sample code showing a working (in Unity) oblique projection matrix, or at least point me in the right direction for understanding projection matrices better. :slight_smile:

After some additional thought and a good night’s sleep, I believe that I’m finally starting to understand the problem that I ran into. I’m now thinking that my oblique projection matrix is indeed “correct”, at least in the since that it performs the desired mathematical transformation to a given 3D coordinate. The problem seems to lie in the nature of oblique projections themselves, or perhaps more specifically the difficulty (impossibility?) inherent to reversing the transformation they apply. This would explain why my scene geometry renders correctly, but the screen-space to world-space helper functions (such as ScreenPointToRay()) don’t operate the way I expected them to.

I could be way off base here, but in any case I’m just going to do an end run around the problem by writing my own “what’s under the mouse cursor” function that operates against the 2D projection of a scene, as opposed to the normal method of casting a ray from the cursor point into the 3D world space and finding out what it hits. :stuck_out_tongue: