Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage restirLighting.package·originates fromworld 07158574-5…

restirLighting

No description provided.

by◐lumi·posted 4mo ago
What it does

No description provided yet.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

module restirLighting Direct light from many small sources at a cost that does not grow with how many there are. A shading pass that loops every light pays for every light at every pixel, which is why the count has to be capped; resampled importance sampling instead draws a few candidates per pixel, keeps one in proportion to what it would contribute, and carries a weight that makes the survivor stand for the whole set. What a pixel keeps is reused — by its neighbours this frame and by itself on the next one — so the number of candidates each pixel has to draw stays small while the set it effectively samples keeps growing. A cave of glowing crystals or a street of practicals costs what a handful of lights costs. Sources registered here are additional to the lights the engine holds rows for: this lights what it is given, on top of the scene as it was drawn. Register a source with `set`, drop it with `remove`, and the pass starts and stops with the registry. require systems/restirLighting/restirLighting

num(v: any, fallback: number) → number

argtypedescription
vany
fallbacknumber

vec3(v: any, fallback: { number }) → void

argtypedescription
vany
fallback{ number }

normalise(v: { number }, fallback: { number }) → void

argtypedescription
v{ number }
fallback{ number }

gridScale( ) → number

ensureShaders( ) → any

ensureBuffers(cells: number) → void

argtypedescription
cellsnumber

packLights( ) → number

pushParams(count: number) → void

argtypedescription
countnumber

collectStats( ) → void

refresh( ) → void

beginFrame(width: number, height: number) →

Size the buffers to the frame, advance the frame counter and push the settings. The render feature calls this once per frame before it enqueues the passes; it is what gives the temporal reuse a frame to count and the grid a size. or nil when nothing is registered.

argtypedescription
widthnumberViewport width in pixels.
heightnumberViewport height in pixels.

examples

local f = restirLighting.beginFrame(ctx.viewport.w, ctx.viewport.h)

set(key: string, source: Source) → number

Add or replace the source registered under `key`. Re-submitting the same key moves that source rather than adding another, which is what lets a component push its position every frame as its entity moves.

argtypedescription
keystringStable identifier — an entity id works well.
sourceSourceWhere it is and what it emits — see `Source`.

examples

restirLighting.set("crystal", { position = { 2, 1, 0 }, color = { 0.4, 0.8, 1 }, intensity = 6 })

remove(key: string) → boolean

Remove the source registered under `key`.

argtypedescription
keystringThe identifier the source was registered with.

examples

restirLighting.remove("crystal")

count( ) → number

How many sources are registered.

examples

print(restirLighting.count())

capacity( ) → number

The most sources the registry holds.

examples

print(restirLighting.capacity())

configure(opts: Settings?) → State

Change how the resampling is run. Any omitted field keeps its current value.

argtypedescription
optsSettings?The settings to change — see `Settings`.

examples

restirLighting.configure({ candidates = 16, mode = "reference" })

defaults( ) → State

The settings a registry runs under until something changes them. Pass this to `configure` to put every one of them back.

examples

restirLighting.configure(restirLighting.defaults())

settings( ) → State

The settings currently in force.

examples

local c = restirLighting.settings().candidates

perPixelCost( ) → number

How many candidate evaluations a pixel pays for, per frame. It is the answer the whole technique exists to give: fresh candidates plus borrowed neighbours plus the one history, and no term in it is the source count.

examples

print(restirLighting.perPixelCost(), "evaluations regardless of light count")

stats( ) → Stats

What the resampling did on the most recent frame a read-back has landed for, or nil before the first one arrives.

examples

local s = restirLighting.stats(); print(s.lit, "of", s.cells, "cells lit")

memoryBytes( ) → number

What the reservoir grid costs, in bytes: two vec4 per cell, twice over because reuse reads one grid and writes the other.

examples

print(restirLighting.memoryBytes() // 1024, "KiB")

clear( ) → void

Drop every source and release the pass. The settings are kept.

examples

restirLighting.clear()

active( ) → boolean

Whether the resampling pass is currently running.

examples

if restirLighting.active() then print("resampling") end
⌬ Types
Source = {Settings = {Stats = {

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.