# Polygon height - multiple issues

**URL:** <https://community.cesium.com/t/polygon-height-multiple-issues/7987>\
**Category:** CesiumJS\
**Created:** [February 11, 2019, 6:55pm UTC](https://community.cesium.com/t/polygon-height-multiple-issues/7987 "2019-02-11T18:55:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![akbaraka](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@akbaraka](https://community.cesium.com/u/akbaraka)\
**Post date:** [February 11, 2019, 6:55pm UTC](https://community.cesium.com/t/polygon-height-multiple-issues/7987/1 "2019-02-11T18:55:23Z")

</div>

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

we display multiple layers of translucent polygons and a layer of images. All layers should be on ground (no terrain is currently used).

The order of layers is important - some layers should be above the image layer while other layers should be below the image. Since non-image layer are all translucent relative ordering is not important.  
Polygons and images are added/removed dynamically (on user actions)

Some polygons should have outlines

Layers are GeoJsonDataSource

1. A concise explanation of the problem you're experiencing.  
We the following issue also see attached image:  
1. setting entity height to undefined disables outlines (and prints warning [Entity geometry outlines are unsupported on terrain]). Artifacts on entity edges. The artifact changes when panned left to right

2. setting height of all items to 0 enables outlines, but creates artifacts on overlapping translucent entities and we cannot control order of images - they get buried under other layers.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.  
Sandcastle code

> **[Cesium Sandcastle](https://sandcastle.cesium.com/?)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

image:  
[https://photos.google.com/share/AF1QipNFFmHZcdz9iW5z93J6S8ZRdWCZhVIPxd2riGC93gdL0hF68ryGC8JAk-QfkFg2IA/photo/AF1QipNuNNRiXLvE3JTsdZTCy8HXIAk\_QOvZnLf6Zm1Z?key=MFFPN3U5b3hLbElIdHBSUDFiTkdmdGRnUHRrSlR3](https://photos.google.com/share/AF1QipNFFmHZcdz9iW5z93J6S8ZRdWCZhVIPxd2riGC93gdL0hF68ryGC8JAk-QfkFg2IA/photo/AF1QipNuNNRiXLvE3JTsdZTCy8HXIAk_QOvZnLf6Zm1Z?key=MFFPN3U5b3hLbElIdHBSUDFiTkdmdGRnUHRrSlR3)

4. The Cesium version you're using, your operating system and browser.  
1.54, but also in older versions. Chromium and Edge, Windows 10, Nvidia Quadro K2000

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [February 12, 2019, 3:57pm UTC](https://community.cesium.com/t/polygon-height-multiple-issues/7987/2 "2019-02-12T15:57:05Z")

</div>

If your layers can all be images, you could use the SingleTileImageryProvider and treat them as imagery layers which will give you full control over the drawing order without artifacts:

> **[Cesium Sandcastle](https://sandcastle.cesium.com/?src=Imagery%20Layers%20Manipulation.html)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

Otherwise, for overlapping entities with height 0 what you’re seeing is z-fighting which is a common 3D engine artifact when two objects are in the exact same depth position. Moving one to a height of 0.1 seems to be enough to fix this.

As for the last artifact for the ones with height undefined (which means they’re clamped to the terrain), the good news is this was actually just recently fixed with this PR:

> <https://github.com/CesiumGS/cesium/pull/7518>

It didn’t make it into the CesiumJS 1.54 release but it will be there in 1.55 next month. In the mean time, you can use the master branch of Cesium on GitHub to get the fix.

---

<div class="post-metadata">

**Author:** ![akbaraka](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@akbaraka](https://community.cesium.com/u/akbaraka)\
**Post date:** [March 4, 2019, 4:41pm UTC](https://community.cesium.com/t/polygon-height-multiple-issues/7987/3 "2019-03-04T16:41:51Z")

</div>

Hello,

Seems the z-fighting issue is stille there in 1.55 ☹

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [March 6, 2019, 10:34pm UTC](https://community.cesium.com/t/polygon-height-multiple-issues/7987/4 "2019-03-06T22:34:39Z")

</div>

The fix in 1.55 was for the artifact on the entities with undefined height (when you tilt the camera and see black on the edge).

You should be able to fix the z-fighting by moving one of them slightly. [Here’s a modified Sandcastle](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=xVbbbts4EP0Vwi+RAZbW1VYTJ1hssthN0W2DptiXKChUibLZlUlDpB24hv99h6IkS45c9xJg9ZBYnDkzZ6jD4WQrnigmOMpFnN4qurC+SMGxWCo8p2w2VxjxeEGH24gjeHKqEEOX6M39+3dkGReSlv7DC2O+ppKtFuRPKt7A6k2s4nuxKhJKdHSLYQRxh8ZVP0TNKbeyioKVyjpN/eh0VEK+VBLKFVOMSrKO8xWVFz2el1Q+2I8HFkqWIt/MBCemoEvz75mXLvNS/2lZ0n0FTfo4TS1aF4x2+tcu4hFfxwVaM/pEC+DL6VO9Gf+Ua9ZZUr5eC65ixmlxpoERTwSXqpWni322kVY0UFSqaKDRJhvZgw25/Xs7BVvEM3pzfzp+6fjNBFUoEz3ioxd7zCYmDpDcZizPzyua1yIXBckKsfh9A+VbNnZ9D9vYccPh7qJCuadRgPP8Lsr7vlxucIDzT+EMQ41zbb/EGWSmqzvbwnfcLGGbz6PBnZFnNMDRIBGiSBmPIQLYHh4eXoVjEnie/9rD3pjYYeDa4SOul4OJWZ4449CvlwPb9ZxqeeKH+2UHyFRBJs4+SDf24+PurCoyc3+cKhDx6nCO79ZZnPFrZ1xTdU5VcKTew9htqt6vUJ04vVTH/VTH/VQnTi9VE7tN1f8VAXSyHOG0F8C4XwATp18BJnjF9SWPdcSb6yVzcOLAyUDRQHBKkOnGyDYdZ+/m4sTFNnG0o3oSxx09nHh4xVOaQVtNS/d5QfeRG9Mh0MeJ3wVm0OSO4V66y7HFLPsJIYTNybDbQggbIQQtIfhhI4SgJQQ/bDqB3dbBQeyWZsXyZLsLAlw22CBomiSU2B0VdM16L0+MCYsZzB/VmPDtEeE754Mjw8GzycDuty7gIxQszrt3562+Bf+uTHeFWNJCbaxteTmeg5gIGZW/5cgAPr0VM/HJ7NuX5Qw+MlJFzCVsDVA/h5cV3Q27DMqZpLmS27bqDu4ZS3bmXn5pvUqR/4Re4e7r06tr9+rVc3v16rm9ej2M3dIrkO0qT7MfNmI+Mip8+ONmd1KdEEmPse7/rc8+nQA3lqKCJuoHxfLCcjFjY5ZvPorWNIq3SGSZpKD11jH6i8Ygm9kdU8n8Q8xnFCYu9ArO1Zzc3aIRcjGyh6jhOcCDqVSbnF6Z+n5ji6UooFsXuQUnDhr7MtcaHH1eJf9SRRIpNXQ6qkHTlK0RS2G3DgbyaICSPJYSLNkqz+/ZVxD51XQE/h2YVgEQfr+mRR5vtMvcuXprFgkh0xG8PkcpIfLPcdGK+B8).

---

<div class="post-metadata">

**Author:** ![akbaraka](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@akbaraka](https://community.cesium.com/u/akbaraka)\
**Post date:** [June 24, 2019, 3:19pm UTC](https://community.cesium.com/t/polygon-height-multiple-issues/7987/5 "2019-06-24T15:19:33Z")

</div>

We still encounter the artifact on entity edges, but it is slightly different now:  
It happens only on large number of polygons (over ~100) (we we load them as shown in code sample previously) We create multiple adjacent polygons. The same polygons when we create fewer of them do not have issues.  
It does not happen in 2D view  
And here is the most interesting part: if we use GEODESIC arc type there are no issues  
entity.polygon.arcType = Cesium.ArcType.GEODESIC;

That's in v1.58
