Zylann / godot_atmosphere_shader

Planet atmosphere shader for Godot Engine
Other
90 stars 7 forks source link

Atmosphere shader for Godot Engine 4

This contains a simple atmosphere shader usable on planets. I developped this for a tech demo I'm working on, so I thought of making it an addon.

screen1 screen2

How to use

Copy the contents of zylann.atmosphere under the res://addons folder of your project. Activating the plugin in ProjectSettings is necessary to use NoiseCubemap resources.

A demo scene is available under res://addons/zylann.atmosphere/demo.

To start from scratch, drag and drop planet_atmosphere.tscn as child of your planet node. In the inspector, give it the same radius, and choose a height. You can tweak colors by expanding the shader_params category. Depending on the size of your planet, you may also have to tune density since light will have to travel larger distances through it.

Shaders

The plugin has several shader variants in res://addons/zylann.atmosphere/shaders. They look and perform differently, and have different settings. You can choose one by assigning the custom shader field in the inspector.

The atmosphere version with scattering was based on Sebastian Lague's Coding Adventure, with some help from ProceduralPlanetGodot.

Clouds

screen2

Some shaders have volumetric clouds. They are quite expensive so tradeoffs had to be used. They are imperfect at the moment, but maybe in the future they can be made better as Godot gets more rendering APIs to help with post-processing effects.

Clouds need a coverage cubemap to work well, otherwise by default they cover the whole atmosphere uniformly. The plugin comes with a NoiseCubemap custom resource. It is similar to NoiseTexture, except it generates on a cubemap, which can be applied to a sphere seamlessly, without pinching at the poles.

Known issues