Jump to content
  • Advertisement
Sign in to follow this  
Stellar Developer

remove farZ clipping?

This topic is 4696 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

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
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 this post


Link to post
Share on other sites
Ok I'm taking this from "Practical and Robust Shadow Volumes" here

Your project matrix should be


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 this post


Link to post
Share on other sites
Quote:
Original post by CadeF
D3DX 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 this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!