Log inGet started
Package

stars.renderFeature

Newest version

This package holds more than this page lists. See all of its files in its world.

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

SettingDefaultWhat it does
limitingMagnitude6.5The faintest star drawn: 6.5 is a dark sky; 4 or 3 a hazy or city sky with only the brighter stars.
brightness1A factor on every star's light; 1 is nature's.
luxPerUnit10000How 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.
extinction0.25Magnitudes the air takes from a star at the zenith.
starSize0.8The splat's radius in pixels (its standard deviation).
latitude45Where the sky is seen from: the celestial pole stands this many degrees over the northern horizon. World -Z is north, +X east.
siderealTime0The sky's turn about the pole, in degrees (the hour angle of the vernal equinox).
turnRate0Degrees 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.