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

Extrusions: Do not try to triangulate non-polygon type features #7685

Merged
merged 3 commits into from
Mar 21, 2019
Merged

Extrusions: Do not try to triangulate non-polygon type features #7685

merged 3 commits into from
Mar 21, 2019

Conversation

greysail
Copy link
Contributor

@greysail greysail commented Dec 10, 2018

Trying to triangulate the base area of a feature without base area (e.g.
GeoJSON LineStrings) just creates invalid excess triangles,
yielding visual artifacts

There is an equivalent pull request for mapbox-gl-native, which I will post shortly

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality (not actually new functionality; more about making mapbox behave as expected)
  • document any changes to public APIs (none)
  • post benchmark scores (i guess this should not affect performace measurably)
  • manually test the debug page
  • tagged @mapbox/studio and/or @mapbox/maps-design if this PR includes style spec changes (none)

@greysail
Copy link
Contributor Author

[v2] added fix to lint styleguide errors

@ansis
Copy link
Contributor

ansis commented Dec 10, 2018

@greysail thanks for the contribution! Are you interested in trying to add a render test for this fix?

If you are, the way to do this is:

  • create a new directory in test/integration/render-tests/ called fill-extrusion-geometry with a subdirectory called linestring
  • add a style.json to the directory (look at other fill-extrusion render tests for examples)
  • run it with UPDATE=1 yarn run test-render fill-extrusion-geometry and tweak it until you get the results you expect

@greysail
Copy link
Contributor Author

[v3] added render test

Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put the check somewhere up the method chain? It might be confusing to have it this way down, inside a loop where non-polygon features will simply have all iterations skipped with continue.

@mourner
Copy link
Member

mourner commented Dec 12, 2018

Also, can we make the render test as small as possible (while still testing what we need)? Each new test impacts the running time of the test suite and the bigger the image, the longer it runs.

@greysail
Copy link
Contributor Author

I have reduced the render image size to 32x32. Below that, the overhead for setting up the render pipeline is probably bigger than the time for rendering itself.

@greysail
Copy link
Contributor Author

greysail commented Dec 12, 2018

The rationale for putting the code into addFeature() in fill_extrusion_bucket.js is that it actually does not skip loops:

Extrusions consist of two parts:

  • the base area
  • the vertical parts.

For polygon-type features, we want to generate geometry for both parts while for line-type features we only want to generate geometry for the vertical parts since they do not have a base area.

If one were to move the logic for distinguishing between line-type and polygon-type features somewhere higher up, this would from my understanding mean having to split up addFeature() into two seperate routines (one for the base area and one for the vertical parts of the extrusion).

Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I misread the code. Looks good to me — pending on @ansis signing this off.

@mourner mourner requested a review from ansis December 13, 2018 15:53
@greysail
Copy link
Contributor Author

[v4] rebase on master & squash commits for test case into a single patch

@greysail
Copy link
Contributor Author

Note: the render test actually fails on native, so please do not merge until this is fixed

@greysail
Copy link
Contributor Author

[v5]: fix test for native implementation

Trying to triangulate the area of a feature without area (e.g.
GeoJSON LineStrings) just creates invalid excess triangles,
yielding visual artifacts

fix lint styleguide error in previous commit
This test draws
- a Polygon -> base are shall be rendered
 and
- a MultiLineString -> base area shall not be rendered
…implementation

For some reason, native cannot render on framebuffers with height less than 67 Pixel,
hence we increase the framebuffer height to 128
@greysail
Copy link
Contributor Author

[v6] rebase on master

@mourner mourner merged commit 337dc12 into mapbox:master Mar 21, 2019
@mourner
Copy link
Member

mourner commented Mar 21, 2019

Thank you!

mourner added a commit that referenced this pull request Apr 25, 2019
* release-liquid: (84 commits)
  v0.54.0 (take two) (#8184)
  Fix disappearing controls in Safari 12+ (#8193) (#8194)
  [docs] token refactor in docs-page-shell (#8174) (#8181)
  v0.54.0-beta.2 (#8166)
  Bugfix - removeFeatureState fails with target.id === 0 (#8150) (#8164)
  update one more frame after canvas source paused (#8130) (#8163)
  move docs dependencies to dev (#8121) (#8129)
  v0.54.0 (#8115)
  CP removeFeatureState fix (#8090)
  v0.54.0-beta.1 (#8084)
  Allow setStyle diff by default with localIdeographFontFamily on (#8081)
  Upgrade various (mostly dev) deps, downgrade GL (#8078)
  Fix default marker positioning (#8074)
  Use @mapbox/gazetteer for benchmark coordinates (#8063)
  bump react-dom to v16.3.3 to fix minor vulnerability warning
  Fix and refactor the benchmark suite (#8066)
  Add max width for popups (#7906)
  Extrusions: Do not try to triangulate non-polygon type features (#7685)
  docs fixes after the merge
  limit flow max_workers and upgrade to v0.95.1 (#8061)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants