Sign in to follow this  
Drats

MSAA and HDR

Recommended Posts

Hey,

I am having trouble having these two and hope someone over here can shed more light.

Now I know perfectly well (or almost) what HDR is and how it is implemented. I also understand what anti aliasing is and why it is required. The trouble I am having is I have seen some code samples where they sort of combine MSAA and HDR in one effect. I just can't get my head around this.

Why and how do they do this?

Thanks in advance.

Share this post


Link to post
Share on other sites
Are you talking about this sample?

In the case of that sample, the MSAA resolve isn't done until after tone mapping because tone mapping is a non-linear operation. So if you do the average of all subsamples and then tone map the result, you get a different value than if you tone mapped each subsample individually and averaged that result. The end result of doing the resolve before tone mapping is that edges with high contrast can appear to have no AA applied at all. If you think about it this makes sense: with AA you want to perform filtering in visible color space, and not in linear HDR space. Obviously it's better performance-wise to do the resolve as early as possible, but the results speak for themselves in the demo.

Share this post


Link to post
Share on other sites
There's also the "HL2" HDR approach, (which is designed to use regular 8-bit buffers) where you do the tone-mapping in your material shader (i.e. you output tone-mapped values directly to the MSAA frame buffer).
Quote:
sort of combine MSAA and HDR in one effect.
I wouldn't really call them an effect, or things that you combine "into one". HDR is rendering with a large range of values (outside the zero-to-one range), and MSAA is basically a larger-than-usual frame-buffer.
Ignoring the 'when to resolve'/'when to tonemap' issue outlined by MJP above, they should be fairly independent of each other.
Quote:
Why ... do they do this?
Same reasons that you want AA in a regular situation (to reduce jagged pixel boundaries), and that you want HDR in a regular situation (more realistic light reproduction).

I guess the reason why "MSAA + HDR" demos exist is because some cards didn't support floating-point buffers and MSAA at all (one reason why Valve went with the "HL2 HDR" approach), plus as MJP points out, the order in which you go from high-range to tone-mapped values, and from MSAA to resolved values affects the results.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this