Jump to content
  • Advertisement
Sign in to follow this  
The Rug

Higher contrast in the depth buffer? [DX9]

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

Edit: This was previously called Replacing depth stencil surface with a texture, then using that texture but I changed the subject :) I'm writing a program where I need to store the depth of each pixel. At the moment I'm using a pixel shader to write the z value of each pixel into a render target. I was wondering if it's possible to simply replace the depth stencil surface with a texture, and use that? My current method strikes me as wasteful, as the z value is being written to both the depth stencil surface by D3D and my render target by the pixel shader. Am I barking up the wrong tree here? Unfortunately I'm stuck in the past with DirectX 9. Thanks a lot peeps :) [Edited by - The Rug on May 20, 2009 11:05:00 AM]

Share this post


Link to post
Share on other sites
Advertisement
In D3D9 it is not possible to use the DepthStencilBuffer as a resource/texture in the shader.

One exception would be a certain hack that can be used specifically for shadowmapping and works differently on nvidia and AMD respectively.

Share this post


Link to post
Share on other sites
Yeah like B_old says, DX9 doesn't expose that sort of functionality. I really wouldn't worry about it though...rendering out depth to a texture is very cheap.

Share this post


Link to post
Share on other sites
Cheers, that's a bit of a pain but not too bad.

Now my problem is the resolution of my depth texture. Only things really close to the camera are producing enough contrast to be visible. Am I correct in understanding that this is because depth is not stored in a linear fashion? Is there anything I can do about this? I've tried Googling but I'm not really sure what I'm after. Can you guys point me in the right direction?

Share this post


Link to post
Share on other sites
If you don't want non-linear depth, then don't store non-linear depth. [smile]

There's a few good reasons to use linear depth instead.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!