-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Large polygon rendering/fill issue #4871
Comments
CZML example with the same problem in #5223. |
Same problem with this Sandcastle example: #3995 |
Any updates or a different workaround for this? I'm still seeing this in the latest version on the sandcastle. Creating patches (current workaround) isn't ideal since the border property can't be used with it and requires drawing the shapes twice, one for border and another to fill, which tends to introduce visual artifacts due to overlapping shapes so doesn't look as great. |
@ketulm sorry, we don't have a fix for this yet. The best workaround we have is to break apart the large polygon into a few smaller ones. You don't have to worry about drawing the shape twice, one for the fill and one for the outline. The fill and outline get drawn separately behind the scenes anyway if you were to have both options enabled for the same entity. |
@hpinkos This is still an issue 4 and half years after the OP brought this to the attention of Cesium. Are there any plans to fix this issue at any point in the future? |
Here's another geojson sample - test.txt |
It seems like there are multiple issues at play here - some may be rendering bugs and others caused by the triangulation. I created this Sandcastle for testing. All the cases referenced below are reproduced in the Sandcastle. When
There are significant issues with rendering near the poles:
There are also cases where Cesium will outright crash, as demonstrated in the |
While the core issues plaguing the geometry and rendering of large polygons still persist, there are some solutions that can be adopted in the meantime:
|
In #10857 (comment), @GatorScott suggested an inspector view to help debug polygon triangulation. |
Also reported in #10950. |
Also reported in #11238 |
Also reported in #4871. |
Hi @GatorScott and all, We're beginning to take a look into this and related issue with rendering large polygons. It would be a big help if you're able to provide us with any sample data or code examples which replicate the issues you're facing. Thanks! |
@ggetz ion asset id 1988092 (a sensor swath). |
So with my sample data, it happens when any polygon is >= 180 deg in longitude. It doesn't matter where it is on the globe, only that it's a total of at least 180 deg. It seems that any large polygon spanning >= 90 deg latitude works fine. |
Some test data (I say some because all of it would be long). I used the Cesium "Hello World" to put this together quickly with a few comments. const viewer = new Cesium.Viewer("cesiumContainer"); const wyoming = viewer.entities.add({ // West at equator, OVER meridian
// 160, 45, // South from North Pole, TO South Pole
// fill : false, viewer.zoomTo(equator1c); |
Thanks all for the test data! It's a big help! @GatorScott Is there a specific reason the CZML enables
Admittedly this behavior is not documented anywhere. |
@ggetz I thought it was required to show the outline. Maybe I misread the docs and/or error messages. |
@GatorScott If all heights are |
@ggetz In all of my test cases (I only sent the two out of probably a dozen) the outline seems to always render correctly and all the polygons had a 0 height (ie. - they are on the surface of the planet). |
Also reported in #10975. |
Data with holes reported in #9967. |
ProblemThere are two fundamental issues identified in filling large polygons, particularly in provided data above:
ApproachIn polygons without the per-position height property, triangulation is computed in the polygon geometry pipeline after scaling polygon positions to the ellipsoid surface, parsing a polygon hierarchy, and projecting positions to a tangent plane. It's possible to decompose a top-level polygon hierarchy into multiple polygons hierarchies, each of of which can be projected to their own appropriate ellipsoid tangent plane before triangulation. The polygons are later batched together in After the outer polygon ring is scaled to the ellipsoid surface, the changes would be:
Considerations and implementationBoth step 1 and 2 are well-defined problems common in GIS and 3D. Important considerations for both steps are:
Unfortunately GIS utility libraries such as turf.js, leafletjs, and d3-geo do not meet all of these requirements. Our implementation would include rolling our own versions of polygon simplification and polygon splitting based on the most ideal algorithms used by the above libraries. In particular, both algorithms were implemented for non-geodesic edges but can be adapted for use in CesiumJS by allowing computation of intersection points along either rhumb or geodesic lines. (Winding numbers for area's larger than half of the globe are sometimes treated specially, but this should be a non-issue since we're clipping to smaller areas). All other concepts of the algorithms (convex angles, direction, etc) can be ported to a geodesic context without problems. |
Has this been fully resolved on Cesium's side (https://cesium.com/blog/2023/10/19/large-polygons-in-cesiumjs/), or should users clean their polygons before rendering? I'm still seeing issues for large simple polygons similar to the ones in the article using Cesium 1.117. Here is a sample image (there are many other similar distortions in my dataset): The vertices increase in size and change from blueish to redish to verify order follows polygon shape. Here are the czml entities:
Any help on this would be greatly appreciated! |
Hi @falconeaj1, would you be able to provide a Sandcastle example which would help us replicate the issue? That will help us track down what exactly is going wrong. |
Hi @ggetz , |
Hi @ggetz, |
Hi @falconeaj1, the issue seems to be with position 8, which crosses the IDL. I've gone ahead and opened a dedicated issue to track: #12044. |
Large polygons spanning >90degrees across the longitude do not get rendered/filled properly.
Here's an example.
http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=fd0acbcf4d5fa84a9d988920bdb870f2
Note the rendering artifact at the north pole and also note that only the region east of the meridian is filled. It almost seems like it's rendering the opposite region west of the meridian.
The text was updated successfully, but these errors were encountered: