Comments on: FXAA: Your New Friend https:/2011/09/fxaa-your-new-friend/ Developer resources for the X-Plane flight simulator Fri, 30 Sep 2011 20:39:06 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: Ben Supnik https:/2011/09/fxaa-your-new-friend/#comment-2930 Fri, 30 Sep 2011 20:39:06 +0000 http://www.x-plane.com/blog/?p=3700#comment-2930 In reply to Nelson.

Depends on the change – some are on the fly, some require restart, some force reload all scenery.

]]>
By: Nelson https:/2011/09/fxaa-your-new-friend/#comment-2929 Wed, 28 Sep 2011 15:12:55 +0000 http://www.x-plane.com/blog/?p=3700#comment-2929 In reply to Ben Supnik.

Changes in X-Plane 10 will also need a restart or they will be applied “on-the-fly”?

]]>
By: Ben Supnik https:/2011/09/fxaa-your-new-friend/#comment-2928 Wed, 28 Sep 2011 14:04:17 +0000 http://www.x-plane.com/blog/?p=3700#comment-2928 In reply to ropeless.

X-Plane 9 uses the hardware FSAA provided by the card. You must restart X-Plane to see the effect.

]]>
By: ropeless https:/2011/09/fxaa-your-new-friend/#comment-2927 Wed, 28 Sep 2011 08:50:23 +0000 http://www.x-plane.com/blog/?p=3700#comment-2927 Thanks for another informative and interesting blog entry. Much appreciated.

Now I understand a bit about X-Plane 10 anti-aliasing, it begs the question, how does it work in X-Plane 9? To be honest, I could never see the effect of changing the rendering setting, anti-alias level.

]]>
By: chris https:/2011/09/fxaa-your-new-friend/#comment-2926 Wed, 28 Sep 2011 01:58:49 +0000 http://www.x-plane.com/blog/?p=3700#comment-2926 In reply to Ben Supnik.

fair enough, guess this will be December

]]>
By: Ben Supnik https:/2011/09/fxaa-your-new-friend/#comment-2925 Tue, 27 Sep 2011 00:18:44 +0000 http://www.x-plane.com/blog/?p=3700#comment-2925 In reply to Jonathan.

Well, for what it’s worth, CSAA has 4 real color samples, so probably the API would just claim “yeah you have 4 color samples” and off we go…I think there’s no way for a deferred implementation to get access to the coverage information when it needs it, but such is life.

]]>
By: Jonathan https:/2011/09/fxaa-your-new-friend/#comment-2924 Mon, 26 Sep 2011 21:49:59 +0000 http://www.x-plane.com/blog/?p=3700#comment-2924 In reply to Ben Supnik.

Ah, CSAA – Completely Secret AA. As I understand it it should ideally be comparable to my ‘ideal’ MSAA description. CSAA may mess up occasionally, but the result should be comparable regardless of the type of rendering. Performance should be comparable to MSAA (yeah, the deferred work would probably be done pretty much directly on the color values). But then, being primarily a Mac user, I haven’t even seen CSAA in action yet.

I should read some of the newer specs to get a clearer image myself, at least of what the API allows…

]]>
By: Ben Supnik https:/2011/09/fxaa-your-new-friend/#comment-2923 Mon, 26 Sep 2011 17:38:16 +0000 http://www.x-plane.com/blog/?p=3700#comment-2923 In reply to Jonathan.

If the GPU is using something like CSAA, the number of coverage samples may be larger than the number of color samples. I suppose this would be exposed via the smaller color table. (When I last read the CSAA notes I mistakenly thought they had separated the number of color and depth samples; this is clearly not the case.)

Whether this matters is a question of whether the deferred renderer is bottlenecked on raster ops/internal bandwidth or shader ops. At this point I don’t know which one we’re using more of, relative to card capacity.

]]>
By: Jonathan https:/2011/09/fxaa-your-new-friend/#comment-2922 Mon, 26 Sep 2011 17:26:27 +0000 http://www.x-plane.com/blog/?p=3700#comment-2922 Wait, I think you have some things mixed up about multisampling, Ben. With multisampling, the color samples are stored individually alongside depth and stencil in the multisample buffer. The ‘normal’ color buffer that now contains the downsampled image is separate, and doesn’t destroy the samples. When the spec speaks of one color value and n depth samples per fragment, it speaks of fragments as in the fragment shader output before it is written/blended to the framebuffer, not the pixels stored in the framebuffer. The framebuffer still contains all the samples. It’s really just a matter of accessing the information that’s already there.

I have actually seen it with my own eyes once when I confused the driver with a particular glReadPixels path. It ended up transferring the color values straight out of the multisample buffer, giving me a double-size image full of 2×2 blocks and jittery geometry edges (due to the rotated grid). I happened to experiment from within an X-Plane plugin to have some free content to work with, when I ran into that. 🙂

—-

Note I presume the hardware will recognize that a block doesn’t contain geometry edges, so your post-process shader is mostly agnostic to the optimization. Just specify that you’d like to work on individual samples, and if the hardware then sees that the samples in each pixel in a block are the same, it can optimize by only running once per pixel. Again, I’m not sure how it actually works, but it seems like a great solution that’s hard to miss.

Very fine geometry kills either way. It’ll reduce fragment core utilization, add additional vertices to process, etc. I don’t think the hit of having to post-process every sample will be disproportional, seeing what came before it.

]]>
By: Ben Supnik https:/2011/09/fxaa-your-new-friend/#comment-2921 Mon, 26 Sep 2011 15:00:00 +0000 http://www.x-plane.com/blog/?p=3700#comment-2921 In reply to Jonathan.

Right – a typical modern forward-rendering hw MSAA will multi-sample coverage or depth and blend one shaded sample based on that coverage – the blending can be out of order – and as a result you get nice AA rasterization without increased shader cost.

But we have a deferred renderer…so this yields two problems:
1. In order to reconstruct the final colors, we need to blend sub-samples into a full pixel _after_ we apply lighting, which means we need the full g-buffer state per _sample_ ahead of time. In other words, if the hw computes coverage in pass 1 and mixes down a final per-pixel g-buffer state, that g buffer is the average of all contributing samples and thus totally wrong.

So at a minimum, coverage or depth-only style multi-sampling is not adequate; even if the shader is called once per pixel, the results must be stored per sample.

2. How do we then save any work? I suppose the answer is: if the lighting calcs are expensive, we would loop through our multi-samples and identify and weight the existing fixed number of unique g-buffer tuples. That is, in some cases we might early-exit because all g-buffer tuples are the same, or we’d even get to run the lighting calcs only for as many cases as we have.

(It might be quicker to only optimize the coherent case…hard to say without real data.) For fine geometry, where polygon edges are cutting through a lot of pixels (especially with tessellation) we might not hit the optimal case very much.

]]>