Unfortunately, the only way to (theoretically) get stuff to layer together into a full-alpha pixel is to have a completely opaque layer.
Reasoning: The alpha channel is a multiplier for applying the other colour channels. Painting a region with opacity opacity
,n
times, gives you 1 - opacity^n
final alpha.
Here's a demo:
The leftmost is black at opacity 0.5. Each consecutive one is one more copy of it stacked on top of it. The opacities are approximately 0.5, 0.75, 0.87, 0.97. They tend toward 1, but won't reach it:
Querying Wolfram Alpha with 1 - 0.5^n
:
As n→∞, the function tends toward (but never reaches) 1.
In practice, floating point rounding error would hit at some point due to sometimes unpredictable hardware-dependent limitations.
Even so, 0.9 opacity is probably good enough. Could you tell the difference in a fast-paced game? The right rectangle is actually 0.9 opacity:
We can solve for what value of n
would produce 0.9 opacity:
0.9 = 1 - 0.5^n implies n = 3.32193
So for layers with opacity 0.5, four layers should be enough. Try it with your own values.