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

Polygon errors when using perPositionHeight #5203

Closed
ChriWe opened this issue Apr 12, 2017 · 10 comments
Closed

Polygon errors when using perPositionHeight #5203

ChriWe opened this issue Apr 12, 2017 · 10 comments

Comments

@ChriWe
Copy link

ChriWe commented Apr 12, 2017

My goal is the visualization of an elevated extruded polygon with data provided to a GeoJsonDataSource.

  • The polygon is given by a GeoJson dataset, consisting of points where each is given by longitude, latitude and elevation (e.g. [ 30.0, 70.0, 152452.62 ])
  • The polygon should be extruded by 30502.

A schematic profile view of such a volume could look like this:

  • Green: Bottom of the polygon (given by the dataset) -> should follow the ellipsoid in 3D
  • Red: Extrusion
  • Orange: Top of the polygon (given by dataset & extrusion) -> should follow the ellipsoid in 3D
    profile_view

Now to the pratical part: I am using the following GeoJson data: polygon.zip

When using the data provided above, the visualization with GeoJsonDataSource shows some strange rendering effects. It looks like the geometry folds and cuts the globe (bottom and top of the polygon not properly following the ellipsoid):
polygon_rendering

I have also tried to visualize the polygon by using PolygonGeometry but unfortunately there are also some rendering issues:

  • There is an edge in the visualization (the geometry seems to fold or cut the earth)
    polygongeometry
  • When having certain view-angles the folding/cut is even more visible
    polygongeometry_rendering

So basically the issue is, that the top and bottom surface of the volume do not follow the ellipsoid properly.

  • Is there any way to avoid those rendering artifacts?
  • Is this issue known? Especially when using very large polygons?
    Actually I'm not quite sure if this is a bug, I'm missing some configurations or I´m using a wrong approach. I also could not find any sample yet which is dealing with such kind of visualizations.

I would really appreciate any help. :)

@hpinkos
Copy link
Contributor

hpinkos commented Apr 12, 2017

Thanks for including all of the details and screenshots @ChriWe!
The short answer is that Cesium currently doesn't have support for drawing this kind of polygon.

There are a few known issues with using the perPositionHeight property of PolygonGeometry that are resulting in your polygon being visualized this way. The first is that the polygon is not being subdivided to fit the curvature of the earth. That's why it looks like it's being cut off by the globe: for really large polygons it's actually slicing through the globe.

The second issue is that due to our current triangulation algorithm, perPositionHeight works best for polygons with coplanar points. Otherwise, sometimes the shape gets divided in a way that differs from what you expect. For example, imagine a shape that's like the roof of a house. Here's a drawing that represents two different ways that the points could be split into triangles. The first way is what we'd expect to happen, but sometimes the second one happens and as a result the shape draws differently than we want it to.

image

@hpinkos hpinkos changed the title Large polygon from GeoJsonDataSource Polygon errors when using perPositionHeight Apr 12, 2017
@hpinkos
Copy link
Contributor

hpinkos commented Apr 12, 2017

Related #2399

@ChriWe
Copy link
Author

ChriWe commented Apr 12, 2017

Thanks very much for the fast reply. Also for the drawings ;).

Is the implementation of such a feature planned in the near future?

For the GeoJsonDataSource example perPositionHeight was set to false.
For the PolygonGeometry example perPositionHeight was set to true.
So I am not sure if the inproper visualization of example 1 is due to the perPositionHeight property. But yeah, looks like a triangulation issue.

Could you imagine any workaround for this? A potential one I can see is the consolidation of the given dataset (e.g. Delauney Triangulation) with a grid-spacing depending on earth´s curvature. This could be used as a base for visualization. Maybe via comosition of multiple polygons. Seems like a bigger pile of work. But pls correct me if I´m wrong.

BTW: What really confused me at first was the different visualization of polygons in connection with the GeoJsonDataSource:

  • If elevation data is provided in the GeoJson, then it´s flat (and also slices the earth if big enough).
  • If there is just longitude & latitude, it properly follows the curvature of the earth.
    Also could not find this behavior described in the docs (neither GeoJsonDataSource nor PolygonGraphics).

@hpinkos
Copy link
Contributor

hpinkos commented Apr 13, 2017

I'm not sure when we'll have a chance to look into fixing this. We're focused on finishing up the 3d tiles specification right now, so this would only be a priority if it ties into our vector tiles implementation.

perPositionHeight is for sure the culprit. If you look in the code for GeoJsonDataSource, it tells the polygons to use perPositionHeight when the GeoJSON coordinates have a height.
That's why it only curves with the earth when there is no elevation data. We subdivide the polygon correctly when perPositionHeight is not used.

We would be happy to review a pull request if you wanted to take a stab at fixing this! You would have to pass the perPositionHeight variable through here PolygonGeometryLibrary.createGeometryFromPositions
Then use a different triangulation algorithm if perPositionHeight === true PolygonPipeline.triangulate

For the curvature of the earth problem, you would need to make PolygonPipeline.computeSubdivision work with a polygon with perPositonHeight. We currently skip the subdivision if perPositionHeight is being used.

See our documentation for information on building the code base and opening a pull request

@ChriWe
Copy link
Author

ChriWe commented Apr 19, 2017

Ok, thanks for the info.

Actually this feature would be a nice-to-have in the current application im building, but wasn't yet put on the roadmap. So I may have a look at this at some future point.

Thank you very much for the detailed information and description.

@ChriWe ChriWe closed this as completed Apr 19, 2017
@ggetz
Copy link
Contributor

ggetz commented Aug 24, 2017

I think this problem experienced on the forum is related: https://groups.google.com/forum/#!searchin/cesium-dev/paula%7Csort:relevance/cesium-dev/FiF8tbgoPjw/ZXHBhlhABAAJ

With perPositionHeight = false

image

With perPositionHeight = true

image

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 25, 2017

@ggetz this issue is closed, do you want to re-open it or create a new one?

@ggetz
Copy link
Contributor

ggetz commented Aug 25, 2017

This seems like the same problem, so reopen please.

@pjcozzi pjcozzi reopened this Aug 25, 2017
@hpinkos
Copy link
Contributor

hpinkos commented Aug 30, 2018

The above looks like a data problem. I think his position heights are lower than the extrudedHeight. I'll add a comment to #2924

@hpinkos hpinkos closed this as completed Aug 30, 2018
@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!searchin/cesium-dev/paula%7Csort

If this issue affects any of these threads, please post a comment like the following:

The issue at #5203 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

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

No branches or pull requests

5 participants