How to show shadow for polygon

1. A concise explanation of the problem you’re experiencing.

I am trying to show shadow in Sandcastle. I set shadows and terrainShadows in Cesium Viewer, and I add new Cesium.Primitive including shadows to viewer.scene.primitives.

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

I click “Custom styling” button. No shadow for polygon.

And if we set “terrainShadows: Cesium.ShadowMode.ENABLED”. After we zoom in, then the poly will disappear.

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

4. The Cesium version you’re using, your operating system and browser.

Win10, latest Chrome

I am also having this problem.

How to enable shadows for geojson data sources?
Here is a sandcastle.

So there’s two things here:

  1. You need to enable shadows on the entity (as seen in the Shadows sandcastle example).

So in both yo.ur cases you would need to do:

entity.polygon.shadows = Cesium.ShadowMode.ENABLED


In the callback after it’s added.

  1. For very large objects, like those continent-sized polygons, shadows don’t seem to render. This is a bug in Cesium. See this GitHub issue.

Contributions are of course always appreciated!

Polygons do not receive shadows, at all, as shown in this example