$ ./guess_the_languageGame Dev
Game Dev · medium · #266

What does this fragment shader line do?

if (tex.a < 0.5) discard;
  1. Blends the pixel at half alpha
  2. Deletes the texture from memory
  3. Skips the whole draw call
  4. Drops pixels below the cutoff
This is alpha testing (cutout): discard writes nothing for that fragment, giving hard-edged foliage or fences without sorting for blending.
Play Game Dev ▸