Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Having read about anti-aliasing I came to realise that I could render my scene 8X times the original size of the screen and then shrink it to render it on my original screen to improve the effect that I have rendered on the screen. Could someone help me on how to achieve this and is shaders the only way to achieve this?

share|improve this question
1  
As a side note, quincux antialiasing gives very acceptable results while only requiring 2X rendering. –  Sam Hocevar Nov 12 '11 at 13:11
8  
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. –  Kylotan Nov 12 '11 at 17:17

3 Answers 3

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.

share|improve this answer
    
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. –  Nicol Bolas Nov 13 '11 at 1:28
    
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() –  Adam Nov 13 '11 at 17:56

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.

share|improve this answer

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.

share|improve this answer
2  
In what way is this a "modern technique"? What games use this to achieve multisampling? –  Nicol Bolas Nov 12 '11 at 17:49
    
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. –  Sam Hocevar Nov 13 '11 at 13:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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