Strange strips while drawing transparent things in OpenGL

  alpha-transparency, c++, opengl

I’m using per-pixel linked lists to realize order-independent transparency in OpenGL. But while I drawn something, something looks strange happened.

The following picture shows the non-transparent mode, and everything looks normal.
enter image description here

The following picture show the transparent mode, there are some abnormal strips on the bulges of the model.

enter image description here

In the second stage of the per-pixel linked list method, I count the number of the fragments on each pixel (in fragment shader). I find that the abnormal strips on the model correspond to the pixels which have over 4 fragments. And I change these pixels to red. Then my model turns to this,

enter image description here

vec4 final_color = vec4(background_color.xyz, 0.0f);
if (fragment_count >= 1) {
    for (i = 0; i < fragment_count; ++i) {
        vec4 modulator = unpackUnorm4x8(fragment_list[i].y);
        final_color = mix(final_color, modulator, modulator.a);
    }
} else {
    final_color = background_color;
}

if (fragment_count >= 4) {
    final_color = vec4(1.0f, 0.0f, 0.0f, 1.0f);
}

Source: Windows Questions C++

LEAVE A COMMENT