# How to draw polygon and polyline on the ground when Translucency enabled?

**URL:** <https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651>\
**Category:** CesiumJS\
**Created:** [July 22, 2022, 2:48am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651 "2022-07-22T02:48:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrSimple](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mrsimple/32/9455_2.png) [@MrSimple](https://community.cesium.com/u/MrSimple)\
**Post date:** [July 22, 2022, 2:48am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/1 "2022-07-22T02:48:36Z")

</div>

I get this error when Translucency enabled : Draw polygon and polyline under ground but not showing above ground, is there any way to fix that? below is my example error code in [sandcastle](https://sandcastle.cesium.com/index.html#c=tVptU9u4Fv4rXu6HDTMgbMuybOh2b0vpllkoDNB2dpad1okV4qljZ2wHyL3Df7+PJDuW7UBL725fhsSSHh2d85w3mUmelZV1m4g7UVi/WJm4sw5FmSzn5KN6Nrremqjvh3lWRUkmiuutHeu/15lllSIVkyrJs+MsTiZRlRf71jRKS7EjR5Nsmr/O781HlSgKQJwX+W0SC8yud5oUIqrEp7xI4ys9ZbSNBQ/bB9fZdZZMrdFPWkBSTkQmyCKZfD3Py0TufblcLPKiEvG2FuouyeL8jkSpKCrIfjVLSmtc5HcljhfnorSyvLJKvcgygcj1ltzvQW5Z76YP/imJb0SFrQshsstFNBFHtyKr3kVZjE1IIeb5rTjOFsvqldLGSIpRn+yyt+hqtRDk5Ojt1ec3Zx9enxx9Pjw5Pvz9OpM7T5eZWm9pdZznSVaN7qRSGhHrI06UyRZyHBarZQU45oiSRHE8UtMsTNHr9q0OzE4zCoB9q54rYdO8tcmh/EY+vTu+OtppZiySe5FeJv8R+xZbP5yJ5GZWXYipKEQ2EWuAd93n5PDk1en556uzz79dnH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MCgww30CHCYYZvKOjk5+genx31uazEQg04vSPdytKrLqd2LPXtgyp69q2f1Q4/D07X31u+z5RbIIjhG3tig2cr6nv8+X8)

---

<div class="post-metadata">

**Author:** ![MrSimple](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mrsimple/32/9455_2.png) [@MrSimple](https://community.cesium.com/u/MrSimple)\
**Post date:** [July 22, 2022, 10:06am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/2 "2022-07-22T10:06:32Z")

</div>

upppppp, help me please

---

<div class="post-metadata">

**Author:** ![sanjeetsuhag](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sanjeetsuhag/32/1992_2.png) [@sanjeetsuhag](https://community.cesium.com/u/sanjeetsuhag)\
**Post date:** [July 24, 2022, 10:01pm UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/3 "2022-07-24T22:01:47Z")

</div>

Hi @MrSimple

Could you describe the exact behavior you’re looking for here? Are you trying to drop points under the ground and have them display on the surface?

---

<div class="post-metadata">

**Author:** ![MrSimple](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mrsimple/32/9455_2.png) [@MrSimple](https://community.cesium.com/u/MrSimple)\
**Post date:** [July 29, 2022, 3:18am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/4 "2022-07-29T03:18:20Z")

</div>

I want to create an underground model and I want to be able to draw polygons on the ground, but currently I am getting an error to draw polygons displayed on the ground.

---

<div class="post-metadata">

**Author:** ![MrSimple](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mrsimple/32/9455_2.png) [@MrSimple](https://community.cesium.com/u/MrSimple)\
**Post date:** [July 29, 2022, 4:25am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/5 "2022-07-29T04:25:31Z")

</div>

when i turn on  
Translucency, the polygon goes through the ground, but when I turn it off and draw, the polygon floats on the ground

 ![image](https://global.discourse-cdn.com/cesium/original/3X/2/2/221f35417c55d79823f5daf6d3080e0b792fcfa8.jpeg)

---

<div class="post-metadata">

**Author:** ![MrSimple](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mrsimple/32/9455_2.png) [@MrSimple](https://community.cesium.com/u/MrSimple)\
**Post date:** [August 1, 2022, 3:56am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/6 "2022-08-01T03:56:41Z")

</div>

upppppp

---

<div class="post-metadata">

**Author:** ![Alexander\_Johannesen](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/alexander_johannesen/32/2008_2.png) [@Alexander\_Johannesen](https://community.cesium.com/u/Alexander_Johannesen)\
**Post date:** [August 1, 2022, 5:11am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/7 "2022-08-01T05:11:04Z")

</div>

Hi there,

There are too many unknowns in your request here, really. But the short version is that once you set the ground to transparent, it’s no longer “the ground” in terms of picking / and or clamping, etc. So, maybe explain how you’re drawing the polylines? Are you using pickPosition? You may have to rewrite to use your own picker using rays, and some clever turn on and off.

The cheaper version is to turn transparency off while drawing, and turn it on again when you’re done. Also, we don’t know what error you’re getting from drawing on a transparent globe, but my guess is that the picker / pickPosition() is out of bounds (because it’s really hitting outer space).

Anyway, more details would be nice, including what error you’re getting. I tried your Sandcastle, and I could draw lines with it, however, because of the near transparency the lines are actually drawn on the other side of the globe. I think you’re trying to do the following;

1. Globe is transparent
2. Draw on the transparent surface

If yes, then the normal picker won’t help you (as it picks on the back of the globe on the other side), but look at viewer.camera.pickEllipsoid(incoming\_position); if that might override the transparency. Otherwise, let’s look at ray pickers Let us know.

Cheers,

Alex

---

<div class="post-metadata">

**Author:** ![MrSimple](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mrsimple/32/9455_2.png) [@MrSimple](https://community.cesium.com/u/MrSimple)\
**Post date:** [August 1, 2022, 7:13am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/8 "2022-08-01T07:13:43Z")

</div>

thank you for your support, you said what i mean, i try to draw on the transparent surface but it penetrates and shows up on the other side of the globe, it just work when i turn off transparency

---

<div class="post-metadata">

**Author:** ![MrSimple](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mrsimple/32/9455_2.png) [@MrSimple](https://community.cesium.com/u/MrSimple)\
**Post date:** [August 8, 2022, 2:30am UTC](https://community.cesium.com/t/how-to-draw-polygon-and-polyline-on-the-ground-when-translucency-enabled/19651/9 "2022-08-08T02:30:23Z")

</div>

i had used viewer.camera.pickEllipsoid(incoming\_position) and it worked
