Hello! I recently have gotten back into LOVE, and have tried messing around with loading Tiled levels from scratch. Everything works fine, but there seems to be one problem. Quads make the image blurry. Especially when scaling. Is there any to fix this? I saw a solution by adding a border around each sprite, but that seems like a way to get around the problem instead of fixing it.
Thanks!
EDIT: That was embarrassing. Instead of using quads, it is easier to break up the image into smaller ones with ImageData, using paste. Thanks anyways!
Spritesheets [SOLVED]
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Spritesheets [SOLVED]
- Attachments
-
tiles1.love
- (8.19 KiB) Downloaded 62 times
Re: Spritesheets [SOLVED]
Doing it that way will ruin the idea of spritesheet completely. You can as well not use it at all, simply using a set of separate images. What is wrong with using 1px borders? This is a small price for effectiveness given by spritesheet + quads.Prynok wrote:Instead of using quads, it is easier to break up the image into smaller ones with ImageData, using paste.
Re: Spritesheets [SOLVED]
Everything is blurry when scaled without filter set to nearest. Have you set a default filter ("nearest", "nearest") before loading the images? With Quads you get a performance boost when drawing using the same image/texture/spritebatch.Prynok wrote:Hello! I recently have gotten back into LOVE, and have tried messing around with loading Tiled levels from scratch. Everything works fine, but there seems to be one problem. Quads make the image blurry. Especially when scaling. Is there any to fix this? I saw a solution by adding a border around each sprite, but that seems like a way to get around the problem instead of fixing it.
Thanks!
EDIT: That was embarrassing. Instead of using quads, it is easier to break up the image into smaller ones with ImageData, using paste. Thanks anyways!
Re: Spritesheets [SOLVED]
arampl wrote:Doing it that way will ruin the idea of spritesheet completely. You can as well not use it at all, simply using a set of separate images. What is wrong with using 1px borders? This is a small price for effectiveness given by spritesheet + quads.Prynok wrote:Instead of using quads, it is easier to break up the image into smaller ones with ImageData, using paste.
There are still tons of uses for sprite sheets with this method. Since there are more patterns, a image compression program can compress it down more. Also, can you explain the effectiveness of quads? I don't think I understand.
Thanks!
Re: Spritesheets [SOLVED]
Well, first using ImageData:paste, then showing that data on screen is almost like drawing it 2 times, right?
Second, when using quads and one big image you don't need to switch between different images, which is an additional "talk" beetween CPU and GPU. With quads you only choose which part of image (currently used by GPU) to draw.
Your method will work OK until you add more layers / use bigger maps(tiles).
Second, when using quads and one big image you don't need to switch between different images, which is an additional "talk" beetween CPU and GPU. With quads you only choose which part of image (currently used by GPU) to draw.
Your method will work OK until you add more layers / use bigger maps(tiles).
Re: Spritesheets [SOLVED]
It's easiest to explain with underlying opengl pseudocode:Prynok wrote:arampl wrote:Doing it that way will ruin the idea of spritesheet completely. You can as well not use it at all, simply using a set of separate images. What is wrong with using 1px borders? This is a small price for effectiveness given by spritesheet + quads.Prynok wrote:Instead of using quads, it is easier to break up the image into smaller ones with ImageData, using paste.
There are still tons of uses for sprite sheets with this method. Since there are more patterns, a image compression program can compress it down more. Also, can you explain the effectiveness of quads? I don't think I understand.
Thanks!
Code: Select all
-- what you write:
love.graphics.draw(Image.enemy, e.x, e.y)
love.graphics.draw(Image.player, p.x, p.y)
-- what I'd write
love.graphics.draw(Image.all, e.quad, e.x, e.y)
love.graphics.draw(Image.all, p.quad, p.x, p.y)
Code: Select all
// your way:
main() {
all = loadImage("all")
enemy = pushToGPU(getPart(all, "enemy"))
player = pushToGPU(getPart(all, "player"))
// everything else
while ( true) {
setTexture( enemy )
drawQuad( buildQuad( e.x, e.y, ... ) )
setTexture( player )
drawQuad( buildQuad( p.x, p.y, ... ) )
}
}
// my way:
main() {
all = pushToGPU(loadImage("all"))
// everything else
while ( true) {
setTexture( all )
drawQuad( buildEnemyQuad( e.x, e.y ) )
drawQuad( buildPlayerQuad( p.x, p.y ) )
}
}
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 6 guests