Hello guys,
this is my first time posting here and I hope I'll receive the help I now need:
I'm writing a simple RPG engine which has tiny textures for everything and to fill the window I used love.graphics.scale(4), but by doing this the font messes up badly so I decided to draw the map in a canvas which it upscales so the fonts and other graphic objects won't look awful and overflow from the window.
Now the problem is the canvas, by upscaling it loses quality:
This how it's supposed to look:
Another problem with the canvas is that it's laggy, I don't have this problem with love.graphics.scale
I hope some of you will help me.
Thanks
[Solved] Canvas upscaling without losing quality
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[Solved] Canvas upscaling without losing quality
- Attachments
-
- engine.love
- (17.61 KiB) Downloaded 143 times
Last edited by Ale32bit on Mon Apr 23, 2018 7:37 am, edited 1 time in total.
Re: Canvas upscaling without losing quality
That's one of the benefits of using a canvas, it allows you to limit the resolution and get that "pixelated" look.
One option is not to use canvases at all (doesn't matter if things overflow).
Another thing you could try is canvas:setFilter("nearest", "nearest")
One option is not to use canvases at all (doesn't matter if things overflow).
Another thing you could try is canvas:setFilter("nearest", "nearest")
Re: Canvas upscaling without losing quality
I alredy tried canvas:setFilter("nearest", "nearest"), it doesn't help sadlyivan wrote: ↑Sun Apr 22, 2018 6:45 pm That's one of the benefits of using a canvas, it allows you to limit the resolution and get that "pixelated" look.
One option is not to use canvases at all (doesn't matter if things overflow).
Another thing you could try is canvas:setFilter("nearest", "nearest")
Re: Canvas upscaling without losing quality
If you want thin lines and thick pixels, you can't draw the lines to the canvas, you have to draw them directly to the screen.
See also here: viewtopic.php?p=199019#p199019
See also here: viewtopic.php?p=199019#p199019
Re: Canvas upscaling without losing quality
The lines are only for Hitbox debug, they normally shouldn't be there in production, so just ignore thempgimeno wrote: ↑Sun Apr 22, 2018 7:43 pm If you want thin lines and thick pixels, you can't draw the lines to the canvas, you have to draw them directly to the screen.
See also here: viewtopic.php?p=199019#p199019
Re: Canvas upscaling without losing quality
Well, with the lines in the middle it's more difficult to see the issue, but it looks like you're drawing the pictures to fractional coordinates. The link I posted also applies to textures/sprites.
Perhaps you need to set your sprites to nearest/nearest as well, not just the canvas.
Perhaps you need to set your sprites to nearest/nearest as well, not just the canvas.
Re: Canvas upscaling without losing quality
I found a solution that completely fixed my problem:
First I removed all canvases in my code, scaled up the part where it draws the game map and scaled down back after drawing the map, right before the text.
For example:
Result:
https://i.ale32bit.me/307tN.png
I want to thank anyone who tried helping me
First I removed all canvases in my code, scaled up the part where it draws the game map and scaled down back after drawing the map, right before the text.
For example:
Code: Select all
love.graphics.scale(4) -- Scale up 4x
-- draw map, entities and more stuff here
love.graphics.scale(1/4) -- Scale down 4x back to normal
-- draw anything else
https://i.ale32bit.me/307tN.png
I want to thank anyone who tried helping me
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 3 guests