2 replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
source | link

To be clear, that black border around your tiles is what you are talking about when you say thee is a "space" inbetween the tiles, right?

You have two options if that is the case:

  1. Alter your coordinates for the tiles so that they range not from [0,1] (relative to the packed tile) but rather [1/2N, 1-1/2N], where N is the size (in texels) of your tile.

  2. Pack your tiles with a border, as described herehere.


The crux of the problem is that you need to implement Edge Clamp behavior (where the texture coordinates are clamped to texel centers instead of the extreme ends of textures). Otherwise, texture filtering will pickup texels from adjacent tiles since you are not using the center of the texel; the sample point is equally distant from the last texel in your tile as it is the first texel in an adjacent tile if you sample on the border.

However, doing that in a packed texture is complicated. The second solution works best for texture atlases used in 3D rendering, the first solution may be adequate for a simple 2D application such as yours.

To be clear, that black border around your tiles is what you are talking about when you say thee is a "space" inbetween the tiles, right?

You have two options if that is the case:

  1. Alter your coordinates for the tiles so that they range not from [0,1] (relative to the packed tile) but rather [1/2N, 1-1/2N], where N is the size (in texels) of your tile.

  2. Pack your tiles with a border, as described here.


The crux of the problem is that you need to implement Edge Clamp behavior (where the texture coordinates are clamped to texel centers instead of the extreme ends of textures). Otherwise, texture filtering will pickup texels from adjacent tiles since you are not using the center of the texel; the sample point is equally distant from the last texel in your tile as it is the first texel in an adjacent tile if you sample on the border.

However, doing that in a packed texture is complicated. The second solution works best for texture atlases used in 3D rendering, the first solution may be adequate for a simple 2D application such as yours.

To be clear, that black border around your tiles is what you are talking about when you say thee is a "space" inbetween the tiles, right?

You have two options if that is the case:

  1. Alter your coordinates for the tiles so that they range not from [0,1] (relative to the packed tile) but rather [1/2N, 1-1/2N], where N is the size (in texels) of your tile.

  2. Pack your tiles with a border, as described here.


The crux of the problem is that you need to implement Edge Clamp behavior (where the texture coordinates are clamped to texel centers instead of the extreme ends of textures). Otherwise, texture filtering will pickup texels from adjacent tiles since you are not using the center of the texel; the sample point is equally distant from the last texel in your tile as it is the first texel in an adjacent tile if you sample on the border.

However, doing that in a packed texture is complicated. The second solution works best for texture atlases used in 3D rendering, the first solution may be adequate for a simple 2D application such as yours.

1
source | link

To be clear, that black border around your tiles is what you are talking about when you say thee is a "space" inbetween the tiles, right?

You have two options if that is the case:

  1. Alter your coordinates for the tiles so that they range not from [0,1] (relative to the packed tile) but rather [1/2N, 1-1/2N], where N is the size (in texels) of your tile.

  2. Pack your tiles with a border, as described here.


The crux of the problem is that you need to implement Edge Clamp behavior (where the texture coordinates are clamped to texel centers instead of the extreme ends of textures). Otherwise, texture filtering will pickup texels from adjacent tiles since you are not using the center of the texel; the sample point is equally distant from the last texel in your tile as it is the first texel in an adjacent tile if you sample on the border.

However, doing that in a packed texture is complicated. The second solution works best for texture atlases used in 3D rendering, the first solution may be adequate for a simple 2D application such as yours.