c++ - Count number of rasterized fragments -
abtract problem: need count fragments given geometry generated while rendered/rasterized regardless if fragments passed depth/stencil test or not.
context: i'm trying implement lens flares project i'm working on. i'm using opengl occlusion querying count pixels visible light source rendering screen aligned quad @ position of light source while having query active determine number of visible fragments of light source. quad has given width
, height
should have width * height
pixels @ some distance camera. after want adjust alpha value of actual flare effect account occluded parts of light source. need know total amount of fragments assembled rendered quad.
so, know how can determine number of fragments generated given rendering operation?
you suggested occlusion query, right tool job. struggle lies withing misconception try doing in 1 pass.
split problem multiple sub-tasks. in case should add 1 render pass occlusion query of geometry (without shaders, textures, etc) fragment discarding tests being disabled.
note occlusion query counts fragments pass tests, counts them if depth , color writes disables. can draw occlusion query quad without becoming visible or corrupt depth buffer.
Comments
Post a Comment