Baltor Get started

Gallery / Godot shaders

Day and night sky driven by the sun height

In your harnessGodot shaderMIT

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.

Render of Day and night sky driven by the sun height
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

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/

Limits. 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.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 69.3 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
Elevation-driven colour blending, Angular sun disc with smoothstep edge, Hashed 3D grid star field on view directions
Tags
godot shader, sky, day night cycle, sunset, stars, time of day
Identity
library.supply.creative_originals.2d7a721b740f8eec2d769d71.9276761f09bc6c9c
Version
9276761f09bc6c9c38bcf2e84850ec36ad2c812e632c869cdbb6d48c58be6d90

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.