Baltor Get started

Gallery / Godot shaders

Planet atmosphere shell with analytic path length

In your harnessGodot shaderMIT

Atmosphere glow for planets: on a shell sphere around the planet, the length of each view ray through the atmosphere is computed analytically, turned into scattering with an exponential, and lit only on the sun side.

Render of Planet atmosphere shell with analytic path length
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Render modes
blend_add, cull_back, depth_draw_never, shadows_disabled
Parameters
atmosphere_color (vec4 = 0.35, 0.6, 1, 1), sunset_color (vec4 = 1, 0.5, 0.3, 1), shell_radius (float = 1), planet_radius (float = 0.9), density (float = 1.2), brightness (float = 1.6), terminator_softness (float = 0.35), night_glow (float = 0.02)
Use it on
A planet mesh and a slightly larger sphere for the shell, both centred at the same point; a DirectionalLight3D as the sun.
Result
A planet with a thin blue halo on its sunlit limb that turns orange at the terminator.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/planet_atmosphere_rim/

Limits. Single-colour scattering with an exponential falloff, not Rayleigh and Mie integration. The shell must be a sphere centred on its origin without non-uniform scale. Additive, so it cannot darken the planet. The camera must stay outside the shell.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 59.2 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
Checks
contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
Techniques
Analytic ray-sphere chord length (closest approach distance), Exponential scattering from optical depth, Fragment-to-light varying for light-dependent glow
Tags
godot shader, spatial, atmosphere, planet, space, rim, custom light function
Identity
library.supply.creative_originals.ea6340f0d400ddcd0ab0d36c.53484e98270e773e
Version
53484e98270e773e16213dcb77831025c3c7bd546cfc2a66c0c1b5b6174b4850

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.