I've been trying to reverse engineer the values in the projection matrix created in OgreRenderTarget::updateMatrix and failing. There are a few things that have me stumped so far.
1) The location of non-zero values in the projection matrix don't match those in my (very limited) understanding of perspective and ortho projection matrices.
2) There are two magic numbers that I can't figure out the meaning behind.
Below is my best guess at what is in the matrix
Code: Select all
k1 = 3.732050808
k2 = 0.267949192431123
(k1*w)/h, 0, 0, -h/(2*k2)
0, -k1, 0, h/(2*k2)
0, 0, -1.666666, 0
0, 0, 1, h/(2*k2)
The reason I am trying to figure this out, is I believe the projection matrix might be slightly wrong. I have been testing our engine using nvidia's stereo 3d and all but the interface work perfectly. My best theory is that the projection matrix is resulting in incorrect w values. In case it matters this is using cegui 0.7.2 and "CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module".
Can anyone shed some light on how the transformation matrix was derived?
ps: The -1.66666 is the result of a fair bit of math involving the near and far distances, but all the terms cancel out and the result is -5/3