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?


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 ;-)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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