Page 1 of 1

The rounded rectangle in fill mode has strong aliasing.

Posted: Mon Jun 10, 2024 1:29 am
by yangsiyu
* fill mode
2024-06-10_09-19.png
2024-06-10_09-19.png (58.72 KiB) Viewed 1289 times
* line mode
2024-06-10_09-26.png
2024-06-10_09-26.png (72.58 KiB) Viewed 1289 times
Looking at the source image, they are quite different.

Re: The rounded rectangle in fill mode has strong aliasing.

Posted: Mon Jun 10, 2024 1:39 am
by yangsiyu
Drawing filled circles also has the same issue.

Re: The rounded rectangle in fill mode has strong aliasing.

Posted: Mon Jun 10, 2024 2:21 am
by slime
Lines have their own custom antialiasing/smoothing applied by default (the "smooth" line style) which is only for lines and not other things like images or filled shapes. To have antialiasing on filled shapes, two common approaches are to enable MSAA on the window or to draw a line shape at the same spot as the filled shape.

Re: The rounded rectangle in fill mode has strong aliasing.

Posted: Mon Jun 10, 2024 3:13 am
by yangsiyu
slime wrote: Mon Jun 10, 2024 2:21 am Lines have their own custom antialiasing/smoothing applied by default (the "smooth" line style) which is only for lines and not other things like images or filled shapes. To have antialiasing on filled shapes, two common approaches are to enable MSAA on the window or to draw a line shape at the same spot as the filled shape.
Thanks :awesome:

Re: The rounded rectangle in fill mode has strong aliasing.

Posted: Mon Jun 10, 2024 4:21 am
by RNavega
Also see this alternative, drawing a quad Mesh and using a shader for antialiasing the round corners:
viewtopic.php?p=259055#p259055

If you need the rectangle to be drawn while rotated then you'd need a different shader, one that smooths not only the round corners but also the straight sides.