Occlusion with transparent textures

My scene contains a sky with a sun. I want to know if and how much the sun is occluded by clouds.
I render the sun as a simple 3d-billboard. Then i render a simple sky-dome with a texture applied which contains clouds but mostly empty (transparent) areas.
I have the absolute screen coordinates of my sun. So I need to know the texture’s pixel which is being rendered at this point…but how?
Or do you see a different approach for this problem?

Two of many options are ARB_occlusion query for the exact number of pixels, or rendering to a low resolution texture.

What hardware are you targeting?

Ah… I just had a look at the occlusion_query extension and it’s quite interesting…
They even say that it could replace depth-buffer reading (they’re refering to lens-flares). Should i substitute my depth-buffer reading with this extension? What are the advantages?

I’m targeting at rather non-highend graphic-cards.

Thanks so far.

If you are willing to wait one frame for your query result to return, the occlusion query method should be faster, I think. Flares aren’t an exact science, so I think it’s appropriate.