• Advertisement
Sign in to follow this  

Rendering the Z-buffer

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

Hi Ive got the back buffer rendering to a texture but how do i do the same thing with just the z-buffer? thanks

Share this post


Link to post
Share on other sites
Advertisement
You would probably have to lock it and convert the values from the 0 to 1... to 0 to 255 brightness values as you copy each pixel.

Or did I completely miss your question? You do want to literally render the z buffer, right?

Share this post


Link to post
Share on other sites
i think its impossible that render the contents of z-buffer to the texture.

Share this post


Link to post
Share on other sites
It's not impossible. I would represent far distances with black, and near distance with white. So you could just convert the z buffer values to float modulator 0.0 to 1.0 values, where 0.0 is far away. Then set each channel of the pixel to this multiplied with 255:

int bright = int( z * 255.0 );
*Pixel = D3DCOLOR_RGBA( bright, bright, bright, 255 );

It would be a pretty cool effect. Although you might even be able to cheat and render all of your objects white, and then use black fog stretching over the whole z-buffer distance. If you don't know how to do that, just ignore my ramblings.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It is possible to copy the Z-buffer to a texture - because this is exactly how modern shadow mapping techniques work.

You might get some hints as to how to do this from shaddow mapping tutorials.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
It is possible to copy the Z-buffer to a texture

really? how?

Quote:
Original post by Anonymous Poster
because this is exactly how modern shadow mapping techniques work.

in my case,i do shadow map using shader.in shader code,i have to calc z-value(it not from "z-buffer of direct3D") with myself.

Share this post


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

  • Advertisement