Skip to content

Feathered Outlines (and Adv. Outlines) Look Broken on the Workarea at Lower Resolutions (1.5.0) #2274

Open

Description

@FadhilKwan

Describe the bug
In 'Preview' or 'Draft' rendering mode, the outlines and adv. outlines that have 'Feather' properties within them become pretty jagged-looking and a little weird.

To Reproduce
Make sure to keep the rendering mode on 'Preview' throughout the process

  1. Create any outline (or adv. outline) layer
  2. Set its width to a relatively small amount, which is somewhere around 1 to 1,5cm
  3. Find line's 'Feather' property in 'Parameters' panel, then set it to a positive value, like 0,5
  4. Try zooming in and out on that line. You should be able to spot some jagged sections.

Alternatively, you can extract and open the test file that I provided below, then try zooming in and out at them.
JaggedLines-DraftLowres-150.zip

Note: Sometimes the jagged sections can be pretty subtle to see. So using 'Low Res' option with 'Draft Rendering' mode should be able to help to see those parts much clearer.

Expected behavior
The lines shouldn't be jagged at all and look relatively fine as it is, even if the rendering mode is set to 'Draft'.

Screenshots
Note: You may have to open the screenshots in a new tab to see them better.
Here's what the lines look like in 1.5.0
150-jagged-feather-4
150-jagged-draftlowres-3
You can see them much clearer if the rendering is set to Draft and Low Res
150-jagged-draftlowres-2

And this is what they look like in 1.4.2 (and 1.4.1 as well). No weird zig-zags and quite clean.
150-jagged-feather-5
Also looks fine too in Draft + Low Res
150-jagged-draftlowres

System information:

  • OS: Windows
  • OS version: Windows 10 64-bit
  • Commit ID: Unfortunately, I don't exactly know which one is the Commit ID. But I got this from the Synfig's News Blog, and this is the file name it came with: SynfigStudio-1.5.0-2021.08.13-win64-32dd4.exe

Additional comments
At first I thought this issue has something to do with Draft + Low Res rendering mode, but it turns out the 'Feather' caused it. I wonder if this bug also afftects blur type layers, since 'Feather' blurs objects as well.
This bug also present in its portable version.

Edit
I just realized that I've only done all the tests in Preview and Draft Rendering Mode. So I did one more test to see if this bug present in Final Render Mode. It doesn't, the lines looked clean in that render mode. The issue name and description is also changed accordingly.
And as it turns out, this issue was entirely renderer related. See my reply on #2274 (comment) and the one below it for further read.

Activity

  1. changed the title [-]Feathered Outlines (and Adv. Outlines) Look Jagged (1.5.0)[/-] [+]Feathered Outlines (and Adv. Outlines) Look Jagged (Except in Final Render Mode) (1.5.0)[/+] on Aug 17, 2021
  2. added
    Regression
    on Aug 18, 2021
  3. morevnaproject commented on Aug 22, 2021

    @morevnaproject
    Member

    The bug appears to be introduced somewhere between commits 27c7b95 (2020-05-14) and 8b3a3a0 (2020-01-29) in master branch.

  4. ice0 commented on Aug 22, 2021

    @ice0
    Collaborator

    @morevnaproject
    8b3a3a0...27c7b95

    There are too many commits in there :)

  5. morevnaproject commented on Aug 22, 2021

    @morevnaproject
    Member

    @ice0 That's just my accidental finding. I put it here to simplify research for someone who decide to continue with git bisect operation. ^__^

  6. added this to the v1.6.0 milestone on Aug 22, 2021
  7. rodolforg commented on Aug 22, 2021

    @rodolforg
    Contributor

    I did git bisect and the first bad commit is: 3ae388d f44ff0a
    Those are good commits while travelling with git bisect: 7cea642 4df4085 30ce7c4 fe24023 8b3a3a0

  8. FadhilKwan commented on Sep 15, 2022

    @FadhilKwan
    Author

    Sorry, quick update on this bug. ._.v

    I just found out after checking if this bug still persists on the newest dev version v1.5.1 that just got posted yesterday in Synfig Forum.
    (spoiler alert: it still persists)

    So as it turns out, the bug is not strictly related to line's feather size and width alone. But it's more of a workarea rendering issue that occurs when synfig tries to render thinner objects (as in less wide) on a lower resolution. Which is why thin lines and aformentioned feathering contribute to this issue.
    (especially with those two combined; which is my usual setup, the lines are more prone to fracturing).

    This means, even if you have a thick solid line. If you lower your workarea's rendering resolution just enough (by changing the render method, lowering resolution, zooming out, or any combination of those), you could still get the same jagged lines on some segments as the result. (unless your lines are so thick that any of those tricks won't break them).

    Edit2: I forgot to mention. Another factor that convinced me that this is workarea renderer related, is because these fractures are different every time. These fractures can change based on your zoom level, and whether the workarea got refreshed after you do certain tasks (such as adding guides, etc.). Usually the combination of those two are enough to change the line-breakage spots.
    Also, I did try to render a file that has those broken lines, on a very low resolution (with quality was set to 6 or 7). And the result was straight-up clean, blurry lines, which convinced me even more that this is strictly revolves within the workarea.

    (I also added the word 'workarea' before 'renderer' in this comment, as this bug is only related to that, and NOT the final render; i.e. the one that outputs to a file. This one was a very trivial edit, but I really had to. ._.v)

    (side note: Now I do know that on lower resolution, objects should look more pixelated, grainy, and fracture-ish. But as you can see on my first post, some parts of it look unusual. They sort of breaking and smearing horizontally.....)

    Edit:
    Question: Sooo....... should I change the title, then?.....
    Finally changed the title to clarify the key issue a little bit.

  9. FadhilKwan commented on Mar 9, 2023

    @FadhilKwan
    Author

    So since this ticket went a bit dormant. I decided to look for some more clues on why this issue occured.

    After I realized that the issue is more of a renderer related one, I did another test trying to figure out how the fractures formed. And what I found is somewhat interesting.

    I did this by creating some lines, animate it scrolling through the canvas vertically, then search and note where the fractures occur.

    So here's a clip of the line scrolling, with lots of fractures.

    2023-03-09.15-07-45-1.mp4

    And when I used guides to note these fractures. I found out that they're kinda evenly spaced, which is oddly satisfying. Probably off by few pixels, but it's hard to notice.

    2023-03-09.15-08-16-1.mp4

    Now I don't know how much of these findings would help to identify the cause of the problem. But I'm hoping at the very least this could help to find the problematic commit. (or maybe I should start looking for it?.....)

    Also along the range of those commits, version 1.3.12 and 1.3.13 were mentioned. So I try loaded my file into them. And this issue doesn't exist in those (with the exception of slightly messed up line widths on 2 line layers, but that's just file's version difference thing, not related to this.). It's just this 1.5.0 (and 1.5.1) that has this problem.

  10. changed the title [-]Feathered Outlines (and Adv. Outlines) Look Jagged (Except in Final Render Mode) (1.5.0)[/-] [+]Feathered Outlines (and Adv. Outlines) Look Broken on the Workarea at Lower Resolutions (1.5.0)[/+] on Mar 10, 2023
  11. FadhilKwan commented on Mar 12, 2023

    @FadhilKwan
    Author

    I decided to scour the commits to look for somewhat suspicious changes and only armed with some armchair knowledge of codes. So please keep in mind that this is hugely just a speculation and I might as well could be 100% wrong.

    After looking around for a long while, my search filters down to a set of codes called "renderer_canvas.cpp" (https://github.com/synfig/synfig/blob/b8d624670f09dbac850f87fbb3bbf85a98475094/synfig-studio/src/gui/workarearenderer/renderer_canvas.cpp).
    And in there, after comparing several commits, including the bisects within said time range, and also the file from master branch, I found one line from these that I felt suspicious about.

    Renderer_Canvas::TileList::iterator
    Renderer_Canvas::erase_tile(TileList &list, TileList::iterator i, rendering::Task::List &events)
    {
    // this method may be called from other threads
    // mutex must be already locked
    if ((*i)->event) events.push_back((*i)->event);
    tiles_size -= image_rect_size((*i)->rect);
    (*i)->event.reset();
    (*i)->surface.reset();
    (*i)->cairo_surface = Cairo::RefPtr<Cairo::ImageSurface>();
    return list.erase(i);
    }

    And, to be specific, it's this line:
    (*i)->cairo_surface = Cairo::RefPtr<Cairo::ImageSurface>();

    It's hard for me to explain why I think this could be the reason. My only logic is that this controls how image tiles were erased and loaded into the workarea. Yeah, not a strong point since the function literally said "...erase_tile...". And these fractures only affect vector lines, so any raster-based lines (png, jpeg, etc.) are safe from this issue, which throws me off quite a bit.

    But the other reason I felt suspicious about this line, is because in other version (i.e. stable and pre 1.5.0), this line was different.
    It is instead written as, (*i)->cairo_surface.clear();

    Renderer_Canvas::TileList::iterator
    Renderer_Canvas::erase_tile(TileList &list, TileList::iterator i, rendering::Task::List &events)
    {
    // this method may be called from other threads
    // mutex must be already locked
    if ((*i)->event) events.push_back((*i)->event);
    tiles_size -= image_rect_size((*i)->rect);
    (*i)->event.reset();
    (*i)->surface.reset();
    (*i)->cairo_surface.clear();
    return list.erase(i);
    }

    And the bisect actually matches Konstatin's statement, where he said he discovered this issue by accident somewhere between the two aformentioned commits.
    (Unfortunately I don't know how to share bisects. So here's a snapshot of it instead.)
    workareabroke

    But again, this is hugely a speculation since I know nearly nothing about what's going on in there. So, I would like to ask some questions:

    1. What does the Renderer_Canvas::erase_tile function actually do?
    2. Where does Synfig do its job of rendering things to workarea? Like, which file(s) that deals with all that stuff?
    3. As I mentioned before, images are safe from this issue, totally unaffected whatsoever. Does Synfig handle raster image rendering on a different file/set of codes/functions? Or is it still handled in that same function?
    4. And again (and again), I might be absolutely wrong regarding what I have speculated above. So if you guys have any idea where else I should look at, please let me know~

    I might continue my search again later on. That is, if I have the time (and some patience) for it. ._.v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CriticalRegressionRendering

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions