โ† All examples

godot shaders

Planet atmosphere shell with analytic path length

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.

Recorded render of Planet atmosphere shell with analytic path length

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • inspect_shader.py
  • material.tres
  • planet_atmosphere_rim.gdshader
  • preview.png
  • test_package.py
  • verification/native.json

How it works

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/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

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.