Search Results

Search found 1 results on 1 pages for 'pivotnig'.

Page 1/1 | 1 

  • DirectX Unproject troubles

    - by pivotnig
    I have an orthographic projection and I try to unproject a point from screen space. Following are the view and projection matrices: var w2 = ScreenWidthInPixels/2; var h2 = ScreenHeightInPixels/2; view = Matrix.LookAtLH(new Vector3(0, 0, -1), new Vector3(0, 0, 0), Vector3.UnitY); proj = Matrix.OrthoOffCenterLH(-w2, w2, -h2, h2, 0.1f, 10f); Here is how I unproject a Point p, the point is given in screen pixels: var m = Vector3.Unproject(p, 0, 0, ScreenWidthInPixels, ScreenHeightInPixels, 0.1f, 10f, // znear and zfar view *proj); My code doesn't work, the matrix m contains only Nan. When I try to invert view * proj I get back a Matrix with only zeros. So I suspect my problem has something to do with the orthographic projection matrix. Here are my questions: Could the problem be caused by an underflow due to the large values in the OrthoOffCenterLH projection? What parameters do I have to pass for x,y,width,height in Unproject(...)? What significance has the minZ and maxZ parameter in Unproject(...)? Does it matter what I pass for p.Z in Unproject(...)?

    Read the article

1