This uses https://github.com/Rytelier/godot-sky-and-volumetric-clouds as a base, with several changes made: - Spheres are now used to represent radiance map reflections of varying roughness and metallic values. - A day/night cycle is now featured. - Mipmaps are enabled on the weather texture as an optimization. - The default radiance map settings are more conservative to account for the real-time sky shader. - This makes reflections lower quality, but it's not too noticeable in most real world scenes (especially if using GI techniques for reflections). - Debanding is now applied in the project settings, rather than on the sky shader. This is significantly faster (over 0.1 ms saved on a RX 6900 XT in 3840×2160). It also has the benefit of working on materials, which can exhibit banding if not textured. - The sky shader has debanding commented out in case it's needed. This debanding also applies to the lower half of the sky as well in this case, as it was required to get rid of noticeable banding on the lower half. - Cloud coverage and density uniform hints now allow values as low as 0.001. Co-authored-by: Rytelier <45795134+Rytelier@users.noreply.github.com> Co-authored-by: Clay John <claynjohn@gmail.com>
3D Sky Shaders
An example of a sky shader in Godot. This shader features real-time volumetric clouds and physical sky with Raleigh and Mie scattering, which causes the sky's colors to adjust automatically depending on the sun angle. The sun's angle is set automatically from the first DirectionalLight3D node in the scene (unless its sky mode is Light Only).
Physical sky features are based on the built-in PhysicalSkyMaterial, while volumetric clouds were added after converting PhysicalSkyMaterial to a ShaderMaterial using the Convert to ShaderMaterial button in the editor resource dropdown.
Warning
Sky shaders are rendered every frame if they use the
TIMEvariable or are otherwise updated every frame (e.g. if an uniform is updated in_process()or with an AnimationPlayer). This has a significant performance impact for complex sky shaders. The performance impact can be reduced by adjusting the radiance map properties in Environment, but it will remain significant.The shader in this demo project is expensive, and is intended to be used in games where most of the sky remains visible at all times (such as flight simulators).
Optimizations to sky shader rendering are planned in future Godot releases.
Language: GDScript
Renderer: Forward Plus
How does it work?
The day/night cycle is performed using an AnimationPlayer node that adjusts node properties and the sky shader parameters in real-time.
Spheres with varying levels of roughness and metallic materials are instanced using
a @tool script
so that they don't have to be created manually in the editor, yet they can still be previewed within the editor.
