sky.assetType
- README.md5.6 KB
- about.yaml443 B
- behavior.luau7.9 KB
- inspector.luau525 B
- template
- type.yaml1.7 KB
This package holds more than this page lists. See all of its files in its world.
README.md
Sky (asset type)
A sky is the sky of a scene in one asset: a composition of members, each an
asset whose type implements applicable, with the values the sky states
for them. One of them is a backdrop, a render feature that writes the
scene's Sky row (@builtin::systems.sky.backdrops.procedural,
@builtin::systems.sky.backdrops.material, or a creator's own); the others are
whatever else belongs to the sky, such as clouds. A sky has no parameter of its
own: its parameters are its members', by path (backdrop/timeOfDay,
clouds/coverage, clouds/@enabled). A member whose parameters follow from
content its values name has those too: a material backdrop's parameters are
its own (material, exposure, rotation) and the shader properties of the
material it names (backdrop/zenith, backdrop/glow_size), each with the
material's value as its default.
Where it lives
- Source:
<name>.sky/ - Identity:
<name>(the.skysuffix strips from the identity) - Folder shape:
sky.yaml: the definition. Required.README.md: what the sky draws. Required..metadata:descriptionandtags. Required.preview.png: its picture. Optional.
The definition
members:
- id: backdrop
source: "@builtin::systems.sky.backdrops.procedural"
values: { timeOfDay: 18.5, zenithColor: [0.2, 0.1, 0.3], horizonColor: [0.9, 0.4, 0.2], horizonHeight: 2 }
- id: clouds
source: "@builtin::systems.volumetrics.volumetricSky"
# Omitted values use the package's complete default weather preset.
It is read the way a scene setup's is: the same member grammar, the same
diagnostics, nested compositions under their member id. A member's source
is an identity (skies.parts.haze, @builtin::systems.sky.backdrops.procedural)
or a path with its type suffix: absolute (/source/skies/parts/haze.renderFeature),
from the folder holding this sky (haze.renderFeature, ./haze.renderFeature,
../parts/haze.renderFeature) or from the world's source folder
(skies/parts/haze.renderFeature). An identity drops the type suffix, so a
sky and a scene setup of one name in one folder share it; their paths name
each apart. The scene setup type's README has the whole grammar.
A volumetric cloud member's weather is its preset table, and a value for it states the whole table.
Using one
A sky implements applicable: applied, it applies every member for the
owner:
local dusk = asset.resolve("my-dusk", "sky")
dusk:as("applicable"):apply("myEntity:sky", { ["backdrop/timeOfDay"] = 19 })
local drawn = sky.drawn() -- { entity, source = dusk, description }
dusk:as("applicable"):drop("myEntity:sky")
sky.drawn().description (the sky's own describeSky) is { material, timeOfDay, sunDirection, members, notice? }, built from what is drawn; notice is what a
member states about the settings it runs, by member path. A procedural
backdrop draws its base colours (zenithColor, horizonColor, groundColor)
in the shape horizonHeight gives them: the elevation in degrees where the sky
is halfway from the horizon colour to the zenith colour (default 7.933). A
palette whose horizon colour is a band, such as a sunset's orange under a
violet sky, lowers it (to 2, say) so the zenith
colour shows at eye level. The backdrop draws them while the sun is high and its night and dawn tint sets as the sun sinks, as far
as nightStrength and dawnStrength say; a sky that holds one hour states its
look in the base colours with both strengths at 0, and the notice names a set
that masks the base colours at the hour drawn. The backdrop's README has the
table of which set shows at which hour. A light that follows the sky
(lighting.followSky) is oriented by a procedural backdrop's hour.
Moon and moonlight. A procedural backdrop draws its moon opposite its sun,
at the hour it draws. After dark a light that follows the sky stands at that
moon: a sun that takes its intensity from the sky is out, and a light that
keeps its own (followSkyIntensity: false) is moonlight at the intensity it
states, from where the moon is drawn. A night setup keeps the two together by
giving its moonlight followSky: true, followSkyIntensity: false and a
moonlight intensity and colour (a setup nesting a day setup sets its sun's
followSkyIntensity to false and its intensity to the moon's), so the
light stands where the moon is drawn.
A material sky's shader values
A sky drawn by a material takes that material's shader properties as parameters, so a sky, a setup nesting it, or a placement states them by path like any other value, and a setup's card lists them:
# night_variant.sceneSetup/sceneSetup.yaml: the base setup, its sky's glow raised
members:
- id: base
source: "./base.sceneSetup"
values:
"sky/backdrop/glow_intensity": 2.5
"sky/backdrop/zenith": [0.02, 0.01, 0.08, 1]
The backdrop draws the material itself while every value stated for it is the material's own, and a runtime copy of the material with the stated values laid over its own once one differs; the material asset is not written. Two applications of one backdrop are arbitrated the way every render feature's are: the newest that states something new is in force, and dropping it brings back the values of the one before it.
Making one
asset.create("sky", "aurora", { members = {
{ id = "backdrop", source = "@builtin::systems.sky.backdrops.material",
values = { material = "my-aurora-material", exposure = 1.2 } },
} })