PDA

View Full Version : anti aliasing techniques



Nonozor
04-05-2010, 02:54 PM
Hello!

I need to use anti-aliasing. I'm thinking about using super sampling, with SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES , n ) and mip mapping.

Is it the best choice? Are there other better techniques?

Thanks!

Dark Photon
04-05-2010, 05:40 PM
I need to use anti-aliasing.
Why? Are you trying to solve a specific problem -- if so, what is it? Post a picture.


I'm thinking about using super sampling, with SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES , n ) and mip mapping.
Supersampling != Multisampling.


Is it the best choice? Are there other better techniques?
Without knowing more about the situation in which you think you are experiencing aliasing, either or neither of these could be the best solution.

Post a picture.

Nonozor
04-07-2010, 03:27 PM
Sorry, my bad.

I'm going to use a projector for my rendering, so my pixels will be 0.9 cm, which is huge.

I have not tested it yet because the install is not finished, but I guess that the pixels will be very distinguishable (anywhere an oblique line makes stairs, for exemple). That's why I wanted to use SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES , n ), in order the stairs to be less distinguisable.

Also, I use the same texture on objects and the size of these objects can be 4 time bigger than the one of the smalest one. If the texture has a good quality, there will be aliasing when the projection of the objects on the screen will be small, right? To solve this, I am thinking of using mip mapping.

I hope you have enought informations to help me with this.
Thanks for your answers!

ZbuffeR
04-07-2010, 04:09 PM
Well both multisampling and mipmapping are good to solve your problem.
More details for the SDL multisampling settings :
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=233094#Post2330 94

Mipmapping is good, but trilinear is better, and anisotropic filtering is even better. Each step is a bit slower than the previous, but if you are after visual quality it matters a lot. And aniso 4x is still plenty fast nowadays.
http://www.opengl.org/wiki/Texture#Filtering
http://en.wikipedia.org/wiki/Anisotropic_filtering


There are no really better techniques, unless some special trade-offs. (such as recent advances allowing multiple shader evaluations per pixel, useful for noisy bumps with strong speculars)
Do not hesitate to come back if you have with more precise questions :)

dorbie
04-07-2010, 04:31 PM
Supersampling is probably the best tradeoff between performance and quality and is supported by hardware. But you need hardware & driver support and the requisite framebuffer resources.

Oversampled textures will cause aliasing, MIP-Mapping is the correct approach but tends to blur at oblique angles. As has been said anisotropic texture filtering is the best available option and solves the oblique viewing blur problem, you have a choice as to what degree of anisotropy you support just as you have a choice about the number of samples. But I think you have to code to use MIP maps before anisotropic filtering will kick in, on modern cards you can auto generate mip maps and let the hardware take care of the MIP map texture image generation.

You can also force both multisample and anisotropic filtering and adjust quality vs. performance via desktop settings without needing to alter code. These settings can even override your code choices so users have a lot of power over your rendering when it comes to these properties.

Nonozor
04-11-2010, 06:37 AM
OK, I'm looking at all this stuff.

Thank you for your help!