Jump to content
  • Advertisement
Sign in to follow this  
fpuig

How to use a depth target surface as a texture

This topic is 4822 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’m trying to optimize my implementation of deferred shading by avoiding doing multiple pass for render normals and position information. So I like to render the normals to the color target and instead of doing another pass to render the position into another color target. I’m trying to get the depth information stored in the depth target so I be able to compute the screen space position of the pixel. To do that I created a depth-stencil surface and I had used it as a depth render target when rendering normals. Now in a second pass, I need to use that depth surface as a texture; but I can’t figure it out how. I had already tried D3DXLoadSurfaceFromSurface but it only seems to support color surfaces. Any idea? Btw: MTR is not an option since only the latest hardware supports it!

Share this post


Link to post
Share on other sites
Advertisement
Nope, the dx api does not allow using depth stencil surfaces for anything officially.

Nvidia has overloaded depth stencil surface fetching to indicate a shadow map lookup.

There is no way to get the depth from the depth buffer directly, and even if you could, the contents of this buffer are not guaranteed to be the same thing spit out of your projection matrix after the divide by w.

For instance, at least one IHV supported only 1- floating point z format for z buffers.

So, you want to render your own depth into a texture - probably just w, another name for viewspace z.

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!