# Is it possible to use CesiumJS to create a cube with an empty center?

**URL:** <https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991>\
**Category:** CesiumJS\
**Created:** [October 23, 2024, 10:57am UTC](https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991 "2024-10-23T10:57:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![deet\_dev](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/deet_dev/32/23442_2.png) [@deet\_dev](https://community.cesium.com/u/deet_dev)\
**Post date:** [October 23, 2024, 10:57am UTC](https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991/1 "2024-10-23T10:57:56Z")

</div>

Is it possible to use CesiumJS to create a cube with an empty center?

I want to use CesiumJS to make a cube with an empty center. Is there an example of this? If it’s hard to make with CesiumJS, I’d appreciate it if you could explain why!  
The shape I want is as follows.

 ![image](https://global.discourse-cdn.com/cesium/original/3X/f/5/f515680c9a4c47081812ed9b7009bcb05790c121.png)

---

<div class="post-metadata">

**Author:** ![anneg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/anneg/32/11217_2.png) [@anneg](https://community.cesium.com/u/anneg)\
**Post date:** [October 23, 2024, 2:41pm UTC](https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991/2 "2024-10-23T14:41:02Z")

</div>

Since this cube is made of faces, you could create that using polygon entities. Polygons can also have holes.

Have a look at this [sandcastle](https://sandcastle.cesium.com/#c=pVJBbtswEPzKQicZcCgbaZBaUYw2boAcArRAmlyqHmhpbRGlSGdJ2VWC/L2kKMWG41slQNjZnRkOhS20Mha2AndIcA0Kd7BAI5qaPXW9OI+KDi+0slwopDwaXeXKv0WnXcoGf2jZrrVyBsGJobLCCjSMl2X8misAxWtMIY9uHB02PX8nbAWVlmjyaOxZ/SCFTgNQCSRORdW+dzzHOG93djpEXXCyruLqnK1I199wTYjmKxFv41+DDOBsNmOTMZxP/Pfs88UH8CmAQOvAIP49ei+7uCkc+L7uy/9IFxJedqGmIUcAs5DwBJgeJDxKCfC2D99XQwf/WmpKLO9QrCubwsXEP/2w5hZJcLmPr6UmdnP/eNszql42KHRjpVuMFJwrjiFJegYIA4TPjSAsYaVpIILVUAqzkbz1Bj7VW1ipfnletK5/6vholUZXEI2jzNhW4ny42hdRbzRZaEjGjCUWa2fr/naybIo/aFlhjLf21Cw5lGal2IIor0+sNxSSG+Mmq0bKB/GCeTTPEsf/IJWal0Ktv2+R/GUcrZrO70OTMZYlDp5WWq3lktOR8z8).

Also, you can always define your models with GLTF.

---

<div class="post-metadata">

**Author:** ![deet\_dev](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/deet_dev/32/23442_2.png) [@deet\_dev](https://community.cesium.com/u/deet_dev)\
**Post date:** [October 24, 2024, 12:15am UTC](https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991/3 "2024-10-24T00:15:40Z")

</div>

Oh! Thank you for your response!  
This is what I wanted!!  
Additionally, if there is an overlap between 3D objects, would there be an example where only that area is represented in a different color?

---

<div class="post-metadata">

**Author:** ![anneg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/anneg/32/11217_2.png) [@anneg](https://community.cesium.com/u/anneg)\
**Post date:** [October 24, 2024, 12:44pm UTC](https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991/4 "2024-10-24T12:44:12Z")

</div>

If your objects overlap AND use transparency AND have different colors, then overlapping those colos will produce a different color.

But transparency _can_ look odd in certain cases.

For anything else, I think you have to calculate the overlapping manually and then build the polygon hierarchy accordingly.

---

<div class="post-metadata">

**Author:** ![anneg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/anneg/32/11217_2.png) [@anneg](https://community.cesium.com/u/anneg)\
**Post date:** [October 24, 2024, 12:46pm UTC](https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991/5 "2024-10-24T12:46:49Z")

</div>

Also, have a look at the sandcastle showcases, for example:

> **[Cesium Sandcastle](https://sandcastle.cesium.com/?src=Polygon.html&label=All)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

---

<div class="post-metadata">

**Author:** ![deet\_dev](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/deet_dev/32/23442_2.png) [@deet\_dev](https://community.cesium.com/u/deet_dev)\
**Post date:** [October 25, 2024, 3:40am UTC](https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991/6 "2024-10-25T03:40:17Z")

</div>

thank you so much for your reply!  
Sorry to ask, but is there an example of manually calculating the overlap and then creating a polygon hierarchy accordingly?  
I really need it !  
Thank you

---

<div class="post-metadata">

**Author:** ![Luke\_McKinstry](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/luke_mckinstry/32/25557_2.png) [@Luke\_McKinstry](https://community.cesium.com/u/Luke_McKinstry)\
**Post date:** [October 29, 2024, 7:29pm UTC](https://community.cesium.com/t/is-it-possible-to-use-cesiumjs-to-create-a-cube-with-an-empty-center/35991/7 "2024-10-29T19:29:29Z")

</div>

Hi @deet_dev ,

Thanks for coming to the forums as you work on your project and it is great you have gotten some useful advice from @anneg.

To your latest question in this thread regarding polygon overlap. In previous discussions on this topic including in this thread [How can I determine if two polygons overlap?](https://community.cesium.com/t/how-can-i-determine-if-two-polygons-overlap/23714) we have found it helpful to point to geospatial helper libraries such as [booleanOverlap | Turf.js](https://turfjs.org/docs/api/booleanOverlap) which may abstract away some of the work for a calculation like polygon overlap.

I hope that is helpful, please let us know if this is not a fit and we would be happy to try and help further.  
Thanks,  
Luke
