Easy

Texture Atlas wrong position

7 posts in this topic

I use texture atlas for tiled map. I use firefox. Today i run my game in Google Chrome and saw border between tiles.

MjQtMDUtMTYtMTM6NDg6MjAtM2VkMjZlNTg2ZjdkMWZhY2E0ZTQxYWUyNjU4YzViM2QgLQo=.png

Each tile on the left is from one pixel to the previous. Just like positiion.x - 1px. I don't know what i can do. Help me please.

var loader = PIXI.loader;
loader.add(Resouce.name);
loader.load(function() {
    var texture = PIXI.loader.resources[Resouce.name].textures["grass.jpg"];
    texture.baseTexture.scaleMode = PIXI.SCALE_MODES.NEAREST;
    var sprite = new PIXI.Sprite(texture);
});

 

atlas.json

atlas.png

Share this post


Link to post
Share on other sites
12 minutes ago, ivan.popelyshev said:

Hello! Please pack your texture with TexturePacker (paid) or Shoebox (free), and specify "reduce border artifacts", also set some border=1 or better 2. https://github.com/pixijs/pixi-tilemap also takes care of the issue.

I use spritesheet-js because i don't use windows. Maybe there's another fix?

Share this post


Link to post
Share on other sites

I thought Shoebox doesnt need windows. There are three ways

1. use https://github.com/pixijs/pixi-picture  (example code  http://pixijs.github.io/examples/index.html?s=picture&f=border-artifacts.js&title=Border%20artifacts&plugins=pixi-picture&v= )

2. use pixi-tilemap but to reduce artifacts your tiles must be SQUARES

3. pack textures with a border and reduced border artifacts option.

The first way is naive and slow, while the second and third way are effective.

Share this post


Link to post
Share on other sites

I fixed it with spritesheet-js! I just used flag --algorithm vertical. It's like hack, but it's working.

Share this post


Link to post
Share on other sites
1 minute ago, Easy said:

I fixed it with spritesheet-js! I just used flag --algorithm vertical. It's like hack, but it's working.

Use 

--padding     padding between images in spritesheet

 

1 if your scale is below 2, 2 if its below 4, 4 for 8 and so on. Because of mipmapping.

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

  • Recently Browsing   0 members

    No registered users viewing this page.