0
$\begingroup$

I have done some tests in OpenGL with multisampling, by specifying a multisample buffer as the default framebuffer. I used forward shading for rendering. From what I've observed the more primitives I have on the screen the higher the performance hit by multisampling. Is this because the built-in MSAA does multisampling in the fragment shader for each primitive we specify, even if its fragments are discarded because of depth testing? In order to fix this problem we could use deferred shading, but then we would have do multisampling ourselves.

Does this mean then that in practice for scenes with overlapping objects the built-in MSAA is pretty much never going to be used?

$\endgroup$

1 Answer 1

1
$\begingroup$

There is nothing surprising about this.

The biggest cost of multisampling is that you're rendering to larger buffers and therefore require more bandwidth to cover the same pixel-space area. This is especially true for doing depth tests, as the fragment's depth has to be computed and compared per-sample, not per-fragment. The more primitives you send, the more depth tests you're going to have, and therefore the more bandwidth you're going to use.

So if your shaders aren't doing much, your performance is going to be governed by framebuffer bandwidth.

Early depth tests are generally orthogonal to multisampling. But since multisampling typically executes the fragment shader at a lower frequency than the depth test, all of the depth samples that represent a fragment have to fail in order to cull the fragment itself. So I could imagine that some implementations turn off early tests for multisampling, but I rather doubt that this is the case.

$\endgroup$
1
  • $\begingroup$ After reading your post, I revisited the topic of GPU multisampling, and turns out I had wrong understanding of it, which is why the assumptions in my question don't make sense. But this definitely answered the question, thanks! $\endgroup$ May 27, 2021 at 16:36

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.