Log inGet started
Package

lighting.sceneSetup

Newest version

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

README.md

lighting

The lighting of the campfire clearing (@builtin::scenes.starter_clearing): a sky drawn by the procedural backdrop that runs through the day, a sun that follows it and casts shadows, a moonlight, a cool ambient term, a sky light that lights the ground from the sky as drawn, and a thin height fog that settles in the bowl.

The day opens at 17:30, with the sun low and warm and the shadows long, and runs on the session clock while the game plays, so every player in the world sees the same hour; it holds still in edit mode. One day lasts 24 real minutes (sky/backdrop/cycleSpeed 60). Set sky/backdrop/timeOfDay for another hour and sky/backdrop/autoCycle to false for one that holds:

local setup = entity.find("lighting").component.get("SceneSetup")
setup:set("sky/backdrop/timeOfDay", 12)
setup:set("sky/backdrop/autoCycle", false)

The rest of the light follows the sky's hour. The sun goes out after dark, and the moonlight, the ambient light and the fog colour are stated by hour ({ byHour = { ... } }, blended between the hours they name), so the night is dark and blue and the campfire and the lantern carry it:

HourSunMoonlightAmbientFog
07:00 to 17:30upout0.15, cool greyday grey
17:30 to 19:00sinks, out at 18:00rises from 18:00falls to 0.04darkens
19:00 to 05:00out0.10.04, bluenight blue
05:00 to 07:00rises at 06:00out by 06:00rises to 0.15lightens

From 07:00 to 17:30 it holds one daylight: the sky's dawn tint colours the hour either side of sunrise and sunset, and the ambient light and the fog keep the day's values. A warmer morning, a brighter noon or an orange evening is stated by hour the same way, on the sky's colours as on the lights (sky/backdrop/horizonColor, sky/backdrop/dawnHorizonColor; the sceneSetup type's README shows it).

A placement states its own, by hour or as one value:

setup:set("ambient/intensity", { byHour = { ["06:00"] = 0.2, ["21:00"] = 0.02 } })
setup:set("moon/intensity", 0)

Its sky and lights are its own assets, in this folder: sky.sky, sun.sceneLight, moon.sceneLight and ambient.sceneLight.