Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage painterly.package·originates fromworld 0a0b119f-a…

core

What every part of Painted Valley shares: the field's maps baked on the GPU (tHeight with the slope, tMap), the noise (exact port of lib/noise.js), the shared light and fog uniforms with the original's names, and a registry that pushes them and binds the shared textures into ever…

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

painterly.core.core

What every part of Painted Valley shares: the field's maps baked on the GPU (tHeight with the slope, tMap), the noise (exact port of lib/noise.js), the shared light and fog uniforms with the original's names, and a registry that pushes them and binds the shared textures into every valley material (core.material / core.register / core.set / core.setTexture / core.groundAt / core.bake). Called by the Valley driver and every part.

Interface

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

conforms to

zero/source-extract/v2

painterly.core — what every painterly part shares: the field's maps and its light. Lifted from Painted Valley's core (the port of createField's shared uniforms, lib/noise.js and the bake; blendi/painted-valley on Patch, MIT), with the land taken out: the field is a square of the HOST's ground, stated by core.configure and baked from the host's Terrain by core.bake. Every painterly material is made with core.material (or registered with core.register): core pushes the shared values and binds the shared textures into it now and on every change. local core = require("~.core.core") (inside the package; a host goes through Painterly.mount) core.configure({ origin = { 0, 0 }, extent = 4096, texel = 2, axis = { 0, 1 }, heightAt = fn }) core.bake({ heightfield = terrain:field(), masks = { growth = { meadow = 1 } } }) local mat = core.material(asset.resolve("~.meadow.blades", "shader"), { key = "ptl_meadow_blades" }) core.set("uWalker", { x, z, 0.72, len }) core.groundAt(x, z) The shared maps (their names and formats are the contract every shader is written against): tHeight rgba16f r + g = the ground's height in metres (two half floats), b, a = its slope over 48 m tMap rgba8 dry, growth, wet, flowers tShade rgba16f r = how much a canopy shades the ground there (0 open), g = the absolute altitude of whatever stands there (ground, roof, crown), b = how much a solid thing (hill, building) shades the ground there, a = 1 where the top is a canopy (see ~.core.shade) tNoiseHi, tStrokes, tFloor as in the Valley.

vec(t: any) → any

argtypedescription
tany

normalize3(a: { number }) → void

argtypedescription
a{ number }

imul(a: number, b: number) → number

argtypedescription
anumber
bnumber

applyConfig( ) → void

What the field is, as it stands configured: the square of ground the shared maps cover.

texRef(t: any) → any

argtypedescription
tany

push(key: any, name: string, value: any) → void

argtypedescription
keyany
namestring
valueany

declaredSlots(handle: any) → void

Which texture slots a material's shader declares, read off the material itself (no asset lookup, so a component requiring core stays publishable). nil while the shader has not loaded its vocabulary yet.

argtypedescription
handleany

bindTexture(key: any, name: string, tex: any) → void

argtypedescription
keyany
namestring
texany

set(name: string, value: any) → void

Set one shared uniform everywhere. Vectors as arrays {a, b, c} (or {x=,y=,z=} / {r=,g=,b=}).

argtypedescription
namestring
valueany

setMany(values: { [string]: any }) → void

argtypedescription
values{ [string]: any }

setTexture(name: string, tex: any) → void

Provide or replace a shared texture (a TextureHandle, a storage-texture handle, or a key/guid).

argtypedescription
namestring
texany

bindAll(key: any) → void

argtypedescription
keyany

register(handle: any) → void

Register a material (handle or registry key) so it receives the shared values and textures. Textures are bound into the slots its shader declares, once the shader has loaded (a few frames for a new one).

argtypedescription
handleany

unregister(handle: any) → void

argtypedescription
handleany

shaderName(shader: any) → any

The name renderer.material.create takes for a shader: an identity string as given, or an asset.resolve'd shader ref's own (a part resolves its shaders by literal `~.` names, so an install of the package carries them).

argtypedescription
shaderany

material(shader: any, opts: any?) → void

renderer.material.create + register. `shader`: an identity or a resolved shader ref. opts = { key?, render?, properties?, textures? }.

argtypedescription
shaderany
optsany?

mulberry(seed: number) → void

mulberry32, as lib/noise.js.

argtypedescription
seednumber

round32(v: number) → number

argtypedescription
vnumber

fade(t: number) → number

argtypedescription
tnumber

smoothFields(size: number, seed: number, yieldEvery: number?) → void

Four smooth tiling fields (fbm, 5 octaves) of `size`², each normalised to 0..1: lib/noise.js smoothNoiseTexture's values before they are quantised. Returns an array of four arrays (row-major, x + y * size).

argtypedescription
sizenumber
seednumber
yieldEverynumber?

encodeTexture(rgba: buffer, w: number, h: number, opts: any) → any

argtypedescription
rgbabuffer
wnumber
hnumber
optsany

makeNoise(seed: number) → void

tNoise (8 bits, mipmapped), tNoiseHi (16 bits, no mipmaps), both from smoothNoiseTexture(256, seed * 13 + 1); and tWhite (whiteNoiseTexture(256, seed * 7 + 2), nearest) — createField({ seed: 3 }).

argtypedescription
seednumber

pixel(r: number, g: number, b: number, a: number, name: string) → any

argtypedescription
rnumber
gnumber
bnumber
anumber
namestring

configure(o: any) → void

States the field. `o`: { origin = { cx, cz }, extent = side in metres, texel = metres per texel (or res = texels a side), axis = { ax, az } the way the place faces (unit; wind, strokes, the sky's layout), heightAt = fn(x, z) the host's ground, eye = eye height }. A change of the square itself asks for a new bake (core.isReady() turns false).

argtypedescription
oany

groundAt(x: number, z: number) → number

The ground's height at (x, z): the host's own answer (its Terrain's heightAt), which is where a body stands and where the drawn ground is. 0 where the host has no ground.

argtypedescription
xnumber
znumber

onReady(fn: () → void

argtypedescription
fn(

isReady( ) → boolean

waitReady(ref: any) → void

argtypedescription
refany

textureKey(ref: any) → any

argtypedescription
refany

gpuHas(ref: any, name: string) → boolean

Bakes the field's maps on this peer from the host's terrain and makes the shared noise. Yields; run in a task. `source`: { heightfield = the Terrain's field() (a terrainHeightfield), masks = { growth = { layer = weight }, dry =, wet =, flowers = }?, seaLevel = number? }. With no heightfield the field is level ground at `level` (default 0) where everything grows. A second caller while it runs waits for the first; a failure is raised to every caller and can be retried. Whether a compute resource made earlier still stands: `name` among the resources of the compute shader `ref` made it with. (A client's render targets go with the session that made them: a world stood again after a test run, a flip between edit and play. This module's state lives on and would hand out dead textures.) When the engine cannot say, the answer is yes.

argtypedescription
refany
namestring

epoch( ) → number

Counts up each time the field's GPU side had to be made again: a part that keeps GPU things of its own keeps the epoch it made them in, and makes them again when it has moved on.

gpuLost( ) → boolean

Whether the field's render targets are gone (the look then reads flat defaults until it is built again).

bake(source: any?) → void

argtypedescription
sourceany?

bakeBody(source: any) → void

argtypedescription
sourceany

slot(buf: any) → any

argtypedescription
bufany

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.