Jagged filled shapes

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
The_JinJ
Prole
Posts: 8
Joined: Fri Jul 22, 2016 12:43 am

Jagged filled shapes

Post 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.

Image

Cheers!
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Jagged filled shapes

Post 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.
The_JinJ
Prole
Posts: 8
Joined: Fri Jul 22, 2016 12:43 am

Re: Jagged filled shapes

Post by The_JinJ »

Apologies, I meant to add that increasing segments doesn't have any effect...
Last edited by The_JinJ on Thu Sep 14, 2017 9:11 am, edited 1 time in total.
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Jagged filled shapes

Post 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)
The_JinJ
Prole
Posts: 8
Joined: Fri Jul 22, 2016 12:43 am

Re: Jagged filled shapes

Post 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)
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Jagged filled shapes

Post 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.
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.
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Jagged filled shapes

Post 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.
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Jagged filled shapes

Post 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. :P
Post Reply

Who is online

Users browsing this forum: No registered users and 66 guests