how to remove texture aliasing .. ? Anti-aliasing techniques required..

Started by
10 comments, last by Nik02 12 years, 6 months ago
Hello guys..

Kindly guide me how can I remove image aliasing in OpenGL...

I am projecting the image on the object, the model should look like as it is. but we can see the aliasing jumps on the given image.

Kindly observe the attached image and tell me how can I apply anti-aliasing on this kind of image.

I have also tried following techniques using
  • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR);
  • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_LINEAR);

  1. #define GL_NEAREST 0x2600
  2. #define GL_LINEAR 0x2601
  3. #define GL_NEAREST_MIPMAP_NEAREST 0x2700
  4. #define GL_LINEAR_MIPMAP_NEAREST 0x2701
  5. #define GL_NEAREST_MIPMAP_LINEAR 0x2702
  6. #define GL_LINEAR_MIPMAP_LINEAR 0x2703
etc etc.

Is there any other technique to remove these aliasing jumps.. ?


Thanks.
Advertisement
Looks to me like the alias is on the edges of those objects you project the image on.

changing texture filter will not affect the edges of objects

You could try turn on full screen anti alias: http://www.opengl.org/wiki/Multisampling
I dont know what I'm looking at in those pictures but LINEAR_MIPMAP_LINEAR is the best.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal


I dont know what I'm looking at in those pictures

Me neither. But from what I see, it doesn't look like a filtering problem at all. More like incorrectly done projective texturing. And some artifacts look like they should be done per-pixel rather than interpolated per-vertex. Possibly the projective divide, not using the right texture sampling functions (ie. using texture2d instead of texture2dproj), not supplying the correct homogeneous component or something along these lines. There's really not much more one can say from the very sparse information given in the OP.
Thanks guys..

the problem has been solved by enabling the multi-sampling and super-sampling.

the setting can be configured from Nvidia control panel.

Thanks again
This call is invalid
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_LINEAR)

also, call glGetError() to catch errors.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This call is invalid
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_LINEAR)

also, call glGetError() to catch errors.



Thanks for ur suggestion.

but Sorry I couldn't get you what do you mean by Invalid call ?

Now its working fine. is there any affect in pixels due to this call ?
The line specifies the hardware to take the nearest texel from the linearly filtered mip stack. This doesn't make sense when magnifying:

-Usually you want to at least filter the per-level lookup, to avoid pixellation (as in PS1 textures)
-Using mip levels to sample when magnifying doesn't make sense anyway, since all magnified samples are from the first mip level.

The usual (and default) texture magnifying filter is just GL_LINEAR . Furthermore, the specification doesn't even list GL_NEAREST_MIPMAP_LINEAR as a valid value for the magnification filter. Some drivers may internally interpret that value as a correct parameter, but strictly it is an error to use it because potentially all drivers treat it differently. Also, out of linear and nearest-point magnification, which one would you think that the value would represent?

Niko Suni

Reading the documentation helps you here: http://www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml GL_NEAREST and GL_LINEAR are the only valid values for GL_TEXTURE_MAG_FILTER. It doesn't matter if it looks OK for you, it's still wrong and sooner or later it'll cause trouble. If you're lucky it will just crash - at least then you'll be able to hunt down the cause. If you're unlucky weird things will happen and you'll have no idea why. So get the basics right first.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


Reading the documentation helps you here: http://www.opengl.or...exParameter.xml GL_NEAREST and GL_LINEAR are the only valid values for GL_TEXTURE_MAG_FILTER. It doesn't matter if it looks OK for you, it's still wrong and sooner or later it'll cause trouble. If you're lucky it will just crash - at least then you'll be able to hunt down the cause. If you're unlucky weird things will happen and you'll have no idea why. So get the basics right first.


It won't cause a crash. GL just raises a error flag which you can check with glGetError() and GL will leave the value as it was.

The only case you should get a crash is when you are dealing with pointers and you give some bad pointer to GL. In all other cases, GL (the driver, your system), should not crash.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement