How to set pixel coverage limits?

I would like to set up a render buffer so that if any % of a pixel is covered by a polygon then it is treated as if it is fully covered.

The purpose is somewhat similar to this: lightindexed-deferredrender/LightIndexedDeferredLighting1.1.pdf at master · dtrebilco/lightindexed-deferredrender · GitHub

Except i would like to write the indices at a lower resolution than the screen size; hence if any one of the screen pixels is covered the whole pixel in the index buffer needs to be covered.

Anyway, i believe that glSampleCoverage(float, bool) addresses this, but i really don’t understand what the documentation is of that function is saying; so i’m not really sure.

How can i accomplish this?

If you enable anti-aliasing with GL_POLYGON_SMOOTH, the fragment shader will be invoked for any fragment which intersects the polygon, not just for fragments whose centre is contained within it.

glSampleCoverage() is only relevant for multi-sample (MSAA) framebuffers. It effectively makes rendering translucent, by reducing the number of samples treated as part of the fragment’s coverage.

Related: See slide 56 titled “Conservative Rasterization versus Polygon Smooth” in this presentation:

Then check out:

1 Like

Thank you! That looks like just what i was looking for!