PDA

View Full Version : alpha to coverage



debonair
05-02-2015, 07:55 PM
I have question about the working of alpha to coverage. Coverage value specifies that which samples of a pixels are covered by the primitive. with alpha to coverage, we AND alpha value with coverage value of the pixel to determine the final coverage.
Now Superbible specifies that "if 66% of the pixel is covered by the primitive and alpha value is 40% then final coverage value would be 60 x 40 % which is 25% and for 8 sample buffer, 2 samples will be covered." But how does it work at sample level.? and how does it determine which samples to cover out of 8?

if the coverage is a bit field for each sample then how does AND operation is performed for each sample ?

Alfonse Reinheart
05-02-2015, 11:16 PM
and how does it determine which samples to cover out of 8?

The spec is rather unambiguous about its ambiguities on this matter:


No specific algorithm is required for converting the sample alpha values to a temporary coverage value. It is intended that the number of 1ís in the temporary coverage be proportional to the set of alpha values for the fragment, with all 1ís corresponding to the maximum of all alpha values, and all 0ís corresponding to all alpha values being 0. The alpha values used to generate a coverage value are clamped to the range [0, 1]. It is also intended that the algorithm be pseudo-random in nature, to avoid image artifacts due to regular coverage sample locations. The algorithm can and probably should be different at different pixel locations.

In short: implementation dependent, but hopefully not stupid. I'm surprised the Superbible didn't bother to even say "the exact algorithm is implementation-dependent."