Quads and artifacts from sprite sheets
Posted: Wed Jul 06, 2011 8:06 pm
Hello lovely people,
I've been playing with quads and selecting sprites from a spritesheet and I've been seeing some spillover from neighbouring portions of the spritesheet. I'm running Windows 7, 64 bit.
I don't really have any shareable code but I noticed that it also happens in GloryFish's game which he submitted this year for a reddit game jam, I hope he doesn't mind me posting this.
If you look at the screenshot in which I've zoomed in to the relevant bit, and the sprite sheet, you can see the bird picks up a little bit of the neighbouring sprite (the relevant ones are the top two on the spritesheet image). The extra bits are not the same width as the pixels of the bird itself so it's not just the code overreaching into the next sprite on the sheet and also they are not there all the time - it depends on where you are on screen.
Also, because the artifacts are being pulled from the neighbouring image somehow, I'm fairly sure that must mean it's not just crappy graphics hardware on my computer freaking out and drawing randomness.
The relevant bits of code (from the player.lua file) are:
I've been playing with quads and selecting sprites from a spritesheet and I've been seeing some spillover from neighbouring portions of the spritesheet. I'm running Windows 7, 64 bit.
I don't really have any shareable code but I noticed that it also happens in GloryFish's game which he submitted this year for a reddit game jam, I hope he doesn't mind me posting this.
If you look at the screenshot in which I've zoomed in to the relevant bit, and the sprite sheet, you can see the bird picks up a little bit of the neighbouring sprite (the relevant ones are the top two on the spritesheet image). The extra bits are not the same width as the pixels of the bird itself so it's not just the code overreaching into the next sprite on the sheet and also they are not there all the time - it depends on where you are on screen.
Also, because the artifacts are being pulled from the neighbouring image somehow, I'm fairly sure that must mean it's not just crappy graphics hardware on my computer freaking out and drawing randomness.
The relevant bits of code (from the player.lua file) are:
Code: Select all
player.tileSize = 16
player.scale = 2
player.offset = vector(player.tileSize / 2, player.tileSize / 2)
...
player.animations['standing'].quads = {
love.graphics.newQuad(4 * player.tileSize, 0, player.tileSize, player.tileSize, player.tileset:getWidth(), player.tileset:getHeight()),
love.graphics.newQuad(5 * player.tileSize, 0, player.tileSize, player.tileSize, player.tileset:getWidth(), player.tileset:getHeight()),
love.graphics.newQuad(6 * player.tileSize, 0, player.tileSize, player.tileSize, player.tileset:getWidth(), player.tileset:getHeight()),
love.graphics.newQuad(7 * player.tileSize, 0, player.tileSize, player.tileSize, player.tileset:getWidth(), player.tileset:getHeight())
}
...
love.graphics.drawq(self.tileset,
self.animations[self.animation.current].quads[self.animation.frame],
self.position.x,
self.position.y,
0,
self.scale * self.flip,
self.scale,
self.offset.x,
self.offset.y)
end