Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit8d45df8664

README.md

ecs.Sky

Spec for the Sky component, which maps to the native Sky. Backs solid, gradient, procedural, and skybox-texture skies, selected by skyType.

Fields

  • skyType — selects the sky mode.
  • materialName — material used for the sky.
  • timeOfDay, autoCycle, cycleSpeed — day/night cycle position and animation.
  • syncSunToLight — drive a directional light from the sun position.
  • texture — skybox texture asset.
  • exposure, rotation — sky exposure and orientation.
  • solid, zenith, horizon, ground — Vec3 colors ({ r, g, b }) for the solid color and gradient stops.
  • sunSize, sunIntensity — sun disc size and brightness.
  • starsIntensity — star field brightness.
  • moonSize — moon disc size.
  • turbidity — atmospheric haze for the procedural sky.

Usage

ecs.insertSync(id, ecs.Sky{
    skyType = "gradient",
    zenith = { 0.1, 0.2, 0.5 },
    horizon = { 0.8, 0.7, 0.6 },
    ground = { 0.2, 0.2, 0.2 },
})

Two script components drive this one and carry their own authored fields on top of it: ProceduralSky for the editable day/night sky, and Skybox for a sky expressed as a material.

entity(id).component.add("ProceduralSky", { timeOfDay = 18.5 })
entity(id).component.add("Skybox", { material = "sky_cubemap" })