[SOLVED] World View Projection Matrix weirdness
I have a weird problem with the world view projection matrix. It seems to project the objects 90% correctly, but I have been trying to do some procedural geometry lately and have been having problems with the UVs being correct. I took a look at what was happening in PIX and it looks as if it is not rotating objects correctly, it is basically projecting through objects. I am not sure exactly what could be wrong here:
D3DXMatrixLookAtRH((D3DXMATRIX*)&m_ViewMat, (D3DXVECTOR3*)eye, (D3DXVECTOR3*)lookAt, (D3DXVECTOR3*)up);
m_pD3DDevice->SetTransform( D3DTS_VIEW, (D3DXMATRIX*)&m_ViewMat);
D3DXMatrixPerspectiveFovRH((D3DXMATRIX*)&m_ProjMat, GETRAD(m_fFOV), m_fAspectRatio, m_fPerspectiveMin, m_fPerspectiveMax);
m_pD3DDevice->SetTransform(D3DTS_PROJECTION, (D3DXMATRIX*)&m_ProjMat);
These are the exact calls I am making to setup the view and projection matrices. I am using RH on purpose :) The world space matrix I am setting via:
m_pMatrixStack->Push();
m_pMatrixStack->MultMatrix((D3DXMATRIX*)mat);
m_pD3DDevice->SetTransform(D3DTS_WORLDMATRIX(0), m_pMatrixStack->GetTop());
but using the identity matrix does not change anything, so I think I can rule this out as a possible problem. Is this projection correct? This problem happens in both OpenGL and DirectX as near as I can tell, PIX verifies this in DirectX but I do not know of something like PIX in OpenGL to try this out, the resultant problem is the same. To me it should have rotated the point to not be directly in front of its local space position, but on the opposite side.
Here is a sample of the problem:
http://i278.photobucket.com/albums/kk112/TheBlueJester/oddWVP.jpg
Thanks in advance
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement