• Advertisement
Sign in to follow this  

D3DXVec3Unproject sometimes is inaccurate

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi
I have a problem in my 3D Direct X Map Application (aka Google Earth)
All coordinates are geocentric (XYZ) in meters.
The maps are drawn above earth ellipsoid.
Everything works nice, except one issue.
When I go to very close zoom (about 1 meter per pixel), the D3DXVec3Unproject function returns inaccurate results. I have an error of 10-30 meters and cannot make map panning.
A lot of investigations isolate problem as follows:


D3DXVECTOR3 vScreen, vBack;
D3DXVec3Project( &vScreen, &m_vecAt, &m_viewPort, &m_matProj, &m_matView, &m_matWorld );
D3DXVec3Unproject( &vBack, &vScreen, &m_viewPort, &m_matProj, &m_matView, &m_matWorld );


m_vecAt is a looking point.
D3DXVec3Project returns correct vScreen - exactly center of window (+/- 0.5 pixel) with vScreen.z = 0.99, but vBack differs from m_vecAt by tens meters.

Sign again, that everything else works, so I assume, that all matrices and other data are calculated correctly.

The only one reason, that I can think about, is a not enough calculation precision of single float point arithmetic.

Please help

Share this post


Link to post
Share on other sites
Advertisement
Thank you for all, that read, but did not answerwink.gif
I solved the problem.
The near plane of projection matrix was too close to camera

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement