Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit098ece8e9e

README.md

quickLighting

Lighting and post-processing for a scene's build.luau in one statement each. It is the quick way: everything it writes is an ordinary stored component (Light, ProceduralSky, EnvironmentLighting, PostProcess), so the same lighting can be written with entity.spawn and component.add, and either way the entities can be selected and edited. The module joins the sceneBuild and sceneModule contexts, so its exports are globals in a scene's build.luau and a .sceneModule's entry script.

function content()
    Lighting({
        background  = "#0c0f12",
        environment = 1,
        sun         = { color = "#fff1dc", intensity = 1.6, position = { 18, 30, 22 } },
    })
    PostProcessing({
        exposure    = 0.9,
        toneMapping = "aces",
        bloom       = { threshold = 1.05, intensity = 0.55 },
        vignette    = { intensity = 0.45 },
    })
end
  • Lighting{ sun, ambient, sky, background, environment }: the sun (color, intensity, position or direction), an ambient light, the procedural sky (a preset name, a table of its fields, or false for none), a solid background colour, and the environment, the scene's sky lighting matte and metal surfaces (a number for both terms, or { diffuse, specular }).
  • PostProcessing{ bloom, vignette, colorGrade, fog, blur, ... }: each key naming a builtin post effect adds it (a table sets its values, true takes its defaults), run in a fixed order. exposure and toneMapping ("none", "reinhard", "aces", "neutral") set the display transform. effects = { { shader, values } } adds any other post shader. One call states the whole stack.
  • DirectionalLight(color, intensity), PointLight(color, intensity, distance), AmbientLight(color, intensity): add one light; a directional light takes its direction from light.position toward the origin, as in three.js.