PDA

View Full Version : Occlusion query



Jan
04-24-2003, 02:18 PM
Why can i only query how many pixels actually got drawn? Wouldnīt it be extremely helpful, if the driver also told me how many fragments were generated and tested?

For example: Iīd like to scale the intensity of a light-flare depending on how visible the flare is.
Now the occlusion query tells me, that 100 pixels were drawn. That doesnīt help me much. If it also told me, that the object potentially covers 100000 pixels (considering the distance and size of the object), but only those 100 passed all test, then i would know much better how to scale the intensity.

Iīm not a driver-writer, so i donīt know if this is a hard thing to do. However i hope someone considers this as an addition in future extensions.

Jan.

Ysaneya
04-25-2003, 01:20 AM
This is D3D, but you might find it interesting:
http://www.ati.com/developer/samples/dx9/QueryLightFlare.html

Y.

Nutty
04-25-2003, 05:02 AM
Cant you work it out yourself? Just project the top left and bottom right corners of the quad, and convert to pixel coordinates via the window dimensions, and you can easily work out how many pixels it would have covered.

Nutty

Jan
04-25-2003, 06:53 AM
I am sorry, i donīt think i can work it out myself. Well, maybe if i think some hours about it and test some code, then i might find a solution.
I am programming for some years now, but 3D graphics is still quite new for me (i am doing this seriously for one and a half year now).
The thing is, that i have so much of things i like to do, and even more things i need to do (to get to the stuff i like to do), that i donīt really want to do EVERYTHING by myself.

So sorry, that i am bothering you with stuff, that seems to be easy for you.

Jan.

Nutty
04-25-2003, 08:39 AM
My comment was not meant to sound harsh. It wasn't an attack on your abilities, more a question as to weather you could rely on a software approach.

Sorry if my reply offended, it was not meant to.

Nutty

Jan
04-25-2003, 08:55 AM
Ok, no problem. I was just a bit angry, cause i know your homepage and your programs, and when i look at them, i know, that i still have to learn a lot. And if someone like you then tells me, that itīs all so easy and i should not ask such dumb questions, then i think you forgot, that there was a time, when you didnīt know all that stuff, too.

To your question: For me it would make no difference, whether i use a software solution or the Occlusion Query. A software approach would even be better (no pipeline stall). But for the moment i think my approach is ok.

Jan.

Nutty
04-26-2003, 03:11 AM
I meant just a software approach for working out the amount of pixel coverage what you're occluding could potentially cover.

Still use the hardware occlusion query, which tells you how many fragments passed.

Then use that against the value you calculated as a percentage occluded value.

Nutty

Madoc
04-26-2003, 08:33 AM
Jan2000,
If you plan to go far then you should take the time to learn some basic matrix maths. You should know how coordinates you give get transformed to screen space, you're going to need to know to do a lot of stuff - it's worth taking the time.
The OpenGL spec will explain the entire process clearly.