Baltor Get started

Gallery / Godot shaders

Parallax starfield with twinkling layers

In your harnessGodot shaderMIT

Fill a rectangle with a scrolling starfield: three layers of hashed stars at different densities, sizes and speeds for parallax, colour temperature per star, twinkle, and a scroll direction.

Render of Parallax starfield with twinkling layers
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
canvas_item
Parameters
space_color (vec4 = 0.01, 0.01, 0.04, 1), nebula_tint (vec4 = 0.12, 0.05, 0.2, 1), density (float = 0.45), scroll_speed (float = 0.05), scroll_angle_degrees (float = 200), twinkle_speed (float = 3), star_scale (float = 60), brightness (float = 1.3)
Use it on
A ColorRect (or any CanvasItem) sized to the area to fill; UVs span 0 to 1 across it.
Result
A dark purple space with many small blue and warm stars at three sizes.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/starfield_parallax_2d/

Limits. Stars are placed per grid cell, so their density is regular at large scales. Very fast scrolling streaks nothing; it only translates the layers.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 74.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
Hashed per-cell star placement, Multi-layer parallax scrolling, MurmurHash3 32-bit finalizer over prime-combined lattice coordinates as a hash
Tags
godot shader, canvas item, starfield, space, parallax, background, procedural
Identity
library.supply.creative_originals.f8fef03721496b7ca7fceb41.17347d403d06d8f4
Version
17347d403d06d8f40c277ab8273aee45634af9bf27b086bbd85786585a44c462

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.