Sign in to follow this  
fpuig

How to use a depth target surface as a texture

Recommended Posts

fpuig    150
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
SimmerD    1210
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this