Inkscape.org
Beginners' Questions White lines appear after "Path -> Difference". How to remove them the right way?
  1. #1
    maxmoon maxmoon @maxmoon

    I am trying to create a cake and have the problem that white lines appear if I use "Path -> Difference". In several tutorials people show they just disappear if the two objects get duplicated, which have this line in between.

    My questions are:

    • Why do the white lines disappear if those new objects are 1:1 copies of the existing ones?
    • What is the right way to get rid off of those white lines?

    I've attached a picture with and without duplicates.

    White Lines
  2. #2
    Polygon Polygon @Polygon🌶
    🙇

    The white line (depends on the background color) is an anti aliasing issue which might be compensate by duplicating/tripling the objects as a workaround. It´s fairly easy to draw a "non-affected" cake:

     

  3. #3
    maxmoon maxmoon @maxmoon

    Thanks a lot for this nice demonstration. I "rescued" my cake with your trick by using union.

    I still don't understand anti aliasing exactly, because if I export it to png, a transparent line will be there and I can zoom in to see it really good. And how it is compensating the line if I duplicate an object, which should be "pixel perfect" the same object and should be at the same position, is something I can't understand. But maybe I don't have to!?

    I would give you a slice of a cake in real life just to appreciate your help :) 

  4. #4
    Polygon Polygon @Polygon🌶
    👍

    If you place the horizontally lines absolut pixel perfect and the numbers/size are even numbers the export should be "perfect" eben though the rendering in Inkscape will still show a gap at certain zoom levels:

     

    Thanks for the kind offer. 🍰

  5. #5
    Lazur Lazur @Lazur
    👍

    @maxmoon Anti-aliasing is the process of sampling the image into pixels on screen. 

    When the nodes of that horizontal line don't match the px grid rendered on screen, the renderer assumes in a pixel area there is:

    50% of the cake, 50% of the background -for both the top and bottom. 

    So you will see the top fill at a 50% opacity, and the bottom part at 50% opacity too. 

    And those two won't add up to 100%.  Like, if you draw two solid filled rectangles atop eachother with 50% opacity, the background shows through.

     

    This "gap issue" is always present with anti-aliasing, however if the compositing is different you can manage the two opacities adding up to an opaque fill -theoretically.

    (Worth mentioning as a side note that using linearrgb colorspace may make things much smoother.)

     

    How can you overcome the issue?

    Either by avoiding making cuts where objects share the same path segments or by forcing a more aliased rendering. 

    Latter can be achieved by duplicating your objects atop eachother like 3 times. (Then you wouldn't have 2 rectangles with 50% opacity atop eachother but 6, giving a more opaque result -less visible gap.)

    Third option could be by oversampling -illustrator does that for on-screen rendering. This gap is always present and remains in the same 1 px range no matter how much you zoom in. 

    Oversampling means rendering a larger portion than you need and scaling it down afterwards. 

    Technically only the first can create 100% clean renderings but is the most complicated drawing wise.

     

     

Inkscape Inkscape.org Inkscape Forum Beginners' Questions White lines appear after "Path -> Difference". How to remove them the right way?