Jump to content
  • Advertisement
Sign in to follow this  
luckyyyyyy

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

This topic is 2619 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 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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
This call is invalid
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_LINEAR)

also, call glGetError() to catch errors.

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!