I draw transparent figures by depth peeling, the result is ugly when I render to multisample (a grid appears)
vec4 fragColor = texelFetch(frontTexture, ivec2(gl_FragCoord.xy), 0);
if (gl_FragCoord.z < nearestDepth) {
// Skip this depth in the peeling algorithm
return;
}
fragColor += someColor;
Without "if return" everything is alright (but I need this "if"). The grid is exactly the same as when I use mipmapping with non-uniform flow control.
P.S. Depth peeling use strict depth comparison, it is impossible if we get depth "for any location within the pixel". Instead of
use
(it is the first rough solution)