Repository: CesiumGS/cesium

Issue #12246: Creating a polygon also adds an artifact that moves around when you pan or zoom.
Created: 2024-10-10T12:43:21Z
What happened?
I tried to create a thick line path with an arc, but when I add the last point, it also creates an artifact next to it.  When you pan or zoom, the artifact moves around, but the thick line path stays fixed like it should.  Also, this only happens when I add the last point to complete the path.  If I don't add the last point, there is no artifact.

Reproduction steps

Create a polygon with the specific points in the Sandcastle example to see the artifact
Comment out the last point to remove the artifact

Sandcastle example
https://sandcastle.cesium.com/#c=jZhLb9zYEYX/CqGVjFFa9/3waIwJnGWALBJkkdEs6BZlEdMihW7KhjLwf89XlCwXr72IBbfUJM+99Th1qi7383Rauk/j8Hk4dr900/C5ez+cxsf73b/Xa+fXZ/v1+/t5WvpxGo7XZ29+vp6up8OwdPt5Pt6cwP12Pf156Je3Me5ytK5ma1IyJl50h3l6+5ewSymX7IPzpjrj0pcLBeBZn52vIUVjv0FysLVUG0JN/OkaiIm+plityUkhvPHe+RxcyHkDMKxuokk5Fq+eDyZWw01XTShbQCkxm+BdsFYBWCJ5702IudYG4ILPsSZfrd6CbUO2mc+atn5jujOFLRwmK0Q2BMM5Ni8uxy0k1VJCITLea7NyzT5FV2uxtgH4kEqOyRXnFKBU42V39imN4zHV5KwPNmOwgrC2j8HlnHL1DYTFBGVyMQoSCa23wRbyWxq7gk8luuh9Un5EG7OzISdrfWkS6FO1ZClnl4NCuACfaizYEFyDMOwfLA45Fd5ISrN3q02hNOF1Yi4Z8Rs3YAmhDTC4xjYhNhEq58TxHDWmeDav/HBnCzEVY6uPKaeot4mxVhdD8i6ZxhVjS/WwKOGqQkBFLpdcnA9BIxLmphRy5FasCkGusoUsxiRTtwjqMyVH6qsvGiExro581GRjAzH8C/JIStquElykQG2EY2ULyQ5+UbdVKklBKMNABEUmot1CkAXue+G80wiCb5M3map0WwRZcgTLw3KFSDCC3BLnCPu2iFArKcFNr51PqIDHS2KZQmicJ+toAwmoSUU4QZ9ao/M445uc+BBxIiBmNmgEQTGkJBGDvEU4p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ghkDa7ocxvxdnQZ3OP80CKgAmcOOcfqIpHZXTqVlSG2Ga0jA6G05aJTyDkZFeBYzHrfTfyIqcxxm7OLX/sqrrFgacd3iS9TE/trvnt5kOQRKajXnEMYkukZnNW90X7ANCQe9uZGgoFwqslC7KKndy+MpycKF3JzmkRJpNopdT1hyknRi24hzqE9hMmLAC+6oZs7AUeDOVM6aajNQY+xVo47Re/g5AxHLpDy3BzuSZtsa6QOFIIadC4Jp2r7/sCzh8wcBEQHF21hOBEF8LEJLhfQGYhNC/qGkO4JR/CEYvxyPXXd9XR52f315macPnbL3XjqDv1p6R7m07iM89TdHuf7rv8wfxq6w8iNZe728/3DYVgGHh+6h3656z6PfPTHfbfvH0/Dab3RH5fxtt8v6/rv5/v7YVpeNhinoZsf17WmeemArIiXjccJzMWrI7S8IK9s7GYMktG9FqFBdfQFPPn99T3SV9vXV0ly+XY+nsuNkQvmZ35dvbxr2h2G6eNyx6Wffnrzp0TjFbt7eDzdnb+8vXqPM/zVT34n8fjb8PE4DKfz50V+G3/fYdVFp772yxt5r/VFTHp+HbbDfVYeTrv+5ub8Za/D00fc6dZvXXc3DkeCePf0ekXZ8/bbn8/31uTx8eX5BRpB/s8830sWx6nrp5s1wvL7oZ8mufyD3EgG7iW1QI4DVkvGufb8zP7V9n1/j2m728PTv+Zn22+G0zJOK+Bt939FyWyjZNYoXXRBxvg3L24IG79+nl2cXZ2Wp8Pw7mssfh3vH+YjfDkezne7y2WAhj07Xn543P8xLLv96fS8SNddXWro1c34qRtvfvnB28duD+tO3Ll9PBz+Of53uD57d3XJ899BD3MvNfKPT8Px0D/JY3f23d+fL+52u6tLvv4Yuczz4UN/bFb+Hw
Environment
Browser: Chrome
CesiumJS Version: 1.122
Operating System: Windows 11

Duplicate issue #12294: PolygonGeometry with holes have broken surfaces
Created: 2024-11-08T03:44:01Z
What happened?
Now I have encountered a problem when changing from version 1.119 to versions after 1.120.
I created a PolygonGeometry that provides polygon boundary coordinate data and polygon hole coordinate data to create a polygon with holes. Generally, there is no problem with the coordinate data of holes, but many boundary coordinates in urban areas may have holes and broken surfaces.
The city boundary coordinate data is arranged in order and is valid latitude and longitude data in terms of format. It can be successfully rendered as PolylineGeometry or PolygonGeometry, but using the city coordinate data as polygon hole coordinate data may result in broken surfaces.
PolygonGeometry with holes created in version 1.119：

PolygonGeometry with holes created in version 1.120 has a broken surface in the lower left corner, and most of the city boundary coordinates have a broken surface in the lower left corner：

Reproduction steps
No response
Sandcastle example
No response
Environment
Browser:
CesiumJS Version:
Operating System:

Closing comment (2025-01-16T09:53:46Z): I have a similar problem and I'm not sure if earcut 3.0 is the cause. I'm using an older version of cesium (I'm on 1.108.0 with earcut 2.2.4).
I've been trying to figure this out for days. All the polygons are cut on the geographical south corner. Could this be related?
There are also weird interactions when polygons are drawn side by side, but I can't reproduce it every time. For example, if I draw 4 square polygons to create a larger square, some corners will fill in with the color of their neighbor, depending on the viewing angle.
Example of 2 polygons affected by the problem:

Example of the viewing angle problem (visible on the green polygon, filling the missing part of the red one) :
https://www.youtube.com/watch?v=WQyBPmldGGo
EDIT : Here's a sandcastle replicating the problem : https://sandcastle.cesium.com/#c=rVNda9swFP0rIk8OGMXWhy15SdgIhQ4GK6xsD8sYqqPEYopkJCXBG/3vkxOnCW0ZFOYH+Ur33uOjc49ra3wAeyUP0oEZMPIAFtKr3RZ+PZ4ly1F93C+sCUIZ6Zaj8bulqY99tZMiyDuru401Nyao0EWQxIitTEGjpBOubroxmM3Bn6UB8Tl9Ccq+VkkPxWqVDCkA+r7quKbno/aEXYGnInABri5heklvIyWnhK7ON1lYbR38dvvx/gYeVGg+6LYRSQYRHV+12V3Q8X4VWAvt5VWile7O+kjXmlupNk14XvI4RI+9MPEVVy1DpK5M8FGP71eqLoQLMRIGJwQzzgmGGeUsywuKUkApyRGHBHNKeIFKmgJCS8YxggVBjBU4w9ecB9n+AZ9DUpIMIUzyAT6DBWYI86Lg+RmewpyWJSsKRN4GTyHLCKWsKK/gI3lKWPZEPoM8LwjLccbfhl5CzlFkh/OLNhkjBaEYYTbAoxKykjPKGB3/6J350pPRxL2PfvpGtHI5SofR9OMa/FhHzzkB17q7t2c/rqQPyoh+7hX47yOMZhmlo6kPnZbzsyjv1ba1LoCd0wmEkyC3rY6X8ZOHXf1LBlh7f/IYANPJdet0pfZArWav/K2g1sL7mFnvtP6ifkcB5tNJrH/Rqq1YKbP5vJdOi64va/L5p9MhhHA6idvXO4O1+kG4Z8h/AQ
EDIT 2 : It only affects polygons when they are clamped to ground. If we set a height or an extrudedHeight, the polygon will always be complete.
EDIT 3 : From what I found, it could be related to #12246 , #12136 , #11883 and #11291 , I'm not yet sure if the problem is the same for this issue.