Sign in to follow this  
Ianmh

Anti-aliasing question

Recommended Posts

I have been messing around trying to get Anti-aliasing working for a few days now. I was using a very large image, over 2000px wide and had scaled it to about 200px. It was constantly aliased no matter what I tried. By chance I changed the scale and brought it up to .5 and immediately things started looking better. Is this normal?

Share this post


Link to post
Share on other sites

Welcome to the "I know what mipmapping is" club. Make it 2048 (power-of-two), pixi/webgl will automatically make mipmap for it: series of images that are .5 of each other. Read up what mipmapping is in the web, then look at 

0. https://github.com/pixijs/pixi.js/blob/dev/src/core/textures/BaseTexture.js#L177

1. https://github.com/pixijs/pixi.js/blob/dev/src/core/renderers/webgl/TextureManager.js#L139 

2. https://github.com/pixijs/pixi-gl-core/blob/master/src/GLTexture.js#L233

The main idea is that for specific pixel you have to determine which color is the texture. Sampling just one point from original picture is not enough, so instead its sampling point from one or two "levels" of picture that has to be pre-generated.

Share this post


Link to post
Share on other sites

Thanks for the info, really wish I had of asked sooner, graphics look so much better. How does this apply to texture packed images, I assume it would be the dimensions of each individual image and not the whole sheet? 

Share this post


Link to post
Share on other sites

It applies to whole base texture, but you have to add some constrains on it: if two neighbour textures somehow make it to the same big pixel, the result wont be good.

Make it that way every small region coordinate is multiple of 8, if you want to use zoom <=8.0,  16 if zoom<=16.0 and so on.

It can also be done with padding.

 

Search for those settings in the texture packer you use (i dont know which one).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.