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

Started by
4 comments, last by ibolcina 21 years, 1 month ago
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?
Advertisement
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.
Michael Russell / QA Manager, Ritual EntertainmentI used to play SimCity on a 1:1 scale.
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.

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

What do you mean
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.
Michael Russell / QA Manager, Ritual EntertainmentI used to play SimCity on a 1:1 scale.

This topic is closed to new replies.

Advertisement