Page 1 of 1
Jagged filled shapes
Posted: Wed Sep 13, 2017 7:49 pm
by The_JinJ
Hi
Sorry, newbie question!
Is it possible to smooth filled shapes drawn? If I draw a rectangle with rounded corners the results are jagged edges. If I draw a line rectangle it is much smoother.
Cheers!
Re: Jagged filled shapes
Posted: Wed Sep 13, 2017 10:25 pm
by Sir_Silver
From
https://love2d.org/wiki/love.graphics.rectangle
Code: Select all
love.graphics.rectangle( mode, x, y, width, height, rx, ry, segments )
Increase the number of segments to decrease the jagged look.
Re: Jagged filled shapes
Posted: Wed Sep 13, 2017 11:28 pm
by The_JinJ
Apologies, I meant to add that increasing segments doesn't have any effect...
Re: Jagged filled shapes
Posted: Wed Sep 13, 2017 11:44 pm
by Sir_Silver
Ah, have you tried
https://love2d.org/wiki/love.window.setMode ?
You could do something like
Code: Select all
love.window.setMode(800, 600, {msaa = 16})
where the 800 and 600 are whatever width and height dimensions you want for your window, and the msaa = 16 is the level of anti aliasing (smooths out jagged edges)
Re: Jagged filled shapes
Posted: Thu Sep 14, 2017 10:06 am
by The_JinJ
Same output :/
Sir_Silver wrote: ↑Wed Sep 13, 2017 11:44 pm
Ah, have you tried
https://love2d.org/wiki/love.window.setMode ?
You could do something like
Code: Select all
love.window.setMode(800, 600, {msaa = 16})
where the 800 and 600 are whatever width and height dimensions you want for your window, and the msaa = 16 is the level of anti aliasing (smooths out jagged edges)
Re: Jagged filled shapes
Posted: Thu Sep 14, 2017 12:23 pm
by zorg
You could try drawing the line version over the filled; with either the line being a few px bigger, or the filled smaller... if the same size did not work, i mean.
Re: Jagged filled shapes
Posted: Thu Sep 14, 2017 4:19 pm
by Sir_Silver
If Zorg's suggestion doesn't work, would you be so kind as to share the code you've written that makes use of the setmode/msaa function. I tested it out myself, and it had a large impact on reducing the jaggedness of the shape for me.
Re: Jagged filled shapes
Posted: Fri Sep 15, 2017 6:46 am
by Santos
I suspect that maybe a MSAA value of 16 is higher than the maximum possible MSAA value of the computer that you're using (like the computer that I'm using).
Maybe you could try 8:
Code: Select all
love.window.setMode(800, 600, {msaa = 8})
This can also be set in
love.conf to avoid the flickering of the window as it changes modes.
You can find the "canvasmsaa" limit using
love.graphics.getSystemLimits. For the computer I am using this is 8. I'm not sure if this is the same as the limit for drawing to the screen.
I'm also not sure if there is an MSAA value which is usable on all computers, or anything else about MSAA for that matter.