# Volumetric Atmospheric Scattering

**URL:** <https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953>\
**Category:** Demos and projects\
**Tags:** shader, postprocessing\
**Created:** [August 22, 2024, 8:03am UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953 "2024-08-22T08:03:42Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [August 22, 2024, 8:03am UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/1 "2024-08-22T08:03:42Z")

</div>

Hey there!

A few years ago, I made a small implementation of a volumetric atmosphere post-process based on [Sebastian Lague’s video](https://www.youtube.com/watch?v=DxfEbulyFcY). I did not share it at the time, so I am fixing this now ^^

 ![pic2](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/7/9781abf033fbe6aa73cdc678e186c1c94cd47615.jpeg)

Take a look at the demo: [Volumetric Atmospheric Scattering](https://barthpaleologue.github.io/volumetric-atmospheric-scattering/dist/)

It is just a few files that you can integrate in any project you want. It is not the fastest, but it gets the job done, and works at any scale imaginable (including 1:1 with planet-size worlds).

Source code with instructions: [GitHub - BarthPaleologue/volumetric-atmospheric-scattering: A simple implementation of volumetric atmospheric scattering using babylonjs.](https://github.com/BarthPaleologue/volumetric-atmospheric-scattering)

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [August 22, 2024, 12:12pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/2 "2024-08-22T12:12:02Z")

</div>

This demo is awesome! I love it!  
There is no way to set back the value of ‘Atmosphere Radius’ to the startup value. The slider min value seems too high.

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [August 22, 2024, 1:26pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/3 "2024-08-22T13:26:05Z")

</div>

Thanks a lot! Good catch for the radius slider I will fix it in the coming days 😉

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 22, 2024, 4:00pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/4 "2024-08-22T16:00:22Z")

</div>

so pretty !!!

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [August 23, 2024, 9:12am UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/5 "2024-08-23T09:12:46Z")

</div>

It should be fixed now ^^ And I upgraded everything to Babylon 7 while I was at it.

---

<div class="post-metadata">

**Author:** ![riven04](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/riven04/32/35407_2.png) [@riven04](https://forum.babylonjs.com/u/riven04)\
**Post date:** [August 23, 2024, 12:38pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/6 "2024-08-23T12:38:00Z")

</div>

This looks so good!

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [August 23, 2024, 1:32pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/7 "2024-08-23T13:32:58Z")

</div>

Physics does create amazing things 👌

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [October 22, 2024, 9:16pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/8 "2024-10-22T21:16:07Z")

</div>

Okay, I got it to look better!

I added Mie scattering and Ozone absorption from [skythedragon’s shadertoy](https://www.shadertoy.com/view/wlBXWK), which improves the look of the atmosphere quite a bit, especially near the terminator:

 ![pic2](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/f/ff2c42313412d14831838106baf97d50c5eefd01.jpeg)

Online demo is at [Volumetric Atmospheric Scattering](https://barthpaleologue.github.io/volumetric-atmospheric-scattering/dist/)

It is still as easy to use as before: just 2 files and 2 lines of code to get high quality atmosphere rendering in BabylonJS 👌

Here are some more picures:

From the ground

 ![pic3](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/7/67ee407db2843ac3a738a9cb78657f2deccb0994.jpeg)

From space

 ![pic4](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/4/64e8fec5965ccdbddb3af6a865a37ad9747feaa7.jpeg)

It is still not that fast as I keep using the basics from Nishita’s original paper. However I came accross this WebGPU project:

> **[GitHub - JolifantoBambla/webgpu-sky-atmosphere: A WebGPU implementation of Hillaire's atmosphere...](https://github.com/JolifantoBambla/webgpu-sky-atmosphere)**
>
> A WebGPU implementation of Hillaire's atmosphere model

It looks really promising and uses a more advanced technique to render the atmosphere waaaaay faster. I might get around to port it to BabylonJS in the future 👀

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 22, 2024, 9:23pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/9 "2024-10-22T21:23:46Z")

</div>

Woot! it’s beautiful!

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [October 23, 2024, 2:03pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/10 "2024-10-23T14:03:49Z")

</div>

It would be even better with some volumetric clouds 👀

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [October 27, 2024, 6:59am UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/11 "2024-10-27T06:59:26Z")

</div>

Wow! 😻😻😻

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/e/eed5c360f314d20b186445627d402fdc7a087246.jpeg)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 28, 2024, 3:03pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/12 "2024-10-28T15:03:34Z")

</div>

Yeah…this is quite something I agree!

---

<div class="post-metadata">

**Author:** ![Guillaume\_Pelletier](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/guillaume_pelletier/32/3695_2.png) [@Guillaume\_Pelletier](https://forum.babylonjs.com/u/Guillaume_Pelletier)\
**Post date:** [October 28, 2024, 3:37pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/13 "2024-10-28T15:37:22Z")

</div>

That awesome, If you are agree, i’m gona test it within my geographic Babylon mapping tests…

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [October 28, 2024, 4:37pm UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/14 "2024-10-28T16:37:30Z")

</div>

Thanks ❤

Go ahead, I want to see how it looks in your project! Let me know if you have any difficulties using it 😉

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [April 23, 2025, 9:20am UTC](https://forum.babylonjs.com/t/volumetric-atmospheric-scattering/52953/15 "2025-04-23T09:20:17Z")

</div>

The demo was broken on chrome because of a change in WebGPU’s spec. I just upgraded the project to Babylon 8 and the problem is gone 👌
