• Resources
  • Dynamic Rayleigh & Mie Sky with Volumetric Clouds sky shader

Hello! I thought it would be a good idea to publish this asset as I have seen other people try to do this too.

This asset is a combination of two assets made by two others that were both originally pure GLSL scripts by two other people. I edited the two shaders into one shader and the Godot scripts into less godot scripts.

The original assets:

A sky shader by Bastiaan Olij based on a GLSL rayleigh mie shader by Rye Terell

And a clouds shader by Danil W or Danil S Based on a GLSL volumetric clouds shader by Valentin Galea

Code by me, Leo Gallatin under the MIT license! Here's the link to the asset.

This asset contains a shader that renders a Panoramic Sky for use as a skybox. It also contains scripts and scenes for that exact purpose, and a couple textures that are necessary for the shader to work as intended. For now, the shader cuts off around the horizon line, so you will want to either add your own shader content under the horizon line or hide the horizon line with geometry.

I plan to add more features like the clouds and sunlight color reflecting the sky color during sunsets and sunrises, the clouds changing gradually based on a "weather" controller, the sun going across the sky at an angle and being able to change that angle based on how long a day should last, and then the length of a day and kinds of weather be determined by the day of the year. Probably also a custom night sky that is not an image so it can be animated. Lots of things to look forward to.

I am tentatively calling this "Version 1.0"

---

How to setup:

Add the folder in this package "addons/Sky" to your project folder. You should then be able to instance the "Skycontrol.tscn" scene into any scene you have.

Make sure that noise.png is set to Repeat: Enabled in the Import tab. If it isn't, change it and reimport.

On your default/active camera, either set the environment to the environment included, "sky_environment.tres", or set your own environment to have a Sky Background using a PanoramicSky.

Hopefully, if all went well, you should be able to compile and see a beautiful sunrise with some giant fluffy clouds!


Alright, I will explain briefly how this works, the basic structure is pretty easy:

If you load up the scene "Skycontrol", we have a base node named Skycontrol that has the script "sky_control" attached. This node would be the controller for the sky and clouds, it is responsible for updating the skybox and sun.

Skycontrol has two children, Skybox.tscn and a directional light called Sun.

Skybox.tscn is a simple scene with a viewport root node with the script "skybox_code" and a Sprite child with a texture, which is where the shader "sky_clouds" draws to.

o Node Skycontrol script "sky_control" ----- o Viewport Skybox script "skybox_code" ---------- o Sprite Skytexture shader "sky_clouds" ----- o DirectionalLight Sun

Not too many parts.

The script "sky_control" handles the time changes, in it you can set how long you would like a day to last and how often to update sun and environment lighting. This script is like the Skybox's boss, it handles the big picture while the Skybox talks to the shader. One note, be careful with the environment lighting, it is pretty intensive to update so don't make it update every frame unless you're sure you can handle it.

The script "skybox_code" is supposed to be the direct interface between the shader and scripts. If you want to tell the shader something in the sky_control script you should grab the shader through the skybox_code script.

Feel free to change this asset to your liking. Happy skies to you!

13 days later

Looks amazing...how do they look with intersecting geometry? Any issues with shaders with transparency, like trees?