Apologies for the following noob question, it's just I can't find a satisfactory answer anywhere...

When I render a simple axis-aligned quad made up of two triangles, I don't understand why there's never any visible artefacts on the diagonal edge where those triangles meet. Some of those pixels must be in both triangles, right? So if my fragshader always emits a partially-transparent color - 50% black say - then shouldn't there be a visible dark diagonal line in the resulting quad?

Obviously it's great that this isn't a real problem that has to be coded around, I just don't understand why it isn't. What GPU magic is it that makes this always work out?

  • 1
    $\begingroup$ I have discussed this issue quite in-depth on my blog. The particular rule that I follow is the same as in Direct3D 10+. $\endgroup$ Nov 16, 2020 at 14:08

1 Answer 1


This is the same problem as discussed in What are sample gaps during scan conversion?

Briefly, rasterisation - at least with the majority of hardware systems - tests at a single 'infinitesimal' point for each pixel to determine if that pixel is inside a given triangle.

If the sample point lies exactly on an edge, then additional tie-breaking rules, often referred to as "fill rules", come in to play. Typically these will be something equivalent to, say, only consider the edge points on the top/left** edges of a triangle to be "inside".

**Other rules are available ;-)

  • $\begingroup$ Yeah i was just looking for that answer $\endgroup$
    – joojaa
    Jun 15, 2016 at 11:00
  • 1
    $\begingroup$ Relevant passage from the Black Book: jagregory.com/abrash-black-book/… $\endgroup$
    – xyz
    Jun 15, 2016 at 15:36
  • $\begingroup$ Very many thanks! It sorta kinda makes sense now, and that black book looks like a great resource too $\endgroup$ Jun 15, 2016 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.