Sign in to follow this  
shlem

D3DXVec3Unproject sometimes is inaccurate

Recommended Posts

shlem    100
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
shlem    100
Thank you for all, that read, but did not answer[img]http://public.gamedev.net/public/style_emoticons/default/wink.gif[/img]
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this