Which shadowMode to choose?

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

Hi All. I am currently developing a Cesium tool for a urban planning application as part of my dissertation. I am using a 3DTileset.

When adding this tile set I am unsure which shadowMode is best?

I want shadows to only be cast by the tile set from the Sun, irrespective of camera position.

I had thought this would be Cesium.ShadowMode.CAST_ONLY, however when I set this property no shadows are cast by the tile set.

When I use Cesium.ShadowMode.ENABLED, then shadows are cast but according to the Cesium Docs this will mean the tile set will also be receiving shadows.

Apologies if I am slightly confused but for this application it is important that the shadows are accurate, as if you were standing on a street or by a building and would see the same shadows that are in the Cesium tool.

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

var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
    url : '../../../gx_data/10x10',
    shadows : Cesium.ShadowMode.CAST_ONLY

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

This is needed for planning applications where local authorities want to assess ‘access to light’ disputes.

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

Cesium Ver: 1.34, Chrome. MacOS Sierra

There’s no need to specify anything when creating the tileset, for real world shadows, just specify “shadows : true” when creating the Viewer instance:

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

shadows : true


and then all “real world” objects, (3D Tilesets, models, and terrain) will use the Sun as a light source and cast shadows appropriately. The camera position doesn’t matter.

If shadows are important to your app, you may also want to play with the viewer.shadowMap settings to improve quality at the cost of runtime performance: https://cesiumjs.org/Cesium/Build/Documentation/ShadowMap.html for details.

Hi Matthew,

Many thanks for getting back to me and explaining things, that is a real help.

I have played with ShadowMap a bit and so far shadowDepth might prove useful for my application but I will continue to play around with it.

If you are adding entities to the viewer (in this case a polygon) and you want it to cast shadows then I presume you do need to include a Cesium.ShadowMode property (as the default is ShadowMode.DISABLED) for these objects to cast shadows?

Finally I just wanted to ask (it might be a stupid question but hopefully not), when using ShadowMode.ENABLED, objects will cast shadows from the sun and receive shadows. When we say ‘receive’ are we meaning the shadows will be received from other objects in the scene?



For primitive types the shadows property is ShadowMode.DISABLED by default, for models/tilesets/terrain it is ShadowMode.ENABLED, and for the globe it is ShadowMode.RECEIVE_ONLY.

Enabling shadows in the viewer and setting ShadowMode.CAST_ONLY should work like in the code below. And yeah, receiving shadows means being shadowed by all object that cast shadows, including potentially self-shadowing.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

shadows : true


var initialPosition = Cesium.Cartesian3.fromDegrees(-74.01881302800248, 40.69114333714821, 753);

var initialOrientation = new Cesium.HeadingPitchRoll.fromDegrees(21.27879878293835, -21.34390550872461, 0.0716951918898415);


destination: initialPosition,

orientation: initialOrientation,

endTransform: Cesium.Matrix4.IDENTITY


var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({

url: 'https://beta.cesium.com/api/assets/1461?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYWJmM2MzNS02OWM5LTQ3OWItYjEyYS0xZmNlODM5ZDNkMTYiLCJpZCI6NDQsImFzc2V0cyI6WzE0NjFdLCJpYXQiOjE0OTkyNjQ3NDN9.vuR75SqPDKcggvUrG_vpx0Av02jdiAxnnB1fNf-9f7s',

shadows : Cesium.ShadowMode.CAST_ONLY