Hi Guys,
I'm presently brushing up of some 3D math and am wondering how I would go about working out the final step of where a singular vertex would be positioned in screen space in the -1 to +1 range.
I have done the following calculations based on the following parameters and the results listed below.
At this stage I haven't multiplied anything against the world matrix, so that would effectively mean that the vertex would be located at space 0, 0, 0.
So my question is, what calculation would I need to do against the WVP matrix in order to work out the screen location X & Y on the screen? Expecting the result to be 0, 0 (being direct centre of the screen).
Many thanks!
float fovY = 60.0f;
float aspect = 1280.0f / 800.0f;
float near = 1.0f;
float far = 1000.0f;
XMVECTOR from = { 0.0f, 0.0f, -2.5f, 1.0f };
XMVECTOR to = { 0.0f, 0.0f, 0.0f, 1.0f };
XMVECTOR up = { 0.0f, 1.0f, 0.0f, 0.0f };
XMMATRIX matView = XMMatrixLookAtLH(from, to, up);
View Matrix
1 0 0 0
0 1 0 0
0 0 1 0
0 0 2.5 1
Proj Matrix
-0.0975741 0 0 0
0 -0.156119 0 0
0 0 1.001 1
0 0 -1.001 0
View * Proj Matrix
-0.0975741 0 0 0
0 -0.156119 0 0
0 0 3.501 1
0 0 -1.001 0
Identity Matrix
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
WVP Matrix
-0.0975741 0 0 0
0 -0.156119 0 0
0 0 3.501 1
0 0 -1.001 0