Archived

This topic is now archived and is closed to further replies.

ibolcina

How to obtail value of z-buffer at some location on screen?

Recommended Posts

ibolcina    122
I draw all kind of 3d object. At some time, I need to know what value Z-buffer has, lets say on (x,y) point on screen. If it will be 1.0, I will draw something there, otherwise not. How to do this in fast way?

Share this post


Link to post
Share on other sites
RomSteady    248
A couple of questions:

Are you doing hardware or software rendering?

Do you care about transparency?

Do you want to query a hardware Z-buffer, and if so, do you care about it working with tile-based rendering architectures?

RomSteady - I play games for a living.

Share this post


Link to post
Share on other sites
ibolcina    122
hardware rendering

transparency: not when i want to draw this stuff, it is at the end of drawing, otherwise yes

I basicaly want to know, what was rendered on point (300,200). I would like to have 0.0f - something very close, 1.0f - something very far.

This is needed for lens flares. If something is blocking sun, i dont want to render flares.

Share this post


Link to post
Share on other sites
Muhammad Haggag    1358
There are lockable Z-Buffer formats, but as far as I know, lockable z-buffers aren''t widely supported, and it''s slow. Z-buffers are mainly uni-directional (==write-only).

Maybe you should try occlusion culling for the sun with your geometry?

Cheers,
Muhammad Haggag

Share this post


Link to post
Share on other sites
RomSteady    248
I think he means you should try casting a ray from your viewpoint to your "lens-flared" light source. If the ray hits something else, the light source is occluded and would not flare.

That way would work regardless of architecture, because tile-based rendering chipsets like PowerVR''s don''t have Z-buffer information until after the scene renders.

RomSteady - I play games for a living.

Share this post


Link to post
Share on other sites