Scaling accuracy and spritebatches

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Scaling accuracy and spritebatches

Post by grump »

Array texture support coming in 0.11 solves the bleeding problem on supporting hardware, and also allows for proper texture wrapping.
hasen
Party member
Posts: 157
Joined: Sat Jan 20, 2018 2:01 pm

Re: Scaling accuracy and spritebatches

Post by hasen »

grump wrote: Thu Mar 01, 2018 8:01 am
hasen wrote: Thu Mar 01, 2018 7:17 am But the padding is normally transparent or one single colour (usually white), not the same colour as the tile...since the tiles are gonna be all different colours while the padding is all the same colour
Making the border around each tile the same colors as the actual tile edges (i.e. repeating the outermost rows/columns once) takes care of that.
Yes that was already said above, I was just remarking that the padding used in tile software is white or transparent so is not for that use. It seems to me it's so the tiles have separation for ease of use visually. Other tile making tutorials or game making tutorials used exact size tiles normally like 16/32 etc so I didn't see how it could be a common problem in game making.
grump wrote: Thu Mar 01, 2018 8:42 am Array texture support coming in 0.11 solves the bleeding problem on supporting hardware, and also allows for proper texture wrapping.
Oh really? That sounds great.
hasen
Party member
Posts: 157
Joined: Sat Jan 20, 2018 2:01 pm

Re: Scaling accuracy and spritebatches

Post by hasen »

zorg wrote: Thu Mar 01, 2018 8:09 am If i'm not mistaken, transparent and single-colour padding doesn't help, since if/when the gpu will try to sample beyond the defined region of the sprite itself (usually due to UV coordinate sampling happening at texture edges, and not centers, therefore the GPU interpolating between two pixel colors), it needs to find the same colors that the tile's respective edges have, otherwise you'll still see issues, like pixels being more white (if that's your padding color) or the pixel colors from "below" showing through somewhat (if your padding is transparent); this also means that you do need to "extrude" those tiles in all four directions, meaning that in most places, there will be not 1, but 2 pixels of padding between them (anywhere except the edges of the atlas itself)
The real problem, at least in my specific case is that I can't apply math.floor to the result of love.graphics.scale...so it's giving a decimal result and thus pixel bleed? I'm not sure of the inner workings of love.graphics.scale that's my theory.
zorg wrote: Thu Mar 01, 2018 8:09 am Then again, i might be wrong, and the padding may only need to match the right and bottom edges of each tile, giving back a 1-pixel padding.
Yes that's a good point. Since at least in my case it's like this; the screen is being drawn at the top left and thus being stretched towards the bottom right. So I'm only seeing pixel bleed on the right side of tiles.
zorg wrote: Thu Mar 01, 2018 8:09 am (Also, just a minor complaint to nobody in particular, but it would be so nice if google search wasn't saturated with answers only pertaining to Unity)
While we're ranting about google, it's annoying that it always thinks I mean 'camera' when I search about 'gamera'.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Scaling accuracy and spritebatches

Post by zorg »

...on my end, Gamera gives me tons of godzilla stuff :P

Also, the padding should be exactly there to fix that kind of bleeding, as well as the one resulting from movement too; at least i myself had that kind of issues before.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
hasen
Party member
Posts: 157
Joined: Sat Jan 20, 2018 2:01 pm

Re: Scaling accuracy and spritebatches

Post by hasen »

zorg wrote: Thu Mar 01, 2018 10:07 am ...on my end, Gamera gives me tons of godzilla stuff :P

Also, the padding should be exactly there to fix that kind of bleeding, as well as the one resulting from movement too; at least i myself had that kind of issues before.
But how does it fix the issue if the padding is white ie not the same colour as the tile? For me it's already bleeding through to white since the next tile along is white.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Scaling accuracy and spritebatches

Post by zorg »

It fixes it, if you pad by repeating the last row/column, as others have said before.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
hasen
Party member
Posts: 157
Joined: Sat Jan 20, 2018 2:01 pm

Re: Scaling accuracy and spritebatches

Post by hasen »

zorg wrote: Thu Mar 01, 2018 10:19 am It fixes it, if you pad by repeating the last row/column, as others have said before.
I think I'm a bit confused. So tiles like this with padding would fix the issue?

https://opengameart.org/sites/default/f ... review.png

https://www.spriters-resource.com/resou ... /57759.png
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Scaling accuracy and spritebatches

Post by zorg »

If all the pixels at the edges of your sprites are transparent, then the padding can also be transparent;
usually the problem comes in when you use sprites that fill up the whole unit (ground tiles instead of characters, for example), and there's no transparency around the edges. (That said, looking at the mario tileset you linked, some items do have a green background for some reason;if that's also transparency, i'd convert that to a transparent black, if i were you; löve doesn't need to use magic pink and other tricks)

But in short, it should fix the issue with that kind of tiles.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
hasen
Party member
Posts: 157
Joined: Sat Jan 20, 2018 2:01 pm

Re: Scaling accuracy and spritebatches

Post by hasen »

zorg wrote: Thu Mar 01, 2018 10:43 am If all the pixels at the edges of your sprites are transparent, then the padding can also be transparent;
Ok so purely square tiles for terrain would also be fine with transparent borders though right?
zorg wrote: Thu Mar 01, 2018 10:43 am usually the problem comes in when you use sprites that fill up the whole unit (ground tiles instead of characters, for example), and there's no transparency around the edges. (That said, looking at the mario tileset you linked, some items do have a green background for some reason;if that's also transparency, i'd convert that to a transparent black, if i were you; löve doesn't need to use magic pink and other tricks)

But in short, it should fix the issue with that kind of tiles.
Ok so these ones maybe not so good then. I think the reason is often for clarity, especially with terrain tiles, without the spacing it looks like one huge block of mess lol. I'll look out for ones on a transparent background. Thanks for your help.

But didn't you say in your first response "transparent and single-colour padding doesn't help" ?
KayleMaster
Party member
Posts: 234
Joined: Mon Aug 29, 2016 8:51 am

Re: Scaling accuracy and spritebatches

Post by KayleMaster »

I set the default filter to 'nearest' and it worked for me (I have 1px of space between quads).
I'm not sure if I'm drawing at non integer positions tho.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest