Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multisampling Vs Supersampling

6,979 views
Skip to first unread message

Thomas

unread,
Feb 12, 2012, 7:17:14 PM2/12/12
to
Hello

I'm struggling to understand the essential difference between multisampling
and supersampling but I'm getting the impression that multisampling makes
more compromises in order to maintain frame-rates. Will supersampling at 2x2
(for example) give superior image quality than 4x multisampling, or is it
harware dependent.

I'd really welcome any comments on the difference between the two
approaches.

Thanks
Thomas


Nobody

unread,
Feb 15, 2012, 12:06:01 AM2/15/12
to
On Mon, 13 Feb 2012 00:17:14 +0000, Thomas wrote:

> I'm struggling to understand the essential difference between multisampling
> and supersampling but I'm getting the impression that multisampling makes
> more compromises in order to maintain frame-rates. Will supersampling at 2x2
> (for example) give superior image quality than 4x multisampling, or is it
> harware dependent.

Multisampling (multisample antialiasing, MSAA) is an approximated form of
supersampling. Specifically, the fragment colour is only calculated for a
single location within each fragment, while the depth test, stencil test
and insideness test are performed for multiple locations.

This means that, unlike supersampling, multisampling doesn't increase the
number of times the fragment shader is executed (unless the fragment
shader calculates gl_FragDepth), and doesn't increase the number of
texture lookups.

OTOH, it doesn't do anything to solve aliasing within the interior of the
primitive. It only antialiases at edges; either the actual edges of
primitives or when fragments are clipped by depth or stencil tests. Note
that it doesn't antialias "edges" resulting from the alpha channel.

MSAA correctly handles polygons which share an edge, whereas traditional
polygon antialiasing (GL_POLYGON_SMOOTH) tends to let the background bleed
through. MSAA doesn't require the primitives to be depth-sorted.

Supersampling may give better results (it should never be worse), but the
performance cost is likely to be far greater.

Thomas

unread,
Feb 15, 2012, 4:54:39 AM2/15/12
to

"Nobody" <nob...@nowhere.com> wrote in message
news:pan.2012.02.15....@nowhere.com...
Thanks a million for taking the trouble to reply - it's really appreciated.

I'm still a little confused about how this works in the context of a custom
shader and in particular a deferred shader.

Say I attach a set of multisampled texture targets to a frame buffer and
then render to that buffer with say 4 samples, capturing the depth,
material, normal etc into each target. Now, in my deferred shader I iterate
over all 4 samples and caluclate an average colour and output that to the
screen. Will I still not get overall antialiasing comparable to 2x2
supersampling?

I did this and I can't see the difference - even though the multisampling is
significantly faster. Also, I see the same level of interior antialiasing.

Thanks again
Thomas




Nobody

unread,
Feb 16, 2012, 5:13:46 AM2/16/12
to
On Wed, 15 Feb 2012 09:54:39 +0000, Thomas wrote:

> Say I attach a set of multisampled texture targets to a frame buffer and
> then render to that buffer with say 4 samples, capturing the depth,
> material, normal etc into each target. Now, in my deferred shader I iterate
> over all 4 samples and caluclate an average colour and output that to the
> screen. Will I still not get overall antialiasing comparable to 2x2
> supersampling?

It depends upon how the deferred shader uses the data. If all four samples
for a given fragment were generated by the same primitive, the values in
the colour buffers will be identical. If the output from the deferred
shader depends solely on the sample values (and not e.g. the sample
positions), then you shouldn't see any gain from MSAA except at the edges
(fragments whose samples were generated by different primitives).

> I did this and I can't see the difference - even though the multisampling is
> significantly faster. Also, I see the same level of interior antialiasing.

But do you see any difference between supersampling and normal rendering?
If not, you won't see any difference with MSAA either.

Thomas

unread,
Feb 16, 2012, 4:00:05 PM2/16/12
to

"Nobody" <nob...@nowhere.com> wrote in message
news:pan.2012.02.16....@nowhere.com...
Brilliant - I finally get it!

So, you get multiple samples but all the samples corresponding to a specific
primitive are identical - unlike supersampling where the samples are truly
independent. This gives edge antialiasing but not interior.

The model I was looking at had millions of faces so just about every
fragment had samples from different faces - hence I get reasonable interior
anti-aliasing.

Thank you very much you have been *really* helpful!!!

Thomas


Nobody

unread,
Feb 17, 2012, 12:57:26 AM2/17/12
to
On Thu, 16 Feb 2012 21:00:05 +0000, Thomas wrote:

> So, you get multiple samples but all the samples corresponding to a specific
> primitive are identical - unlike supersampling where the samples are truly
> independent. This gives edge antialiasing but not interior.

Yes; depth values (and the stencil values derived from them) are
per-sample, but the "colour" values are per-fragment. Meaning
that you essentially get "shaped fragments". E.g. if you draw two
triangles over the background with 16x MSAA, you might get:

1 . . 2
1 1 2 2
1 2 2 2
2 2 2 2

where . is the background, 1 is the first triangle and 2 is the second.
All of the 1s have the same colour as do all of the 2s, but the resulting
blend is based upon actual coverage. If the triangles shared an edge, you
might get e.g.:

1 1 1 2
1 1 2 2
1 1 2 2
1 2 2 2

resulting in a 50-50 blend, rather than the 25-25-50 (i.e. with the
background bleeding through) which GL_POLYGON_SMOOTH would give.

Typical rendering results in little aliasing within a single primitive
(assuming that you're using mipmaps with correct LoD calculations) but
significant aliasing at the boundary between one primitive and another.
MSAA takes advantage of the fact that eliminating the latter requires
significantly less computation than full supersampling (although it still
requires the same amount of memory).

> The model I was looking at had millions of faces so just about every
> fragment had samples from different faces - hence I get reasonable interior
> anti-aliasing.

Right; by "interior", I'm referring to the primitive (triangle).


Thomas

unread,
Feb 17, 2012, 5:34:15 AM2/17/12
to

"Nobody" <nob...@nowhere.com> wrote in message
news:pan.2012.02.17....@nowhere.com...
Thank you once again for your helpful response.

The major source of interior aliasing effects is likely to arise from
high-frequency textures and these can best be handled using standard
mip-mapping techniques. MSAA would therefore seem to be preferred over
supersampling given its much superior performance.

One question I do have (and I can probably work this out myself if you're
busy) is about the graphics memory requirements of multisampling over
supersampling. I would have assumed that a render target specified as 4x
multisampled would consume the same memory as a regular render target at
twice the width and height - is that the case, or is there some trickery
going on here too :-)

Thanks again
Thomas





Nobody

unread,
Feb 19, 2012, 11:41:05 PM2/19/12
to
On Fri, 17 Feb 2012 10:34:15 +0000, Thomas wrote:

> One question I do have (and I can probably work this out myself if you're
> busy) is about the graphics memory requirements of multisampling over
> supersampling. I would have assumed that a render target specified as 4x
> multisampled would consume the same memory as a regular render target at
> twice the width and height - is that the case, or is there some trickery
> going on here too :-)

Yes, MSAA has the same memory requirements as conventional supersampling;
it's just the computations (and texture lookups) which are reduced.

gregk...@gmail.com

unread,
Nov 17, 2017, 2:06:11 AM11/17/17
to
0 new messages