Original Post
🔒 Locked
Rendering the Z-buffer
Advertisement
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.
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.
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.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement