Monday, May 20, 2019

3d - Is it more efficient to render full size with AA, or scaled down with no AA?


Which is more resource-efficient (given a typical modern 3D game scene):



  • Rendering it at 100% scale with anti-aliasing, or

  • Rendering it larger and scaling it down to fit the screen, but without AA?



The idea is that anti-aliasing is a really expensive operation and avoiding it makes things faster. Is this the case?


I haven't had the opportunity to try it, since I work almost exclusively with 2D games.



Answer



The second option - drawing at a higher resolution than the target and downsampling to the target resolution - is known as supersampling and is considered a form of AA; if you read about this topic you'll see it referred to as SSAA.


It will almost certainly be slower than turning on other AA techniques built into modern games, such as MSAA (multisampled antialiasing, which is usually what people mean when they just say "AA" without any other qualifiers) or postprocessing effects like FXAA or MLAA. All these techniques were developed precisely to provide a faster alternative to SSAA.


For example, if you're doing 4xSSAA (let's say), you're drawing an image twice the width and height of the final image, so that you have 4 samples per pixel of the final image. Then, whenever you run a pixel shader on some object, you're running it 4 times for each final image pixel touched by that object. In contrast, with 4xMSAA you'll only run the pixel shader once for each final image pixel touched, and replicate that result to all 4 samples. This allows you to greatly reduce the amount of shader work while still getting the effects of antialiasing along geometry edges, which is where it matters most. This is typically much faster than SSAA. Modern GPUs also have compression schemes to reduce the memory bandwidth used for MSAA, which helps performance further.


And if you turn on a postprocessing AA method it'll be even faster (although the results aren't quite as good), as it is simply rendering the frame normally, at the target resolution, then going over it afterward with a shader that detects and repairs jaggies.


So, you can expect that the AA methods available in typical games these days are far faster than simply rendering at a higher resolution and downsampling.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...