remove farZ clipping?

Recommended Posts

when i call D3DXMatrixPerspectiveFovLH, i can set the farZ to rediculusly high values, like 6 million, but it still seems to clip much too soon. is there a way to cut the far clip off? thx, -sd

Share on other sites
I doubt it. The min Z and far Z are used for the ZBuffer. MinZ = 0.0 and FarZ = 1.0. The greater the distance between min and far Z, the less the precision of the ZBuffer.

Share on other sites
Cocalus    554
The far plane can be removed. I only know how to do it in opengl though. It just involves making a custom perspective matrix (I'll dig up the opengl matrix someone here should be able to convert it, or will know a built in d3d command). It will cost you some z-buffer accuracy, and The best way to help deal with that is to push the z-near plane as far back as possible (the near planes possition has far greater affect than the far planes).

Share on other sites
D3DX matrix, I think he is working with DirectX :)

Share on other sites
Cocalus    554
Ok I'm taking this from "Practical and Robust Shadow Volumes" here

2*Near/(Right-Left),        0          , (Right+Left)/(Right-Left),    0       0           ,2*Near/(Top-Bottom), (Top+Bottom)/(Top-Bottom),    0       0           ,        0          ,            -1            , 2*Near       0           ,        0          ,            -1            ,    0

Just be aware that the z-buffer is really inaccurate for very distant objects, so your far away objects might get some z fighting artifacts.

I'm not sure if there's something special you need to do to use this in d3d though.

I'm not sure what your doing and there maybe a cleaner way to do what you want. If there's only a few distant objects, backgrounds you can disable the z-buffer, and just draw those very distant objects, in back to front order. Then draw the rest of the scene normally.

Share on other sites
Cocalus    554
Quote:
 Original post by CadeFD3DX matrix, I think he is working with DirectX :)

D3D and Opengl generally have the same capabilities (Opengl extensions sometimes open up features D3D doesn't yet have) So I'm almost certain theres a straight foward way to do the same on D3D. Probably just some custom matrix call.

Note: The above matrix may need to have it's handedness switched though. Someone around here should know.

Share on other sites
Cocalus    554
After googling I found

The d3d version of the above matrix (with a Lefthanded D3D matrix)