Anti-aliasing gap issue

Share your Inkscape tricks and tutorials here.
Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Anti-aliasing gap issue

Postby Lazur » Thu Dec 07, 2017 3:18 am

This problem is as old as anti-aliasing itself -double edges produces rendering issues with the alpha channel.

There are several topics of related problemshere and there, most noticeably about the "gap issue". If objects with the same edges are next to eachother, the background shows through.

Recently came across a great description of the problem here, and find it was worth a topic for better searching and/or for future additional thoughts:
vector rasterization process

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Anti-aliasing gap issue

Postby Lazur » Sat Mar 03, 2018 11:05 am

Bumping this topic

-made 3 videos describing the problem and showing a workaround that theoretically could come handy when drawing a low-poly art or pixelart,
linked in the bug description #comment here.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Anti-aliasing gap issue

Postby Lazur » Sat Mar 03, 2018 11:07 am


Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Anti-aliasing gap issue

Postby Lazur » Sat Mar 03, 2018 11:37 am

Getting closer.

#simplealphacompositingexamples
example 9
Image

-this is where the problem is at.
Figure 4 shows an example where both the shape and the backdrop are transparent.

Applying the compositing formula in the area of intersection, gives:

Cs = RGB(0,0,1)
αs = 0.5
Cb = RGB(1,0,0)
αb = 0.5

co = Cs x αs + Cb x αb x (1 - αs)
co = RGB(0,0,1) x 0.5 + RGB(1,0,0) x 0.5 x (1 - 0.5)
co = RGB(0,0,1) x 0.5 + RGB(1,0,0) x 0.25
co = RGB(0.25, 0, 0.5)
Calculating the alpha of the resultant composite

αo = αs + αb x (1 - αs)
αo = 0.5 + 0.5 x (1 - 0.5)
αo = 0.75
Calculating the color component of the resultant composite

Co = co / αo
Co = RGB(0.25, 0, 0.5) / 0.75
Co = RGB(0.33, 0, 0.66)


There should be another compositing mode besides clear | copy | source-over | destination-over | source-in |
destination-in | source-out | destination-out | source-atop |
destination-atop | xor | lighter -one being "additive alpha cut".

That'd allow making gapless low-poly art like this:
SVG Image


Edit:
made a request here.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Anti-aliasing gap issue

Postby brynn » Sun Mar 04, 2018 6:47 am

Edit:
made a request here.

Yes, I was just going to suggest bringing the idea to developers! I'm afraid that is all over my head....

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Anti-aliasing gap issue

Postby Lazur » Sun Mar 04, 2018 8:26 am

brynn wrote:
Edit:
made a request here.

Yes, I was just going to suggest bringing the idea to developers! I'm afraid that is all over my head....


If you look closely I did that already almost a year ago.
Which got zero response at the time.

The recent feature request was issued straight to w3c css draft developers instead, so it may reach into svg 2 specs more likely...

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Anti-aliasing gap issue

Postby brynn » Tue Mar 06, 2018 9:11 am

From viewtopic.php?f=5&t=32501#p99149


Tip for request #1 -- might be better to put at least an overview in the LP post, and include relevant files, screenshots, etc. Developers might not want to read the forum thread to figure out exactly what you mean. (Although link to forum thread is good as something like footnote.)

Request #2 got response!

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Anti-aliasing gap issue

Postby Lazur » Tue Mar 06, 2018 10:24 am

Got response by Jabiert who directed me to #lgm @freenode right before, which lead me to github's w3c project -after 3 video uploads.
(With the suggested workaround brute-forcing the anti-aliasing=setting a shorter gradient in the approximate model.)
If it was only for that bug report it would never got any attention.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Anti-aliasing gap issue

Postby Moini » Tue Mar 06, 2018 11:24 pm

Can you share a link to what's happening on github, Lazur?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Anti-aliasing gap issue

Postby Lazur » Wed Mar 07, 2018 6:53 am

Moini wrote:Can you share a link to what's happening on github, Lazur?


Lazur wrote:Getting closer.
...

Edit:
made a request here.


Nothing has happened yet.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Anti-aliasing gap issue

Postby Moini » Wed Mar 07, 2018 7:18 am

Lol, I thought that was a request for Inkscape.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Anti-aliasing gap issue

Postby Lazur » Wed Mar 07, 2018 7:55 am

Moini wrote:Lol, I thought that was a request for Inkscape.


101, that was in the linked topic in the very first post of this topic.

Lazur wrote:This problem is as old as anti-aliasing itself -double edges produces rendering issues with the alpha channel.

There are several topics of related problems here and there, most noticeably about the "gap issue". If objects with the same edges are next to eachother, the background shows through.

Recently came across a great description of the problem here, and find it was worth a topic for better searching and/or for future additional thoughts:
vector rasterization process




http://www.inkscapeforum.com/viewtopic.php?f=5&t=32501#p99149


Return to “Tricks & Tutorials”