3
$\begingroup$

I know that fragments are rasterized in a 2x2 quad. That's why the seam between two triangles can be rasterized twice. At least that article states this. I wonder is it still true today on modern hardware?

$\endgroup$
  • $\begingroup$ Exactly how do you "know" that? Reference maybe? $\endgroup$ – Andreas May 17 '16 at 10:16
  • $\begingroup$ @Andreas the linked article states this, although doesn't provide a reference. However, it does provide evidence that this affects performance, unless that can be explained in terms of some other cause. $\endgroup$ – trichoplax May 17 '16 at 10:44
  • $\begingroup$ @trichoplax My bad. Did not read question properly. $\endgroup$ – Andreas May 17 '16 at 10:47
  • $\begingroup$ Also I saw several times that instead of fullscreen quad people use big triangle that covers the screen. $\endgroup$ – nikitablack May 17 '16 at 10:48
  • 1
    $\begingroup$ @nikitablack Oh I see - I thought you meant 2 triangles instead of a quad - but you mean 1 oversized triangle that encompasses the whole screen. That's interesting. I apologise - that is very much related to this question :) $\endgroup$ – trichoplax May 17 '16 at 11:20
3
$\begingroup$

It is true to on today's GPUs, unless one or more vendors has implemented a technique such as this: http://graphics.stanford.edu/papers/fragmerging/shade_sig10.pdf

To clarify, rasterization is not being done multiple times, or redundantly - rather it is the shading work that is done redundantly. Each 2x2 quad will be shaded once for every triangle that covers at least one sub pixel sample in that 2x2 quad. So, for 4x MSAA, that could be as many as 16 times if every sample covers a different (very small) triangle.

$\endgroup$
4
$\begingroup$

That's why the seam between two triangles can be rasterized twice.

The seam won't be rasterized twice because of the OpenGL or D3D fill/rasterisation rules.

What I think Humus is alluding to is that a fragment shader may be executed multiple times on pixels spanning the shared edge, which just implies wasted effort.

The moral of the story is "avoid small or long/thin triangles if you want efficient rendering".

$\endgroup$
  • 1
    $\begingroup$ Enabling GL_POLYGON_SMOOTH would cause multiple rasterization. $\endgroup$ – Andreas May 17 '16 at 16:55

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.