Skip to content

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

Merged
mourner merged 3 commits into
mapbox:masterfrom
greysail:line_extrusions
Mar 21, 2019
Merged

mourner merged 3 commits into
mapbox:masterfrom
greysail:line_extrusions

Conversation

@greysail

@greysail greysail commented Dec 10, 2018 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

[v2] added fix to lint styleguide errors

@ansis

ansis commented Dec 10, 2018

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor Author

[v3] added render test

@mourner mourner left a comment

Copy link
Copy Markdown
Member

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

mourner commented Dec 12, 2018

Copy link
Copy Markdown
Member

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
Copy Markdown
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

greysail commented Dec 12, 2018 •

Copy link
Copy Markdown
Contributor Author

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).

@mourner mourner left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

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

@greysail

Copy link
Copy Markdown
Contributor Author

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

@greysail

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

[v6] rebase on master

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

mourner commented Mar 21, 2019

Copy link
Copy Markdown
Member

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)
  ...
melitele pushed a commit to pirxpilot/mapbox-gl-js that referenced this pull request Mar 6, 2025
…ox#7685)

* Extrusions: Do not try to triangulate non-polygon type features
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

* Add test for rendering line-type extrusions
This test draws
- a Polygon -> base are shall be rendered
 and
- a MultiLineString -> base area shall not be rendered

* Add test for rendering line-type extrusions: make test run on native implementation
For some reason, native cannot render on framebuffers with height less than 67 Pixel,
hence we increase the framebuffer height to 128
melitele pushed a commit to pirxpilot/mapbox-gl-js that referenced this pull request Mar 6, 2025
…ox#7685)

* Extrusions: Do not try to triangulate non-polygon type features
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

* Add test for rendering line-type extrusions
This test draws
- a Polygon -> base are shall be rendered
 and
- a MultiLineString -> base area shall not be rendered

* Add test for rendering line-type extrusions: make test run on native implementation
For some reason, native cannot render on framebuffers with height less than 67 Pixel,
hence we increase the framebuffer height to 128
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