Having read about anti-aliasing, I came to realise that I could render my scene 8× the original size of the screen, then shrink it to render it on my original screen to improve the effect that I have rendered on the screen.

Is this a good idea? How can I do this? Do I need a shader?

  • 1
    \$\begingroup\$ As a side note, quincux antialiasing gives very acceptable results while only requiring 2X rendering. \$\endgroup\$ – sam hocevar Nov 12 '11 at 13:11
  • 8
    \$\begingroup\$ Although I am not very up-to-date with modern rendering I'm pretty sure there is never a need to do this sort of thing manually. Naive supersampling will give good visual quality but it's the sort of algorithm that will be an option available to you as one of the anti-aliasing approaches. \$\endgroup\$ – Kylotan Nov 12 '11 at 17:17

Um, why don't you just use multisampling like everyone else? Even if you're using deferred rendering, there are ways to use multisampling in tandem with that.

Multisampling covers triangle edge aliasing, while anisotropic filtering covers texture aliasing. Between those two, you pretty much have all the antialiasing techniques you need. Unless you're procedurally generating textures, of course.


The modern technique is to render your scene to one or several framebuffer objects of the desired size, then use these framebuffer objects as textures and render them to the screen. Basic usage means setting the texture to GL_LINEAR and does not require a shader. Advanced usage means using a shader to enhance the antialiasing, for instance by doing edge detection or picking from several FBOs (to achieve quincux antialiasing, for instance).

Another way is to use the accumulation buffer (tutorial here). This will make advanced usage such as gamma correction more difficult to implement, but the basic idea is very simple. It doesn't require shaders either.

  • 2
    \$\begingroup\$ In what way is this a "modern technique"? What games use this to achieve multisampling? \$\endgroup\$ – Nicol Bolas Nov 12 '11 at 17:49
  • \$\begingroup\$ It's the modern way to do supersampling, as opposed to using the accumulation buffer which is deprecated in OpenGL 3. The author wasn't asking for multisampling. \$\endgroup\$ – sam hocevar Nov 13 '11 at 13:07

If you're using D3D there's no need for shaders to implement this. Just create your extra large render target, render your scene to that, and at the end of the frame call StretchRect() to do the resizing of the big render target to the back buffer.

Depending on where the aliasing is coming from, this may not look any better than MSAA, and MSAA is much quicker because it only runs the pixel shader once for each output pixel, and not eight times.

Note that even when using the fixed function pipeline any modern card will convert those settings into pixel shaders in the driver.

You should also make sure you're using the right texture filter settings, and that your textures have mip maps, as both of those are cheap to fix and can cause some nasty aliasing if they aren't right.

  • \$\begingroup\$ First, the user specifically asked for OpenGL (hence the presence of the tag). Second, this algorithm is not specific to D3D. So you could just covert your answer into being more general. \$\endgroup\$ – Nicol Bolas Nov 13 '11 at 1:28
  • \$\begingroup\$ I missed the tag, and neither the question text or title mentioned any API. For OpenGL a quick search says you need glBlitFramebufferEXT() instead of StretchRect() \$\endgroup\$ – Adam Nov 13 '11 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.