Jump to content
  • Advertisement
Sign in to follow this  
vladic2000x

OpenGL Aliasing confusion

This topic is 1930 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

 

I am a bit confused on the aliasing problem in computer graphics(OpenGL), specifically:

 

1. In the picture below, the checkerboard texture is laid on a rectangle consisting of 2 triangles. Please note at the bottom of the image the jagged  edges of black and white blocks of the texture:

 

http://www.arcsynthesis.org/gltut/Texturing/BasicCheckerboardPlane.png

 

Is that problem called aliasing?

 

2. In the picture below, the same jagged effect can be seen on the edges of the right-most two triangles:

 

http://slizerboy.files.wordpress.com/2009/11/anti-alias.png?w=343&h=150

 

Is that the same aliasing problem?

 

I'm asking this because in first case, texture sampling is involved but in the second case there is no texture. 

 

 

3. If in the first example the issue is called aliasing, can we say that using linear filtering as magnification/minification filters in sampling the texture represent an anti-aliasing technique? I have searched the web for OpenGL anti-aliasing and I mostly read about "multisampling", so I'm wondering if linear and mipmap filtering can be considered anti-aliasing techniques?

Edited by vladic2000x

Share this post


Link to post
Share on other sites
Advertisement
  1. yes
  2. yes
  3. no and no

Linear filtering is texture filter. If you attempt to take color between 2 pixels linear filter will interpolate them.

Aliasing is... Like in your 2nd picture. You draw white line on black background, so pixels are completely white or completely black. It doesn't look like a line since you can see pixels, it's more like bunch of rectangles. Anti-aliasing is supposed to smooth out these pixels, to make it look like an actual line. Here's some example: http://international.download.nvidia.com/webassets/en_US/shared/images/articles/introducing-the-geforce-gtx-680-gpu/TXAA.png

Share this post


Link to post
Share on other sites

1. Yes, that's aliasing. Essentially you have some signal that's stored in a texture, and the fragment shader samples that signal. If the fragment shader doesn't sample at an adequate rate relative to the rate at which the signal changes (the frequency of the signal), then you get aliasing. A black and white checkerboard is basically a series of step functions, and sampling step functions will always result in aliasing because they have an infinite rate of change.

 

2. Yes, that's a similar case of aliasing. In this case the aliasing stems from the rasterizer, which samples some signal (in this case a triangle) at a fixed set of sample positions (usually aligned to the center of pixels). A triangle edge is also a step function, so you get the same aliasing problem.

3. Yes, texture filtering is a very important means of anti-aliasing. Filtering reduces aliasing by attenuating high-frequency components of a signal, but can also remove detail that's present in those higher frequencies. However if you oversample by sampling at a higher rate than your screen resolution and then filter the result when downsampling, you can reduce aliasing while still preserving details. This is the basic premise behind both texture filtering and MSAA. The former works with texture sampling, and the later works with the rasterizer. With texture sampling you typically take 4 texture samples in a 2x2 grid and perform linear filtering, which allows you to avoid aliasing as long as your sampling rate is no less than 1/2 the resolution of your texture. So if you had a 512x512 texture, bilinear filtering won't alias as long as the texture is mapped to an area of the screen that's >= 256x256 pixels. If you need to go lower, you need to use pre-filter by creating a chain of mip maps. This "no less than 1/2 the texture resolution" rule is why you create each mip level to be 1/2 the size of the previous level.

If you're interested in this sort of thing, I have a rather lengthy series of articles on my blog regarding sampling and aliasing. It may put you to sleep, but there's a lot of (hopefully useful) info in there.

Edited by MJP

Share this post


Link to post
Share on other sites

Regarding the apparent disagreement in previous answers, filtering and mipmapping reduce aliasing in texture lookups (approximate sampling from wrong texture coordinates) which is separate from aliasing in rendering (approximate drawing to wrong frame buffer positions) but conceptually similar. They are addressed in different ways for technological reasons; for example, filtering texture lookups has been a cheap commoditized basic feature since the period of fixed function pipelines, while the same kind of filtering applied to rendering is a luxury because it would need expensive additional fragments as input.

Edited by LorenzoGatti

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!