# Fog color and the atmosphere

**URL:** <https://community.cesium.com/t/fog-color-and-the-atmosphere/5133>\
**Category:** CesiumJS\
**Created:** [February 8, 2017, 1:27pm UTC](https://community.cesium.com/t/fog-color-and-the-atmosphere/5133 "2017-02-08T13:27:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Camila1](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/camila1/32/15673_2.png) [@Camila1](https://community.cesium.com/u/Camila1)\
**Post date:** [February 8, 2017, 1:27pm UTC](https://community.cesium.com/t/fog-color-and-the-atmosphere/5133/1 "2017-02-08T13:27:32Z")

</div>

Hello everyone,

I’m making a map where the terrain is covered by snow.

When tilting the camera, the fog that is seen on the mountains for some reason has a reddish yellow hue, and I’d like it to be blue.  
[![](https://lh3.googleusercontent.com/-0f8nGjqhKq0/WJsV7B-6PnI/AAAAAAAAAIs/LeiKFIYIBwo9R45P-YMKYp1oxE4GE8WWwCLcB/s320/horizonColor.PNG)](https://lh3.googleusercontent.com/-0f8nGjqhKq0/WJsV7B-6PnI/AAAAAAAAAIs/LeiKFIYIBwo9R45P-YMKYp1oxE4GE8WWwCLcB/s1600/horizonColor.PNG)

var transparentBaseLayer = new Cesium.SingleTileImageryProvider({  
url: “data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNgYAAAAAMAASsJTYQAAAAASUVORK5CYII=”  
});

var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({  
url : ‘[https://assets.agi.com/stk-terrain/world](https://assets.agi.com/stk-terrain/world)’  
});

var viewer = new Cesium.Viewer(‘cesiumContainer’, {  
imageryProvider : transparentBaseLayer,  
terrainProvider : cesiumTerrainProviderMeshes,  
baseLayerPicker: false  
});

viewer.scene.globe.baseColor = new Cesium.Color(1,1,1);

``

I’m aware that there isn’t any color property implemented for the Fog for now, but I’ve found this “_In Cesium, the fog is a blend of the atmosphere color and the terrain on the horizon_” in a Cesium [blog post](http://cesiumjs.org/2015/11/12/Fog/).  
However, no matter which color I apply to the atmosphere (with the terrain being white), the fog is still yellow. I don’t get where this yellow color is even coming from.

I also tried to remove the atmosphere and set a blue skybox, with no success.

Can anyone help me with this?

Thank you!

 ![horizonColor.PNG](https://global.discourse-cdn.com/cesium/original/1X/db19508c22202be1435212393bc7efb5e8ce853d.png)

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [February 8, 2017, 2:23pm UTC](https://community.cesium.com/t/fog-color-and-the-atmosphere/5133/2 "2017-02-08T14:23:31Z")

</div>

Hello,

There currently is not a way to set the fog color. It is based on the default atmosphere color and does not currently take into account any atmosphere color shift you may have applied.

We have this GitHub issue open to look into this: [https://github.com/AnalyticalGraphicsInc/cesium/issues/4195](https://github.com/AnalyticalGraphicsInc/cesium/issues/4195)

I added a link to your forum post so we can notify you when we get a chance to look at it.

In the meantime, you can manually edit the fog shader to make the fog the color you want. See this line: [https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Shaders/Builtin/Functions/fog.glsl#L18](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Shaders/Builtin/Functions/fog.glsl#L18)

For example, if you replace fogColor with vec3(1.0, 0.0, 0.0) you will get red fog.

See our build guide for instructions on downloading and building the code base: [https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors/BuildGuide](https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors/BuildGuide)

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![Camila1](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/camila1/32/15673_2.png) [@Camila1](https://community.cesium.com/u/Camila1)\
**Post date:** [February 9, 2017, 7:12am UTC](https://community.cesium.com/t/fog-color-and-the-atmosphere/5133/3 "2017-02-09T07:12:00Z")

</div>

That is very helpful, thank you!

---

<div class="post-metadata">

**Author:** ![sean\_lilley](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sean_lilley/32/2083_2.png) [@sean\_lilley](https://community.cesium.com/u/sean_lilley)\
**Post date:** [October 19, 2018, 9:12pm UTC](https://community.cesium.com/t/fog-color-and-the-atmosphere/5133/4 "2018-10-19T21:12:11Z")

</div>

Hi Camila, you can now set the fog color with

viewer.scene.globe.atmosphereHueShift  
viewer.scene.globe.atmosphereSaturationShift  
viewer.scene.globe.atmosphereBrightnessShift

``

Some combination of saturation and brightness should create the effect you’re looking for: [Demo link](http://cesium-dev.s3-website-us-east-1.amazonaws.com/cesium/master/Apps/Sandcastle/index.html?src=Sky%20Atmosphere.html)

This functionality will be included in Cesium 1.51 on November 1st.
