So trying to tackle on how to render a model’s hair I obviously hit the wall that transparencies are. Eventualy I implemented sorting on the polygons related to the hair and used pre multiplied alpha blending, for quite decent results.
However, we are talking about hair strips that sum up to over 7000 triangles, which happen to be severely intertwined. I was trying to consider alternative aproaches (like spliting the mesh in hair strip sections to accelerate the sorting, etc) when I saw the term “alpha to coverage” mentioned and the magic words “no z sorting” close to it. So I went out to hunt this holy grail.
Oddly enough, there’s few mentions to how to actualy set it up on GL… and it couldn’t be any easier, really. So I did, and indeed the effect it causes on the hair is basicly perfect. Ofcourse, the hair is aparently a perfect case for alpha to coverage, since it doesn’t really need blending but just alpha testing and the added antialiasing simply makes it look great.
Alas, I cannot just be happy with seeing it work. I need to understand why it works.
So from what I have gathered (and it’s been a mess to actualy find good information on this) ATC works by using the alpha value written by the shader output to determine which samples within the Multi Sample pixel the output actualy covers, thus the name. So far so good. Less alpha value, less samples from the MS pixel that are marked as covered.
But what from here? How does this actualy achieve a correct effect without needing to Z sort all these 7000 triangles?
I believe that perhaps what I’m actualy asking is how MSAA works, as I only have a superficial understanding about this too.
If anyone can spare some time to ilustrate me, I’ll be quite grateful.
Thank you in advance.