Builtin Library
README.md
stars
The night sky's stars, drawn from a star catalogue as the light each star
sends. Every star down to limitingMagnitude is a small splat over the sky,
in the direction it stands, holding its illuminance spread over the pixels it
covers: the frame holds each star's own light at any resolution and field of
view, so the camera's exposure decides what shows. By day the sky's light is
ten thousand times the stars' and a day exposure leaves them below the darkest
code value; a night exposure shows them. Nothing switches them on or off with
the time of day.
The catalogue, brightStars, is the Bright Star Catalogue (5th revised
edition): 9,096 stars, about 8,400 of them at or brighter than 6.5, the
naked-eye limit. A star of visual magnitude V lights a surface facing it with
2.54e-6 x 10^(-0.4 V) lux; its colour is a black body at the temperature its
B-V index gives. The air takes extinction magnitudes at the zenith and more
toward the horizon, by the air mass the light crosses.
The pass draws at afterSky, over whatever draws the sky (a physical
atmosphere, a backdrop, a sky material), on the pixels the scene's geometry
leaves as sky, in every view: the viewport, captures, render-to-texture
cameras and environment cube faces, so water and a sky light's reflection
show the stars too.
Settings
| Setting | Default | What it does |
|---|---|---|
limitingMagnitude | 6.5 | The faintest star drawn: 6.5 is a dark sky; 4 or 3 a hazy or city sky with only the brighter stars. |
brightness | 1 | A factor on every star's light; 1 is nature's. |
luxPerUnit | 10000 | How many lux one unit of the scene's light stands for, the calibration the scene's sun and camera share, so the stars sit among the scene's other lights at their true ratio. |
extinction | 0.25 | Magnitudes the air takes from a star at the zenith. |
starSize | 0.8 | The splat's radius in pixels (its standard deviation). |
latitude | 45 | Where the sky is seen from: the celestial pole stands this many degrees over the northern horizon. World -Z is north, +X east. |
siderealTime | 0 | The sky's turn about the pole, in degrees (the hour angle of the vernal equinox). |
turnRate | 0 | Degrees the sky turns per second of real time; 0.004178 is the Earth's turn. |
Using it
Place it beside the sky in a scene setup or a composition, as any render feature member:
members:
- id: stars
source: "@builtin::systems.sky.stars"
values:
limitingMagnitude: 6.5
latitude: 60
turnRate: 0.004178
or apply it from code:
local stars = asset.resolve("@builtin::systems.sky.stars", "renderFeature")
A frame stored in half floats holds a star's light down to about 6e-8 of
a unit, so a scene whose night is very dark in its own units (a high
luxPerUnit) keeps the brighter stars and rounds the faintest away.