Hi, i'm fighting against the proj matrix :)
Objective: display a planet with a ring using a realistic coordinate system. For example Saturn.
I create the projection matrix and, to increase the precision, i set the near clip and far clip just above and behind the planet.
D3DXMatrixPerspectiveFovLH(&mProj, D3DX_PI * 0.25f, 1020.0f/738.0f,distance-radius, distance+radius);
HR(pD3dDevice->SetTransform(D3DTS_PROJECTION, &mProj));
where distance is the distance of the center of the planet to the origin (0,0,0) (where is setted the camera), and radius is the planet radius, including the ring.
Putting near and far planet to distance-radius and distance+radius i should see all the planet whitout clipping.
But the result is:
How you can see, the ring is cutted.
Now, i try to put the planet far away-
Now also the planet is cutted.
I suspect a precision issue: in the first case the distance is = 3755313 (the u.m. is kilometers), in the second case is distance = 10088947.
I've tried also an hack like:
D3DXMatrixPerspectiveFovLH(&mProj, D3DX_PI * 0.25f, 1020.0f/738.0f,distance-radius*2, distance+radius*2);
HR(pD3dDevice->SetTransform(D3DTS_PROJECTION, &mProj));
but it doesn't works...
Some suggestions?