# scarey projection matrix!

This topic is 4934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, Given a projection matrix (I'm using directX) I need to be able to grab the parameters used to create this matrix, in terms of: Near plane, Far plane, top, bottom, right, left. Where top, bottom, right and left are distances along the x and y axes in camera space. I already know the near and far values which should make it somewhat easier. Now I understand the projection matrix converts from camera space to normalised coordinates, which in DirectX range from -1.0 to 1.0 in the x and y axes, and from 0.0 to 1.0 along the z, with the viewer facing along positive z. So my idea was to invert the projection matrix, and feed the following vectors through: (1.0, 1.0, 0.0, 1.0), and (-1.0, -1.0, 0.0, 1.0) The idea being that these will come out with the right & top values in camera space in the first vector, and bottom and left values in the second vector. This 'sort-of' works, but the FOV seems slightly wider than with the original matrix - if I take a screen capture with the original camera, then make a new camera from parameters extracted from the original and take another screen capture, the two don't quite match up. There must be something I've missed here! Anyone have any idea as to what? Ta :) [Edited by - Hinch on February 9, 2005 11:50:11 AM]

##### Share on other sites
Make sure you're not confusing vertical with horizontal FOV and take aspect ratio into account. Depending on how you calculate FOV you might also have forgotten to halve or double it before re-configuring your camera with the extracted parameters.

##### Share on other sites
Hmm nice thinking, but I've already tried both of those. :) The FOV difference is a lot more subtle than would be caused by either of those bugs anyway - it's only very slightly off. At first glance, the new image appears identical but after looking at certain details it's possible to see differences - it's actually quite fun trying to spot them. (I know, very sad) :P

I'm beginning to think it might be caused by build-up of floating point error since it's such a small difference, and also because it seems to vary between Release and Debug builds where there are different floating-point roundoff errors.

1. 1
2. 2
3. 3
frob
12
4. 4
5. 5
Rutin
10

• 13
• 14
• 65
• 14
• 15
• ### Forum Statistics

• Total Topics
632130
• Total Posts
3004284

×