GroundKit
Bake-time geometry kit for alpineProps' ground generators (FloraGen, RockGen): seeded random, fractal noise, bent alpha cards and swept tubes (forestProps GroundGeo conventions, MIT), geodesic blobs, and an exact convex-polytope builder for granite: a block is cut from a box by p…
GroundKit
Bake-time geometry kit for alpineProps' ground generators (FloraGen, RockGen): seeded random, fractal noise, bent alpha cards and swept tubes (forestProps GroundGeo conventions, MIT), geodesic blobs, and an exact convex-polytope builder for granite: a block is cut from a box by planes (half-space clipping), meshed with flat faces and sharp edges, subdivided and warped by position-based noise so shared edges stay closed. Also snowSkin (a snow layer on a solid's upward faces) and toMesh (rounded arrays for byte-stable bakes). Nothing on the gameplay path requires it.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2GroundKit: the geometry kit alpineProps' ground generators (FloraGen, RockGen) build with. Bake-time only: nothing on the gameplay path requires it. Cards, strips, tubes and the seeded random stream follow forestProps' GroundGeo (Beechwood Brook, MIT) so alpine plants obey the same Mesh contract. Rocks add an exact convex-polytope builder: a block is cut out of a box by planes (half-space clipping), every facet stays a flat face with a sharp edge, and only then is it subdivided and warped by position-based noise (so shared edges stay closed). That is what makes granite read as granite instead of a lumpy sphere. local K = require("~.GroundKit") local poly = K.polytope({ 1, 0.6, 0.8 }, planes) -- planes: { {nx,ny,nz,d} } local g = K.facetMesh(poly, { level = 2, disp = fn, color = fn }) local snow = K.snowSkin(g, { thick = 0.08, threshold = 0.45, seed = 3 }) A Geo is flat arrays in the shape asset.create("mesh") takes. Vertex colour RGB is a tint the material multiplies its albedo by; ALPHA is the wind-sway weight on foliage cards (0 base, 1 tip) and 1 on solid parts.
next(self: any) → number
| arg | type | description |
|---|---|---|
| self | any |
range(self: any, a: number, b: number) → number
| arg | type | description |
|---|---|---|
| self | any | |
| a | number | |
| b | number |
int(self: any, a: number, b: number) → number
| arg | type | description |
|---|---|---|
| self | any | |
| a | number | |
| b | number |
pick(self: any, t: { any }) → any
| arg | type | description |
|---|---|---|
| self | any | |
| t | { any } |
rng(seed: number) → any
A deterministic random stream: r:next() in [0,1), r:range(a,b), r:int(a,b), r:pick(list).
| arg | type | description |
|---|---|---|
| seed | number |
kindSeed(kind: string, variant: number) → number
A seed from a kind name and a variant number.
| arg | type | description |
|---|---|---|
| kind | string | |
| variant | number |
fbm(x: number, y: number, z: number, octaves: number?) → number
Fractal noise, roughly in [-1, 1].
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number | |
| octaves | number? |
norm3(x: number, y: number, z: number) → void
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number |
cross(ax: number, ay: number, az: number, bx: number, by: number, bz: number) → void
| arg | type | description |
|---|---|---|
| ax | number | |
| ay | number | |
| az | number | |
| bx | number | |
| by | number | |
| bz | number |
rot(yaw: number, pitch: number?, roll: number?) → void
Rotation matrix (row-major 3x3) R = Ry(yaw) * Rx(pitch) * Rz(roll).
| arg | type | description |
|---|---|---|
| yaw | number | |
| pitch | number? | |
| roll | number? |
mulv(m: { number }, x: number, y: number, z: number) → void
| arg | type | description |
|---|---|---|
| m | { number } | |
| x | number | |
| y | number | |
| z | number |
new( ) → Geo
tri(g: Geo, a: number, b: number, c: number) → void
| arg | type | description |
|---|---|---|
| g | Geo | |
| a | number | |
| b | number | |
| c | number |
count(g: Geo) → number return
| arg | type | description |
|---|---|---|
| g | Geo |
triCount(g: Geo) → number return
| arg | type | description |
|---|---|---|
| g | Geo |
append(dst: Geo, src: Geo, xf: any?, tint: Vec?, alphaMul: number?, alphaAdd: number?) → Geo
Copy src into dst through a transform { p = offset, r = rot matrix, s = scale (number or vec) }; tint multiplies RGB.
| arg | type | description |
|---|---|---|
| dst | Geo | |
| src | Geo | |
| xf | any? | |
| tint | Vec? | |
| alphaMul | number? | |
| alphaAdd | number? |
recomputeNormals(g: Geo) → Geo
Area-weighted smooth normals rebuilt from the triangles.
| arg | type | description |
|---|---|---|
| g | Geo |
posKey(x: number, y: number, z: number, e: number) → string
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number | |
| e | number |
weldNormals(g: Geo, eps: number?, k: number?) → Geo
Vertices sharing a position (within eps) get the same averaged normal (blend k: 1 = full average).
| arg | type | description |
|---|---|---|
| g | Geo | |
| eps | number? | |
| k | number? |
bendNormalsUp(g: Geo, k: number) → Geo
Bend each normal toward +Y by k (0..1): soft, sky-lit shading for foliage cards.
| arg | type | description |
|---|---|---|
| g | Geo | |
| k | number |
bounds(g: Geo) → void
Axis-aligned bounds: lo, hi.
| arg | type | description |
|---|---|---|
| g | Geo |
strip(spine: { Vec }, o: any) → Geo
A bent strip card along a spine (GroundGeo.strip). UV u 0..1 across, v 1 at the base .. 0 at the tip (or the crop given); alpha rises base -> tip.
| arg | type | description |
|---|---|---|
| spine | { Vec } | |
| o | any |
arcSpine(len: number, yaw: number, lean: number, droop: number, segs: number) → void
A blade/frond spine rising along yaw, leaning from vertical, arching over toward the tip (segs+1 points).
| arg | type | description |
|---|---|---|
| len | number | |
| yaw | number | |
| lean | number | |
| droop | number | |
| segs | number |
tube(pts: { Vec }, radii: { number }, sides: number, o: any?) → Geo
A swept tube along pts with radii; color(v, a) -> r,g,b,alpha. UV u around, v metres*vScale.
| arg | type | description |
|---|---|---|
| pts | { Vec } | |
| radii | { number } | |
| sides | number | |
| o | any? |
geosphere(level: number) → void
| arg | type | description |
|---|---|---|
| level | number |
mid(a: number, b: number) → number
| arg | type | description |
|---|---|---|
| a | number | |
| b | number |
blob(o: any) → Geo
A geodesic blob: shape(dx,dy,dz) -> x,y,z; color(x,y,z,dx,dy,dz) -> r,g,b,a; UVs planar from above.
| arg | type | description |
|---|---|---|
| o | any |
centroid(pts: { Vec }) → void
| arg | type | description |
|---|---|---|
| pts | { Vec } |
perp(nx: number, ny: number, nz: number) → void
| arg | type | description |
|---|---|---|
| nx | number | |
| ny | number | |
| nz | number |
sortFace(f: Face) → void
| arg | type | description |
|---|---|---|
| f | Face |
box(hx: number, hy: number, hz: number) → void
An axis-aligned box polytope with half extents hx, hy, hz.
| arg | type | description |
|---|---|---|
| hx | number | |
| hy | number | |
| hz | number |
clip(poly: { Face }, nx: number, ny: number, nz: number, d: number) → void
Cut a polytope by the half-space n.p <= d (n unit). Returns the new polytope (unchanged when the plane misses it).
| arg | type | description |
|---|---|---|
| poly | { Face } | |
| nx | number | |
| ny | number | |
| nz | number | |
| d | number |
addCap(p: Vec) → void
| arg | type | description |
|---|---|---|
| p | Vec |
polytope(ext: Vec, planes: { { number } }) → void
A block cut from a box of half extents ext by each plane { nx, ny, nz, d } (normals need not be unit).
| arg | type | description |
|---|---|---|
| ext | Vec | |
| planes | { { number } } |
support(a: number, b: number, c: number, nx: number, ny: number, nz: number) → number
Ellipsoid support distance along unit n for semi-axes a, b, c.
| arg | type | description |
|---|---|---|
| a | number | |
| b | number | |
| c | number | |
| nx | number | |
| ny | number | |
| nz | number |
polyTris(poly: { Face }, level: number) → number
Triangles a polytope makes at a subdivision level (each n-gon is a centroid fan of n triangles, x4 per level).
| arg | type | description |
|---|---|---|
| poly | { Face } | |
| level | number |
transformPoly(poly: { Face }, xf: any) → void
Move a polytope (every point) by a transform { p, r, s }, keeping face normals and planes consistent.
| arg | type | description |
|---|---|---|
| poly | { Face } | |
| xf | any |
facetMesh(poly: { Face }, o: any) → Geo
Mesh a polytope with crisp facets: each face fanned from its centroid, subdivided `level` times, warped by disp(x,y,z) -> dx,dy,dz (position-based, so shared edges stay closed), UVs planar per face (uvScale per metre), normals smooth within a face and softened across edges by `edgeSoft` (0 sharp .. 1 smooth). color(x,y,z,nx,ny,nz,dispMag) -> r,g,b.
| arg | type | description |
|---|---|---|
| poly | { Face } | |
| o | any |
displaced(p: Vec) → void
| arg | type | description |
|---|---|---|
| p | Vec |
mid(a: Vec, b: Vec) → Vec
| arg | type | description |
|---|---|---|
| a | Vec | |
| b | Vec |
canonical(p: Vec) → Vec
| arg | type | description |
|---|---|---|
| p | Vec |
vid(p: Vec) → number
| arg | type | description |
|---|---|---|
| p | Vec |
snowSkin(src: Geo, o: any) → Geo
A snow layer over the upward faces of a solid: triangles whose face normal's Y passes `threshold` (+ noise) are copied, welded, pushed up and out by up to `thick` (thinning to a hairline at the layer's edge). Opts { thick, threshold, seed, noise?, minY? }. Solid (alpha 1), white, UVs planar from above.
| arg | type | description |
|---|---|---|
| src | Geo | |
| o | any |
weld(i: number) → number
| arg | type | description |
|---|---|---|
| i | number |
vert(v: number) → number
| arg | type | description |
|---|---|---|
| v | number |
q(v: number, s: number) → number
| arg | type | description |
|---|---|---|
| v | number | |
| s | number |
toMesh(g: Geo) → void
Flat arrays rounded for small, byte-stable baked files.
| arg | type | description |
|---|---|---|
| g | Geo |
Geo = { positions: { number }, normals: { number }, uvs: { number }, colors: { number }, indices: { number } }Vec = { number }Face = { n: Vec, d: number, pts: { Vec } }Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
This asset
●1problemagent_score is exposed.+ 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".
Scoped to this part · feeds back into the world's score.