15
/17
Implementation - transparency in OpenGL
For impostors shape with fully opaque/transparent fragment:
discard
can be used on transparent fragments
discard = Stop fragment shader execution (nothing is written)
(+) Generic, standard display
no need to sort shapes, depth-buffer works
(-) Possible aliasing artifacts
(-) Cannot be used on semi-transparent objects
Cannot play video assets/discard.mp4
In fragment shader:
float
limit
=
0.6
;
if
(
texture
.
a
<
limit
)
{
discard
;
}