Jump to content
  • Advertisement

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?

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

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
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.

Share this post


Link to post
Share on other sites
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
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
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!