• Advertisement
Sign in to follow this  

NearClipping question

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

I am having an (aesthetic) conundrum: right now my near-plane is 1.0 as I imagine most of your near-planes are the same. My issue is that I want to have my scale be 1m = 1 3d unit. BUT this means that the camera clips through my geometry much sooner than I would like. What sort of repercussions are there going to be if I set my near plane to something like 0.1? I have done it and played around a bit and have noticed very little change, but the app I tested it with is fairly minimal. BTW:
D3DXMatrixPerspectiveFovLH(&proj,D3DX_PI *0.5f,WINWIDTH / WINHEIGHT,
	1.00f, //near plane
	1000.0f); //far plane

Talking about changing the above near plane value. I am wondering if this will change the way I implement picking and RHW verts. I know I could go in and change the scale of everything, but that might take a bit of re-writing so I am coming here first. Also just curious as to what sort of scales others are using.

Share this post


Link to post
Share on other sites
Advertisement
I also use 1 unit = 1 meter or even 1 unit = 0.5 meters and have not noticed any anomalies so far using a near clip plane of 0.1f.

Share this post


Link to post
Share on other sites
I have been playing around with different values since I posted and I seem to be getting some odd z-buffer issues at values less than 1.0. Objects, or even verts of the same object, are being drawn over things in front of it.

Odd that you have had no issues with your depth buffer and I have, I'll play around some more...

Share this post


Link to post
Share on other sites
There is no problem with using 0.1 for near plane if you don't set your far plane too far. It also depends on if your using Z or W for depth(look it up in the SDK) and the depth of your DepthStencil buffer, you need 24 bits of depth.

Share this post


Link to post
Share on other sites
Search on the forum, was a post related to this a few days ago.

Something about the z-buffer not being linear :)

Share this post


Link to post
Share on other sites
Ah thank you Kern_d- with a D3DFMT_D24X8 format stencil buffer my depth issues were taken care of.

And I'll look through the old form posts too, thanks again.

Share this post


Link to post
Share on other sites
Quote:
Original post by vs322
Ah thank you Kern_d- with a D3DFMT_D24X8 format stencil buffer my depth issues were taken care of.


If you're not using the stencil bits, why not just ask for D32? It will give you more breathing room in depth precision.

Share this post


Link to post
Share on other sites
Quote:
Original post by legalize
If you're not using the stencil bits, why not just ask for D32? It will give you more breathing room in depth precision.


I did at first, but strangely enough (using a radeon x1950 pro) the device failed creation with the D32 flag...

Share this post


Link to post
Share on other sites
Quote:
Original post by vs322
Quote:
Original post by legalize
If you're not using the stencil bits, why not just ask for D32? It will give you more breathing room in depth precision.


I did at first, but strangely enough (using a radeon x1950 pro) the device failed creation with the D32 flag...


Well, that sounds like you're not querying the right configuration for the back, depth and display formats then. Picking the right combination involves using IDirect3D9 to identify the combinations that work. The caps viewer enumerates all the possible combinations for your device and shows them to you in its GUI; poke around there to see what your device does. Look at the sample framework to see the code that implements the proper enumeration of combinations. Read Chapter 2. Direct3D and Chapter 3. Direct3D Devices from my book for more details.

Share this post


Link to post
Share on other sites
No Richard, he's probably right. No amount of querying for compatible settings will make it work. I have a 7900GT here and it only supports D16, D24X8 and D24S8 for all display modes. I've never seen a card that supports D32. I figured some ATI cards probably did (I have limited use of ATI cards), but it wouldn't surprise me that nobody really supports D32.

Share this post


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

  • Advertisement