4
$\begingroup$

I'm finding myself increasingly interested in rendering techniques utilizing multisampling for anti-aliasing (obviously), out-of-order transparency, volumes etc.

Searching the web for performance numbers of MSAA in the range only gets me to gamer verdicts for this and that game, and even then MSAA is only used for AA, and being compared to screen based post process AA which can hardly be used for anything else than AA.

Is there any rule of thumb (other than memory consumption) of how much it costs having x2, x4, x8, x16 MSAA? Linear? Logarithmic?

$\endgroup$
2
  • $\begingroup$ seems to me like it is cuadratic, since you scale the amount of pixel samples both horizontally and vertically by some constant k. $O(width \times height \times k^2)$ $\endgroup$ Commented Jan 22, 2018 at 10:27
  • 2
    $\begingroup$ Are you assuming a GPU-accelerated MSAA implementation? Because in that case the GPU absorbs most of the cost. If your runtime is limited by fragment shader execution time, then the slowdown will be in proportion to the number of pixels where an edge is visible, because this is where you'll execute your shader multiple times. $\endgroup$ Commented Jan 25, 2018 at 16:04

1 Answer 1

3
$\begingroup$

Roughly speaking, what the Supersampling Anti-Aliasing method does is:

  • For each pixel in the image to render
    • "Split" the pixel of a target image, usually in 2, 4, 8 or 16.
      Actually this step is more: pick the 2, 4, 8 or 16 locations ("samples") inside the pixel
    • Compute the color that the image will have at each of those locations (sample or "split part").
      So instead of only computing the color that the image will have in that single pixel, we compute 2x, 4x, 8x or 16x times a similar value
    • Compute the average of all the 2, 4, 8 or 16 sample colors to decide the final color or the initial pixel

You can see that Super-sampling cost is proportional to the cost of computing one pixel's color in the image. Therefore it depends on the cost of shading.
It also depends on the number of pixels, i.e the resolution of the image.

In the context of Ray-Tracing applications, this means that 2, 4, 8 or 16 times more rays will have to be computed.

In the context of GPU-accelerated graphics computation, this means that 2, 4, 8 or 16 times more pixel shaders ("fragment programs") will be executed.


Now roughly speaking, what the Multisampling Anti-Aliasing method does is:

  • For each pixel in the image to render
    • Pick 2, 4, 8 or 16 locations ("samples") inside the pixel
      • For each primitive (triangle) in the scene (actually, only for those that overlap the pixel):
        • Determine which of these samples are covered by the current triangle
        • If there is at least one such sample, compute a single color of the contribution of that triangle to the pixel, and store it for each sample covered
          The worse case happens if each sample is overlapped by a different triangle ; in that case the color must be computed for each triangle
    • Compute the average of all the gathered sample colors to decide the final color or the initial pixel

You can see that evaluating the performance of Multisampling Anti-Aliasing is more complicated than that of Supersampling, since it also depends on the topology of the scene (the size and shape of the triangles).

$\endgroup$
2
  • 1
    $\begingroup$ "Multisample Anti-Aliasing method does is ..... " we compute 2x, 4x, 8x or 16x times a similar value" I think you are describing SSAA, Super Sample AA, not MSAA. MSAA will only run the pixel shader up to the minimum of the sample rate AND the number of objects crossing the pixel. $\endgroup$
    – Simon F
    Commented Feb 2, 2018 at 9:09
  • $\begingroup$ You are correct, I updated the answer. $\endgroup$
    – wip
    Commented Feb 2, 2018 at 9:42

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.