โ† All examples

godot shaders

Day and night sky driven by the sun height

Sky shader whose colours follow the first directional light: day, sunset and night gradients blend by the sun's elevation, a sunset band leans toward the sun, a sun disc and halo track the light, and stars fade in after dusk.

Recorded render of Day and night sky driven by the sun height

What this component contains

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

How it works

Shader type
sky
Parameters
day_zenith (vec4 = 0.16, 0.38, 0.82, 1), day_horizon (vec4 = 0.62, 0.78, 0.95, 1), sunset_glow (vec4 = 1, 0.48, 0.2, 1), night_zenith (vec4 = 0.01, 0.015, 0.05, 1), night_horizon (vec4 = 0.05, 0.07, 0.16, 1), ground_color (vec4 = 0.16, 0.15, 0.14, 1), horizon_falloff (float = 3), sun_size (float = 0.03) and 3 more
Use it on
A DirectionalLight3D in the scene. Its direction is the sun; without one the sun sits at a fixed low angle.
Result
A gradient sky with a sun and halo that changes from day blue through an orange sunset to a starry night as the light's elevation changes.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/sky_day_night_cycle/

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

Stylized, not a physical atmosphere: colours come from the uniforms, not from scattering. Stars are point-like only at moderate field of view; at very wide angles grid cells can show. Only the first directional light is read. Sky radiance for reflections updates with Godot's sky process mode.