# OpenStreetMap and terrain

**URL:** <https://community.cesium.com/t/openstreetmap-and-terrain/1854>\
**Category:** CesiumJS\
**Created:** [January 9, 2015, 10:44pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854 "2015-01-09T22:44:07Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hyper\_Sonic](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hyper_sonic/32/2255_2.png) [@Hyper\_Sonic](https://community.cesium.com/u/Hyper_Sonic)\
**Post date:** [January 9, 2015, 10:44pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/1 "2015-01-09T22:44:07Z")

</div>

OpenStreetMap when viewed above a certain distance has a nice terrain shading. However once you go below a certain distance the terrain shading disappears. Would it be possible to retain this shading even when you get close to the terrain?

https://www.youtube.com/embed/VIILo8hPSy4?feature=oembed&wmode=opaque&list=PLu7ubzox5Ny6JIhF_tfsOuCMDtsro6ENh

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [January 10, 2015, 9:20pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/2 "2015-01-10T21:20:10Z")

</div>

Looks like the OSM dataset doesn’t include the shading after a certain zoom level. Cesium has lighting for the terrain itself, which you could use. Check out

> [http://cesiumjs.org/2014/10/07/STK-World-Terrain-updated/](http://cesiumjs.org/2014/10/07/STK-World-Terrain-updated/)

This will also change dynamically as the sun rotates around the globe.

Patrick

---

<div class="post-metadata">

**Author:** ![Hyper\_Sonic](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hyper_sonic/32/2255_2.png) [@Hyper\_Sonic](https://community.cesium.com/u/Hyper_Sonic)\
**Post date:** [January 10, 2015, 9:35pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/3 "2015-01-10T21:35:20Z")

</div>

It’s odd, I don’t see that terrain shading at any zoom level when I look at the map at [http://www.openstreetmap.org/](http://www.openstreetmap.org/)  
Thanks for the link, I’ll be sure to check it out!

---

<div class="post-metadata">

**Author:** ![Hyper\_Sonic](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hyper_sonic/32/2255_2.png) [@Hyper\_Sonic](https://community.cesium.com/u/Hyper_Sonic)\
**Post date:** [January 10, 2015, 9:46pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/4 "2015-01-10T21:46:22Z")

</div>

OK, the name threw me off. The menu says ‘MapQuest OpenStreetMap’ which are different maps.  
[http://www.mapquest.com/](http://www.mapquest.com/)

[http://www.openstreetmap.org/](http://www.openstreetmap.org/)

It’s using Mapquest tiles, which do remove terrain shading below a certain zoom. There’s another menu setting that’s simply ‘OpenStreetMap’, which is in fact OpenStreetMap tiles.

---

<div class="post-metadata">

**Author:** ![Hyper\_Sonic](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hyper_sonic/32/2255_2.png) [@Hyper\_Sonic](https://community.cesium.com/u/Hyper_Sonic)\
**Post date:** [January 10, 2015, 11:07pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/5 "2015-01-10T23:07:25Z")

</div>

The World Terrain Lighting does a good job at showing the terrain with plain color textures:  
https://www.youtube.com/embed/hlPSzuG4AqU?feature=oembed&wmode=opaque&list=PLu7ubzox5Ny6JIhF_tfsOuCMDtsro6ENh

I assume the shading is proportional to the angle the sun rays strike it. Perhaps when only the moon is visible it could do the same as with the sun, but use a smaller shading range. Maybe one day there could be Terrain shadows as well.

When I first saw the Moon I was quite surprised. Usually you either see nothing or very bright grey colors (white) when looking up at the Moon from Earth’s surface. Also it seems that the Moon is rendered after the atmosphere, making it oddly more visible when you’re close to the Earth’s surface.

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [January 11, 2015, 3:04pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/6 "2015-01-11T15:04:11Z")

</div>

> I assume the shading is proportional to the angle the sun rays strike it

Yes.

> Maybe one day there could be Terrain shadows as well.

Yes. We have a good plan for this, but no short-term priority yet.

Patrick

---

<div class="post-metadata">

**Author:** ![virendraagrawal](https://avatars.discourse-cdn.com/v4/letter/v/94ad74/32.png) [@virendraagrawal](https://community.cesium.com/u/virendraagrawal)\
**Post date:** [July 20, 2018, 12:08pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/7 "2018-07-20T12:08:04Z")

</div>

Hi, I am also a new one, could you please guide to resolve the above reported issue. I need to implement Sun and Moon Shading functionality, please help me to implement using OL3Cesium.

Thanks  
Virendra

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [July 20, 2018, 5:21pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/8 "2018-07-20T17:21:31Z")

</div>

Hello,

Multiple light sources in Cesium, including the moon, is something we’d like to tackle in the future! In the meantime, there are some workaround depending on what you are trying to do, see Issue [#6553](https://github.com/AnalyticalGraphicsInc/cesium/issues/6553). Could you provide more context for your use case?

If this question is specifically about [ol-cesium](https://github.com/openlayers/ol-cesium), our team doesn’t support that project, so you should ask the maintainer of the project.

Thanks!

Gabby

---

<div class="post-metadata">

**Author:** ![virendraagrawal](https://avatars.discourse-cdn.com/v4/letter/v/94ad74/32.png) [@virendraagrawal](https://community.cesium.com/u/virendraagrawal)\
**Post date:** [July 24, 2018, 5:21am UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/9 "2018-07-24T05:21:48Z")

</div>

Hi Gabby,  
Thanks for the reply. We need to add Sun shade and Moon Shade on Cesium Globe based on user input date, time and zone. Both functionalities, we need to implement separately. Could you please guide how we can achieve this.

Thanks  
Virendra

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [July 25, 2018, 2:36pm UTC](https://community.cesium.com/t/openstreetmap-and-terrain/1854/10 "2018-07-25T14:36:36Z")

</div>

Sun lightning on the globe is enabled with the following:

scene.globe.enableLighting = true;

``

Also, sun ad moon highlights are seen when you turn on the water mask, which allows water to reflect light more realistically. [See this example](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html#c=ZY9Pb4MwDMW/SsSlTEJBu7YUTeq1+yNtai+5BPBoVJN0ToB10777DKxSWXOJ7Pfs33OnSfSOsHoDIm2sWIsNeNM2siTQAfZXWvytrOBH8NGCD3uW6VH741IEaiGZiTugAJ9PjhqNfjIo+3O3UlbZjpmdgR6IaRb6C3E39uJFOZYbZwNDgRaJ+AOHKccLuc5UQMtZ8tl6X4IF3j5h5FiyOP6yRleABKsLhK2pD8HYmr1DxlWURJkPZ4R8Qj6Y5uQoiJYwljIN0JyQ7/Zp0ZZHCLL0fqBm6WUoq0wnTLVW0b8zVCRK1N6z8t4ivpovUFGepeyfjaHTFQd67oBQnwfL4T7fTk0pZZZyeTsVnMNC09XGXw).

If you needed to change how the lighting work on the globe for either the sun or the moon, you could change the shader code in [GlobeFS.glsl](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Shaders/GlobeFS.glsl) or [GlobeVS.glsl](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Shaders/GlobeVS.glsl).
