Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] Tessellation for Bezier curves doesn't look too great when scaled. #99769

Closed
dnfield opened this issue Mar 8, 2022 · 4 comments
Closed
Labels
c: rendering UI glitches reported at the engine/skia rendering level e: impeller Impeller rendering backend issues and features requests engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list

Comments

@dnfield
Copy link
Contributor

dnfield commented Mar 8, 2022

TEST_F(EntityTest, BezierCircleScaled) {
  Entity entity;
  auto path = PathBuilder{}
                  .MoveTo({97.325, 34.818})
                  .CubicCurveTo({98.50862885295136, 34.81812293973836},
                                {99.46822048142015, 33.85863261475589},
                                {99.46822048142015, 32.67499810206613})
                  .CubicCurveTo({99.46822048142015, 31.491363589376355},
                                {98.50862885295136, 30.53187326439389},
                                {97.32499434685802, 30.531998226542708})
                  .CubicCurveTo({96.14153655073771, 30.532123170035373},
                                {95.18222070648729, 31.491540299350355},
                                {95.18222070648729, 32.67499810206613})
                  .CubicCurveTo({95.18222070648729, 33.85845590478189},
                                {96.14153655073771, 34.81787303409686},
                                {97.32499434685802, 34.81799797758954})
                  .Close()
                  .TakePath();
  entity.SetPath(path);
  entity.SetTransformation(Matrix::MakeScale({20.0, 20.0, 1.0}).Translate({-80, -15, 0}));
  entity.SetContents(SolidColorContents::Make(Color::Red()));
  ASSERT_TRUE(OpenPlaygroundHere(entity));
}

At the current values for SmoothingApproximation:

image

If I change SmoothingApproximation.scale to 0.01 it looks much better, but also is more expensive to calculate.

We should probably have this be adaptive so that when people scale into paths they still look good.

@chinmaygarde @bdero fyi

@dnfield dnfield added engine flutter/engine repository. See also e: labels. c: rendering UI glitches reported at the engine/skia rendering level passed first triage P2 Important issues not at the top of the work list e: impeller Impeller rendering backend issues and features requests labels Mar 8, 2022
@chinmaygarde chinmaygarde changed the title Tessellation for Bezier curves doesn't look too great when scaled [impeller] Tessellation for Bezier curves doesn't look too great when scaled Mar 8, 2022
@chinmaygarde
Copy link
Member

Right, the approximation is just an arbitrary number right now. Will have to be adaptive or precomputed for known paths.

@chinmaygarde chinmaygarde changed the title [impeller] Tessellation for Bezier curves doesn't look too great when scaled [Impeller] Tessellation for Bezier curves doesn't look too great when scaled. Dec 9, 2022
@chinmaygarde
Copy link
Member

Update: We have some support for adaptive subdivision now but it is not uniformly applied. The next step is to do a pass for all geometry types.

@luckysmg
Copy link
Contributor

luckysmg commented Jan 6, 2023

Closing this since flutter/engine#38497 Fix this ^_^

@luckysmg luckysmg closed this as completed Jan 6, 2023
@github-actions
Copy link

github-actions bot commented Mar 4, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: rendering UI glitches reported at the engine/skia rendering level e: impeller Impeller rendering backend issues and features requests engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list
Projects
No open projects
Archived in project
Development

No branches or pull requests

3 participants