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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.