Skip to main content

@voxelize/core

Enumerations​

Core Classes​

Effects Classes​

Other Classes​

Utils Classes​

Interfaces​

Type Aliases​

AirlightInput​

Ƭ AirlightInput: Object

Type declaration​

NameTypeDescription
cameraXnumber-
cameraYnumber-
cameraZnumber-
daylightnumber0..1: how much of the camera's surroundings the sun lights now.
gridLightClusterGrid-
isVisible(fromX: number, fromY: number, fromZ: number, toX: number, toY: number, toZ: number, tolerance: number) => boolean-
nowMsnumber-
registryLightSourceRegistry-
skyExposurenumber0..1: how far under open sky the camera stands.
submersionnumber0..1 camera submersion; the air layer yields to the water optics.
tierLightQualityTier-

ArgMetadata​

Ƭ ArgMetadata: Object

Metadata extracted from a Zod schema for UI purposes.

Type declaration​

NameType
defaultValue?string | number | boolean
namestring
options?string[]
requiredboolean
tabComplete?(currentValue: string, context: TabCompleteContext) => string[]
type"string" | "number" | "enum" | "boolean"

ArmIdleSway​

Ƭ ArmIdleSway: Object

A slow breathing sway the held object makes while it is at rest: neither swinging nor being swapped. It is laid on top of the rest pose each frame and taken off again before the next, so it never accumulates, and it keeps real time, so every frame rate sees the same sway.

Type declaration​

NameTypeDescription
breathLiftnumberHow far it rises at the top of a breath.
breathSecondsnumberSeconds per breath.
breathTiltnumberHow far it tips back toward the eye at the top of a breath, radians.
driftReachnumberHow far it drifts to either side.
driftRollnumberHow far it rolls into the drift, radians.
driftSecondsnumberSeconds per drift from one side to the other and back. Not a multiple of a breath, so the two never settle into one short loop.
fadeInSecondsnumberSeconds it takes to come in once the object is at rest.
fadeOutSecondsnumberSeconds it takes to leave when a swing starts.
pivotTHREE.Vector3The point it sways about, in the arm's frame: where it is held.

ArmObjectOptions​

Ƭ ArmObjectOptions: Object

Type declaration​

NameTypeDescription
fixedFov?numberThe field of view, in degrees, the object is posed for. While it is held, the arm keeps it the size and place on screen it has at that field of view, whatever Arm.viewCamera is drawn at, so a pose tuned once holds when a player widens or narrows the view. Unset, the object follows the camera's field of view like the world does.
idleSway?ArmIdleSwayA breathing sway while the object is at rest. None by default.
positionTHREE.Vector3-
quaternionTHREE.Quaternion-
swingPositions?THREE.Vector3[]-
swingQuaternions?THREE.Quaternion[]-
swingRestartAfter?numberHow far through a swing (0 to 1) it has to be before another swing request restarts it. Earlier requests are dropped, and not sent to peers, so a strike that has started always lands. 0, the default, restarts on every request.
swingRestartBlend?numberSeconds a restarted swing takes to ease out of the pose it interrupted instead of snapping to its first key. 0, the default, snaps.
swingTimes?number[]-

ArmOptions​

Ƭ ArmOptions: Object

Type declaration​

NameTypeDescription
armColor?string | THREE.Color-
armObject?THREE.Object3D-
armObjectOptionsArmObjectOptions-
armTexture?THREE.Texture-
blockObjectOptions?ArmObjectOptions-
customObjectOptions?Record<string, ArmObjectOptions>-
minOccluderDepth?number-
receiveHeldObjectShadows?boolean-
receiveShadows?boolean-
recoveryDip?numberHow far whatever the arm holds sinks below its rest, in the arm's units, while Arm.recovery is 0: a game whose swings land harder for waiting shows the hand coming back. It rises with the recovery, late (by the cube of it), so it is up only once the next swing is full. 0, the default, never sinks.
shadowReach?numberHow far the viewmodel reaches into the world, as a share of the distance it is drawn at: placed with Arm.updateShadowBody, its shadows are looked up at that scale about the eye, so a block drawn two blocks down the screen is shaded where a hand would hold it.

ArmsOptions​

Ƭ ArmsOptions: ColorCanvasBoxOptions & { shoulderDrop?: number ; shoulderGap?: number }

Parameters to create a character's arms. Defaults to:

{
gap: 0.1 * CHARACTER_SCALE,
layers: 1,
side: THREE.DoubleSide,
width: 0.25 * CHARACTER_SCALE,
widthSegments: 8,
height: 0.5 * CHARACTER_SCALE,
heightSegments: 16,
depth: 0.25 * CHARACTER_SCALE,
depthSegments: 8,
shoulderGap: 0.05 * CHARACTER_SCALE,
shoulderDrop: 0.25 * CHARACTER_SCALE,
}

ArrayUniform​

Ƭ ArrayUniform<T, N>: Object

A uniform array the CPU edits in place: value is the array of three objects (or numbers) writers mutate, node the TSL buffer that copies them to the GPU once a render.

Type parameters​

NameType
TT
Nextends ArrayElementType

Type declaration​

NameType
nodeUniformArrayNode<N>
valueT[]

ArrowOptions​

Ƭ ArrowOptions: Object

Parameters to create an arrow.

Type declaration​

NameTypeDescription
colorstring | ColorThe color of the arrow. Defaults to red.
coneHeightnumberThe height of the head of the arrow. Defaults to 0.2.
coneRadiusnumberThe radius of the head of the arrow. Defaults to 0.2.
heightnumberThe height of the body of the arrow. Defaults to 0.8.
radiusnumberThe radius of the body of the arrow. Defaults to 0.1.

ArtFunction​

Ƭ ArtFunction: (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void

A function to programmatically draw on a canvas.

Type declaration​

▸ (context, canvas): void

Parameters​
NameType
contextCanvasRenderingContext2D
canvasHTMLCanvasElement
Returns​

void


AtlasFilteringMode​

Ƭ AtlasFilteringMode: "nearest" | "mip-aniso"

See WorldOptions.blockTextureFiltering.


BiomeTintAtOptions​

Ƭ BiomeTintAtOptions: Object

Type declaration​

NameTypeDescription
chunkSizenumber-
cornersAt(cx: number, cz: number) => Uint8Array | undefined-
lightsUint32Array | Int32Array-
origin[number, number, number]World position, in blocks, of a vertex whose position is zero.
positionBiasnumber-
positionUnitsnumber-
positionsFloat32Array | Uint16Array-

BlendedKind​

Ƭ BlendedKind: "straight" | "premultiplied"

How a blended material's colour reaches the accumulation.


BlendedPassInputs​

Ƭ BlendedPassInputs: Object

See ChunkShadingInputs.blended.

Type declaration​

NameTypeDescription
phaseFloatNode0 all, 1 what lies behind the separating surface, 2 the rest.
separatorBiasFloatNode-
separatorDepth{ sample: (uv: Vec2Node) => { level: (level: FloatNode) => Vec4Node } }-
separatorDepth.sample[object Object]-

Block​

Ƭ Block: Object

A block type in the world. This is defined by the server.

Type declaration​

NameTypeDescription
aabbsAABB[]A list of axis-aligned bounding boxes that this block has.
barrierHeight?numberHow high, in blocks above its voxel's floor, the bodies the server simulates find this block standing (each of its boxes raised to it). Absent for a block with no barrier. The client's own body still collides with the declared boxes; the physics engine reads it through World.getBarrierTopAt only to keep automatic moves (auto-jump, auto-step) from carrying the body over. Mirrors the server barrier_height field.
blueLightLevelnumberThe blue light level of the block.
branchBranchShape | nullDraws every voxel of this block as a branch of the radius its stage holds, joined to its neighbours. null for an ordinary block. Mirrors the server branch field; collision and picking follow the drawn shape through branchAABBsAt.
branchShellbooleanDraws every voxel of this block as a cell of a wide branch section: its slice of the tube of the core its raw bits point at, wearing that core's faces. Mirrors the server branch_shell.
branchSocketsBranchSocket[]The branches this block takes without being one (a leaf, a soil).
castsShadowboolean | nullWhether this block is drawn into the sun's shadow maps. null defers to blockCastsShadow's rule of thumb; a block the rule gets wrong (a door: see-through to the mesher, a plank slab to the eye) says so here. Mirrors the server casts_shadow field.
coupledPartsCoupledPart[]The other voxels of the multi-voxel unit this block is one part of — a door's other leaf, a tall flower's other half. Empty for an ordinary block. The server keeps such units whole at update intake; the client mirrors that in World.updateVoxels so predictions land on the same voxels. Mirrors the server coupled_parts field.
defaultEntityJson?string | nullServer-authored initial data for this block's entity.
dynamicFn(pos: Coords3) => { aabbs: Block["aabbs"] ; faces: Block["faces"] ; isTransparent: Block["isTransparent"] }-
dynamicPatternsBlockDynamicPattern[]-
faces{ corners: { pos: [number, number, number] ; uv: number[] }[] ; dir: [number, number, number] ; emissive?: number ; independent: boolean ; isolated: boolean ; name: string ; pigmentMask?: number ; range: UV ; regionalTint?: boolean ; stageTintMask?: number ; textureGroup: string | null }[]A list of block face data that this block has.
fluidFlowForcenumberThe force applied to entities in this fluid, pushing them in the flow direction.
greenLightLevelnumberThe green light level of the block.
groundFrictionMultipliernumberMultiplier applied to entity ground friction while standing on this block. 1 is normal grip; lower values are slipperier.
idnumberThe block id.
independentFacesSet<string>A set of block face names that are independent (high resolution or animated). This is generated on the client side.
isAnimatedbooleanWhether every voxel of this block is meshed as its own geometry (never merged into the chunk's shared buffers) so World.blockAnimations can move one voxel's faces on their own — a door leaf swinging on its hinge. Mirrors the server is_animated field.
isClimbablebooleanWhether or not can entities climb this block.
isCoupledAnchorbooleanWhether this part is its unit's anchor: the part that is placed, picked and dropped, and whose rotation and stage the other parts follow.
isDynamicbooleanWhether or not does the block generate dynamic faces or AABB's. If this is true, the block will use dynamicFn to generate the faces and AABB's.
isEmptybooleanWhether or not is this block empty. By default, only "air" is empty.
isEntityboolean-
isFluidbooleanWhether or not is the block a fluid block.
isLightbooleanWhether or not is this block a light source.
isOpaquebooleanWhether or not is this block opaque (not transparent).
isPassablebooleanWhether or not should physics ignore this block.
isPlantbooleanWhether this block is plant decoration — a grass tuft, a flower, a crop. The mesher uses it to jitter diagonal faces; the renderer uses it to decide what WorldClientOptions.plantDetailDistance may stop drawing.
isSeeThroughbooleanWhether or not is this block see-through (can be opaque and see-through at the same time).
isTransparent[boolean, boolean, boolean, boolean, boolean, boolean]Whether or not is this block transparent viewing from all six sides. The sides are defined as PX, PY, PZ, NX, NY, NZ.
isWaterloggablebooleanWhether this block can hold the world's waterlogging fluid alongside itself. Whether a given voxel actually does is per-voxel state, read with World.getVoxelWaterloggedAt.
isWaterloggingFluidbooleanWhether this is the fluid that waterlogging fills voxels with.
isolatedFacesSet<string>-
lightAttenuationnumberOptical density for Beer-Lambert light transmission through this block. 0 keeps normal air rules. 1 is leaves-scale. 2 is water-scale.
namestringThe name of the block.
redLightLevelnumberThe red light level of the block.
rotatablebooleanWhether or not is the block rotatable.
rotationBitsAreStatebooleanRaw bits 16-23 of this block's voxels hold the block's own state, not a rotation: World.getVoxelRotationAt reads the identity rotation for it, and its rotation cannot be set. Mirrors the server rotation_bits_are_state.
stackGroupnumberVertical-run id shared by blocks that should shade/sway as one column (peony bottom+top, kelp+lantern). Zero means the block never stacks. Mirrors the server stack_group field.
stageFaces?{ faces: Block["faces"] ; mask: number } | nullThe faces a voxel wears instead of faces while its stage holds any of mask's bits: the same cube in another look, each face standing in for the face toward the same side. null (or absent) for a block with one look. Mirrors the server stage_faces.
standaloneFaceDepthnumberWith transparentStandalone, how many voxels in from either side of a mass of this block the faces between its voxels are still meshed, along each face's axis; 0 meshes every layer. A depth also makes a see-through cube a cutout mass, drawn single-sided with inward copies of its surface (see isClosedCutoutCube).
swimSpeedMultipliernumberMultiplier applied to an entity's swim speed while this block is the fluid at its feet. 1 is normal swim speed; a viscous fluid (lava) should be lower.
transparentStandaloneboolean-
tufts?{ faces: Block["faces"] ; jitter: number ; stageFaces?: Block["faces"] ; tilt?: number } | nullLoose quads a voxel wears over its cube while one of its six neighbours is empty, turned, leant by up to tilt radians and nudged by up to jitter blocks per voxel; stageFaces (when not empty) are worn instead while the stage picks stageFaces. They share the atlas. null (or absent) for a block without them. Mirrors the server tufts.
yRotatablebooleanWhether or not the block is rotatable around the y-axis (has to face either PX or NX).
yRotatableSegments"All" | "Eight" | "Four"-

BlockAnimation​

Ƭ BlockAnimation: Object

Type declaration​

NameTypeDescription
axisCoords3The hinge axis, in the same frame; it turns with the block.
durationMsnumberHow long a move between two rest poses takes.
easing?BlockAnimationEasingProgress curve over 0..1; defaults to easeOutCubic.
pivotCoords3The hinge point, in the block's unrotated 0..1 frame.
restPose(state: BlockAnimationState) => BlockRestPose-

BlockAnimationEasing​

Ƭ BlockAnimationEasing: (t: number) => number

Type declaration​

▸ (t): number

Parameters​
NameType
tnumber
Returns​

number


BlockAnimationState​

Ƭ BlockAnimationState: Object

The voxel state a rest pose is asked for.

Type declaration​

NameTypeDescription
rawnumberThe packed voxel word, for anything the two fields below leave out.
rotationBlockRotation-
stagenumber-

BlockAnimationsSnapshot​

Ƭ BlockAnimationsSnapshot: Object

The state BlockAnimations.snapshot reports.

Type declaration​

NameTypeDescription
activeCountnumber-
registeredstring[]Lower-cased block names with a declared motion.
trackedCountnumber-
voxels{ angle: number ; block: string ; isMoving: boolean ; progress: number ; restAngle: number ; stage: number ; voxel: Coords3 }[]-

BlockEntityUpdateData​

Ƭ BlockEntityUpdateData<T>: Object

Type parameters​

Name
T

Type declaration​

NameType
etypestring
idstring
newValueT | null
oldValueT | null
operationEntityOperation
voxelCoords3

BlockEntityUpdateListener​

Ƭ BlockEntityUpdateListener<T>: (args: BlockEntityUpdateData<T>) => void

Type parameters​

Name
T

Type declaration​

▸ (args): void

Parameters​
NameType
argsBlockEntityUpdateData<T>
Returns​

void


BlockRestPose​

Ƭ BlockRestPose: Object

Where a state's geometry rests, relative to the stage-0 geometry: turned angle radians about the hinge, and displaced by offset (block-local, before the block's rotation).

Type declaration​

NameType
anglenumber
offset?Coords3

BlockRule​

Ƭ BlockRule: { type: "none" } | { type: "simple" } & BlockSimpleRule | { logic: BlockRuleLogic ; rules: BlockRule[] ; type: "combination" }


BlockSimpleRule​

Ƭ BlockSimpleRule: Object

Type declaration​

NameType
id?number
offsetCoords3
rotation?BlockRotation | SerializedBlockRotation
stage?number

BlockUpdate​

Ƭ BlockUpdate: Object

A block update to make on the server.

Type declaration​

NameTypeDescription
isWaterlogged?booleanWhether the updated voxel holds the world's waterlogging fluid alongside its block.
rotation?numberThe optional rotation of the updated block.
stage?numberThe optional stage of the updated block.
stateBits?numberBits 16-23 of the word for a block whose rotation bits are state (Block.rotationBitsAreState), written exactly as they are and never decoded as a rotation. Only the server authors them; a client update leaves them zero.
typenumberThe voxel type.
vxnumberThe voxel x-coordinate.
vynumberThe voxel y-coordinate.
vznumberThe voxel z-coordinate.
waterlogLevel?numberThe level of the waterlogging fluid the updated voxel holds, 0 through 7.
yRotation?numberThe optional y-rotation of the updated block.

BlockUpdateListener​

Ƭ BlockUpdateListener: (args: { newValue: number ; oldValue: number ; source: "client" | "server" ; voxel: Coords3 }) => void

Type declaration​

▸ (args): void

Parameters​
NameType
argsObject
args.newValuenumber
args.oldValuenumber
args.source"client" | "server"
args.voxelCoords3
Returns​

void


BlockUpdateWithSource​

Ƭ BlockUpdateWithSource: Object

Type declaration​

NameType
source"client" | "server"
updateBlockUpdate

BodyOptions​

Ƭ BodyOptions: ColorCanvasBoxOptions

Parameters to create a character's body. Defaults to:

{
gap: 0.1 * CHARACTER_SCALE,
layers: 1,
side: THREE.DoubleSide,
width: 1 * CHARACTER_SCALE,
widthSegments: 16,
}

where CHARACTER_SCALE is 0.9.


BoneMatrixWriter​

Ƭ BoneMatrixWriter: (boneIndex: number, boneMatrix: THREE.Matrix4) => void

Type declaration​

▸ (boneIndex, boneMatrix): void

Parameters​
NameType
boneIndexnumber
boneMatrixTHREE.Matrix4
Returns​

void


BoolNode​

Ƭ BoolNode: Node<"bool">


BoundingBox​

Ƭ BoundingBox: Object

Type declaration​

NameType
minCoords3
shapeCoords3

BoxSides​

Ƭ BoxSides: "back" | "front" | "top" | "bottom" | "left" | "right" | "sides" | "all"

The sides of a canvas box.

"all" means all six sides, and "sides" means all the sides except the top and bottom.


BranchBlockLookup​

Ƭ BranchBlockLookup: Object

What the branch functions need to know about the blocks around one.

Type declaration​

NameType
getBlockById(id: number) => { branch?: BranchShape | null ; branchShell?: boolean ; branchSockets?: BranchSocket[] } | null | undefined
getRawVoxelAt(vx: number, vy: number, vz: number) => number

BranchKind​

Ƭ BranchKind: "voxel" | "core" | "fin"

What a branch block's voxels are, beyond their joints. Mirrors BranchKind: voxel is one voxel thick with its radius in its stage, core is the core cell of a section wider than one voxel (its radius and cut flag in WideBranchBits), fin a floor-seated fin as thick as its stage says and as tall as its raw bits say.


BranchSeat​

Ƭ BranchSeat: "centre" | "floor"

Where a branch's axis runs through its voxel. Mirrors BranchSeat in crates/mesher/src/mesher/branch.rs: centre through the middle (a limb in the air), floor along the middle of the voxel's floor, half sunk into what lies below (a surface root, of which only the upper half exists).


BranchShape​

Ƭ BranchShape: Object

Draws a block as a branch: a square-section tube of the radius each voxel holds in its stage, joined to face neighbours of the same key at the thinner of the two radii. Mirrors BranchShape in the mesher crate.

Type declaration​

NameTypeDescription
endFacestring-
keynumber-
kind?BranchKind-
radiusMasknumberThe contiguous run of stage bits holding the radius less one.
seat?BranchSeat-
sideFacestring-
texelsPerBlocknumber-

BranchSocket​

Ƭ BranchSocket: Object

A block that branches of key up to maxRadius run into.

Type declaration​

NameType
keynumber
maxRadiusnumber

BudgetedWorkOutcome​

Ƭ BudgetedWorkOutcome: "worked" | "skipped" | "exhausted" | "yield"


CSSMeasurement​

Ƭ CSSMeasurement: `${number}${string}`

A CSS measurement. E.g. "30px", "51em"


CameraPerspective​

Ƭ CameraPerspective: "px" | "nx" | "py" | "ny" | "pz" | "nz" | "pxy" | "nxy" | "pxz" | "nxz" | "pyz" | "nyz" | "pxyz" | "nxyz"


CanvasBoxAtlasLayout​

Ƭ CanvasBoxAtlasLayout: Object

Type declaration​

NameType
heightnumber
rectsRecord<BoxFace, CanvasBoxAtlasRect>
widthnumber

CanvasBoxAtlasRect​

Ƭ CanvasBoxAtlasRect: Object

One face's place in a merged layer's atlas, in atlas pixels.

Type declaration​

NameTypeDescription
cellWidthnumber-
cellXnumberThe face's cell: the face plus the edge copies around it.
heightnumber-
widthnumber-
xnumberThe face canvas's top-left corner.
ynumber-

CanvasBoxOptions​

Ƭ CanvasBoxOptions: Object

Parameters to create a canvas box.

Type declaration​

NameTypeDescription
depth?numberThe depth of the box. Defaults to whatever width is.
depthSegments?numberThe depth segments of the box, which is the number of pixels of the canvases along the depth. Defaults to whatever widthSegments is.
gapnumberThe gap between the layers of the box. Defaults to 0.
height?numberThe height of the box. Defaults to whatever width is.
heightSegments?numberThe height segments of the box, which is the number of pixels of the canvases along the height. Defaults to whatever widthSegments is.
layersnumberThe number of layers of this box. Defaults to 1.
mergeFaces?booleanDraw each layer in one call instead of six. The six face canvases stay the paintable source (paint, materials and every face canvas work as before), and each paint is copied into one atlas texture the layer draws with through a single material, at the same texel density, filtering and shader hooks. Opt-in: a consumer that swaps a face material, or edits a face canvas without paint (then call BoxLayer.syncAtlas), needs the per-face path. Defaults to false.
receiveShadows?booleanWhether this canvas box should receive shadows. Defaults to false.
sideSideThe side of the box to render. Defaults to THREE.FrontSide.
texelsPerBlock?numberTexture pixels per world unit. When set, widthSegments, heightSegments and depthSegments are derived from the box's dimensions at this density (at least one texel each), so every face has square texels whatever the box's proportions. Without it a 0.3 x 0.14 x 0.06 box gets the same widthSegments along all three axes and its texture is squashed on every non-square face. Prefer this over hand-picked segment counts for anything that is not a cube.
transparent?booleanWhether or not should this canvas box be rendered as transparent. Defaults to false.
widthnumberTHe width of the box. Defaults to 1.
widthSegmentsnumberThe width segments of the box, which is the number of pixels of the canvases along the width. Defaults to 8.

CharacterOptions​

Ƭ CharacterOptions: Object

Parameters to create a character.

Type declaration​

NameTypeDescription
arms?Partial<ArmsOptions>Parameters to create the character's arms.
body?Partial<BodyOptions>Parameters to create the character's body.
head?Partial<HeadOptions>Parameters to create the character's head.
headLedBody?HeadLedBodyOptionsLet the head lead the body (HeadLedBody): a standing body holds its heading while the look stays within reach of it, and a walking body faces where it travels, so a watcher turns its head before it turns its body. Off by default: head and body share every direction.
idleArmSwing?numberThe speed at which the arms swing when the character is idle. Defaults to 0.06.
isPaintedOnBuild?booleanWhether the boxes get the default colours (paintDefaultColors) as they are built. Defaults to true. A character that is repainted right away, or whose boxes only stand as the frame of a mesh drawn in their place, passes false: painting gives each face canvas a 2D context, and the browser finalizes contexts one by one when the character is collected (a crowd streaming in and out cost whole-second garbage collections).
legs?Partial<LegOptions>Parameters to create the character's legs.
mergeBoxFaces?booleanDraw each body part in one call instead of six (CanvasBoxOptions.mergeFaces). Painting is unchanged; a consumer that swaps or re-reads the parts' per-face materials as draw state needs the per-face path. Defaults to false.
nameTagOptions?Partial<NameTagOptions>-
positionLerp?numberThe lerp factor of the character's position change, expressed per frame at 60 FPS and renormalized to the real frame delta. Defaults to 0.7.
receiveShadows?booleanWhether this character should receive shadows. Defaults to false.
rotationLerp?numberThe lerp factor of the character's rotation change, expressed per frame at 60 FPS and renormalized to the real frame delta. Defaults to 0.2.
shadowSelfBoundsMargin?numberSlack in blocks around the body's bounding sphere (Character.shadowSelfBounds) for the shadow-map filter's reach and a frame of motion. Defaults to 0.1.
swimEnterLerp?numberLerp factor when entering the swimming pose. Defaults to 0.12.
swimExitLerp?numberLerp factor when exiting the swimming pose. Defaults to 0.05.
swimmingSpeed?numberThe speed at which the arms stroke when the character is swimming. Defaults to 1.8.
swingLerp?numberThe lerp factor of the swinging motion of the arms and legs. Defaults to 0.8.
walkSway?numberHow much the body shifts its weight from foot to foot as it walks: a small roll over the planted foot and a dip as the feet pass their widest, read off the legs so it follows any gait. 1 is a natural walk, 0 turns it off. Defaults to 1.
walkingSpeed?numberThe speed at which the arms swing when the character is moving. Defaults to 1.4.

ChatHistoryUpdate​

Ƭ ChatHistoryUpdate: ChatHistoryPage & { before?: number ; isJoin: boolean }

A page of the world's chat history as the chat hands it to onHistory. isJoin marks the replay that came with a (re)join; the rest answer requestHistory.


ChunkColumnState​

Ƭ ChunkColumnState: Object

What the world knows of one chunk column, for isChunkColumnPending.

Type declaration​

NameTypeDescription
isMeshOwedbooleanA loaded chunk with a mesh job queued or running at some level.
isReadybooleanA loaded chunk whose data and light are in place.
loadedForMsnumberMilliseconds since the chunk loaded; meaningless until it has.
stage"requested" | "processing" | "loaded" | nullThe chunk pipeline's stage for the column; null when nothing is known of it.

ChunkDataEventData​

Ƭ ChunkDataEventData: Object

Type declaration​

NameType
chunkChunk
coordsCoords2

ChunkEventData​

Ƭ ChunkEventData: Object

Type declaration​

NameType
allMeshesMap<number, Mesh[]>
chunkChunk
coordsCoords2

ChunkLitHookContext​

Ƭ ChunkLitHookContext: Object

What a chunk lighting hook can read.

Type declaration​

NameTypeDescription
albedoVec3NodeThe albedo the face shades with (tints and weather applied).
preparedunknownWhat the hooks' prepare returned, or undefined without one.
sampledVec4NodeThe atlas texel as sampled, before tints.
sunTotalVec3NodeThe sky and sun part of it, before block light.
totalLightVec3NodeThe light multiplier the face would be lit by.
uniformsChunkShadingInputs-
vChunkVaryings-

ChunkMaterialKind​

Ƭ ChunkMaterialKind: "opaque" | "cutout" | "seeThrough" | "fluid"

How a chunk material draws:

  • opaque: solid faces, the soft 5x5 shadow.
  • cutout: the shared cutout buckets (leaves, plants, tufts), swaying by the per-vertex profile table.
  • seeThrough: blended see-through blocks (glass, panes), the fast shadow, split around the water's depth by waterDepthSide.
  • fluid: water and other fluids: the surface branch and the fast shadow.

ChunkMaterialOptions​

Ƭ ChunkMaterialOptions: Object

Type declaration​

NameTypeDescription
depthOnly?booleanThe chunk vertex stage (waves and sway move the surface) over a fragment stage that writes nothing but depth: the water's depth passes.
hooks?ChunkShadingHooks | null-
kindChunkMaterialKind-
sway?Partial<ChunkSwayConstants> | null-

ChunkMeshEventData​

Ƭ ChunkMeshEventData: Object

Type declaration​

NameType
chunkChunk
coordsCoords2
levelnumber
meshesMesh[]

ChunkMeshUpdateEventData​

Ƭ ChunkMeshUpdateEventData: ChunkMeshEventData & { reason: ChunkUpdateReason }


ChunkPrepareHookContext​

Ƭ ChunkPrepareHookContext: Object

What a hook's fragment preparation can read.

Type declaration​

NameType
uniformsChunkShadingInputs
vChunkVaryings

ChunkRegionArenasOptions​

Ƭ ChunkRegionArenasOptions: Object

Tunables for the per-region BatchedMesh arenas that batch every section of a batched chunk bucket into a few multi-draw calls per region.

Type declaration​

NameTypeDescription
indexPerVertexRationumberIndex capacity per vertex of capacity. Quad geometry uses six indices for every four vertices, hence the 1.5 default.
pageVertexCapacitynumberVertices a page of a region holds. A region is pages that never grow: one that fills opens another, so what one frame uploads when a region gains room is one page (about 9 MB at the default), never the whole region. Larger pages mean fewer draws, smaller ones smaller uploads; a section larger than a page gets a page of its own.
regionSizeInChunksnumberThe width and depth of a region, in chunk columns. Every section whose chunk falls inside the same region shares one BatchedMesh.
slotSlacknumberMultiplier applied to a section's vertex/index count when reserving its arena slot, so small remeshes update in place instead of reallocating.

ChunkRequestCandidate​

Ƭ ChunkRequestCandidate: Object

Type declaration​

NameType
cxnumber
cznumber
distanceSquarednumber
isInViewboolean

ChunkShadingHooks​

Ƭ ChunkShadingHooks: Object

Game-side customization of a block's chunk shading: TSL nodes the chunk graph calls at its stages. key names the customization for program caching: two materials with the same key and kind share one program.

Type declaration​

NameTypeDescription
displace?(context: ChunkVertexHookContext) => Vec3Node-
keystring-
lit?(context: ChunkLitHookContext) => Vec3Node-
prepare?(context: ChunkPrepareHookContext) => unknown-
sampleUv?(uv: Vec2Node, context: ChunkPrepareHookContext) => Vec2Node-
values?Record<string, number | Vector2 | Vector3 | Vector4 | Color>Per-material values the hooks read, by materialValue("hookValues.<name>", type): blocks whose hooks differ only in numbers share one key, and so one graph, with their numbers here.
wave?{ amplitude: FloatNode ; speed: FloatNode }Scale the fluid swell's amplitude and speed.
wave.amplitudeFloatNode-
wave.speedFloatNode-

ChunkShadingInputs​

Ƭ ChunkShadingInputs: Object

Everything a world's chunk materials read alike.

Type declaration​

NameTypeDescription
blendedBlendedPassInputs | nullThe pass a world's blended layers are accumulating in, when it draws them order-independently (OrderIndependentTransparency.uniforms). With a separating surface in view every blended draw runs twice, once for each side of it, and the accumulation drops the fragments of the other side after they are shaded: a blended chunk fragment reads which side the pass keeps and lights only there (FragmentState.isKept).
chunkChunkUniforms-
conesLightConeUniforms-
idnumberDistinguishes worlds in program caches (their uniform nodes differ).
lightingShaderLightingUniforms-
localLocalLightInputs-
swayTableArrayUniform<Vector4, "vec4">-

ChunkSharedPoolStats​

Ƭ ChunkSharedPoolStats: Object

Type declaration​

NameType
bytesAllocatednumber
isActiveboolean
maxSlotsnumber
usedSlotsnumber

ChunkStage​

Ƭ ChunkStage: { requestedAt: number ; sentAt: number | null ; stage: "requested" } | { arrivedAt: number | null ; data: ChunkProtocol ; receivedAt: number ; requestedAt: number | null ; sentAt: number | null ; source: "update" | "load" ; stage: "processing" } | { arrivedAt: number | null ; chunk: Chunk ; loadedAt: number ; receivedAt: number | null ; requestedAt: number | null ; sentAt: number | null ; stage: "loaded" }


ChunkSwayConstants​

Ƭ ChunkSwayConstants: Object

A block's fixed sway (customShaders.sway), baked into its program.

Type declaration​

NameTypeDescription
amplitudenumber-
isCrossShadedbooleanCross-quad shading: fixed sun incidence, no face shade.
rootedboolean-
scalenumber-
speednumber-
yScalenumber-

ChunkUniforms​

Ƭ ChunkUniforms: ReturnType<typeof createChunkUniforms> & SurfaceWeatherUniforms


ChunkUpdateEventData​

Ƭ ChunkUpdateEventData: ChunkEventData & { reason: ChunkUpdateReason }


ChunkUpdateReason​

Ƭ ChunkUpdateReason: "voxel" | "light"


ChunkVaryings​

Ƭ ChunkVaryings: Object

What a chunk vertex hands its fragments (packed into nine slots).

Type declaration​

NameTypeDescription
aoFloatNode-
chunkRevealFloatNodeThe section's reveal from its arena's batching colour (1 otherwise).
crossShadingFloatNode1 for a cross-quad plant (fixed sun incidence, no face shade).
emissiveFloatNode-
fluidDepthBelowFloatNode-
fluidFlowVec2Node-
fluidRestYFloatNode-
isFluidFloatNode-
isFluidPaneFloatNode-
isGreedyFloatNode-
isWaterExposedFloatNode-
lightVec4NodeVoxel light (red, green, blue, sun), 0..1.
lightTwistVec4NodeThe bilinear correction's twist x head weight (quad-light.ts).
mapUvVec2Node-
quadLightTailFloatNode-
stageTintVec3Node-
viewDepthFloatNode-
waterSurfaceYFloatNode-
worldNormalVec3Node-
worldPositionVec3Node-

ChunkVertexHookContext​

Ƭ ChunkVertexHookContext: Object

What a chunk vertex hook can read.

Type declaration​

NameTypeDescription
blockPositionVec3NodeThe geometry position in blocks (the mesher's section space).
restWorldVec3NodeThe vertex's world position before any displacement.
runHeightFloatNode0 at a vertical run's root, 1 at its tip.

ClickOccasion​

Ƭ ClickOccasion: "mousedown" | "mouseup"

The occasion a mouse click listener fires on. Mirrors InputOccasion for the keyboard: press and release are separate lanes, so a listener can tell a tap from a hold.


ClickType​

Ƭ ClickType: "left" | "middle" | "right"

Three types of clicking for mouse input listening.


CloudsOptions​

Ƭ CloudsOptions: Object

Parameters used to create a new Clouds instance.

Type declaration​

NameTypeDescription
alphanumberThe opacity of the clouds. Defaults to 0.8.
atmosphere?SkyFogInputsThe world's atmosphere the deck hazes into: its sky fog, the sky's glow and the camera's water. The deck keeps its own fog range (it sits far above the ground fog) and fogs by horizontal distance only. Clear air without one.
bottomShadenumberBrightness of the underside of a cloud block relative to its top, 0..1. Defaults to 0.7.
cloudHeightnumberThe y-height at which the clouds are generated. Defaults to 256.
colorstringThe color of the clouds. Defaults to #fff.
countnumberThe horizontal count of how many cloud blocks are along each edge of a cloud cell, count * count per cell. Defaults to 16. The whole cloud sheet therefore spans width * count * dimensions[0] blocks: it is width, not this, that adds cells.
dimensionsCoords3The dimension of each cloud block. Defaults to [20, 20, 20].
endFadeFar?FloatNode-
endFadeFarRationumber-
endFadeNear?FloatNodeThe range the deck's far edge fades out over, in fog-scaled blocks (the world's fog range); from the deck's radius without one.
endFadeNearRationumber-
falloffnumberThe noise falloff factor used to generate the clouds. Defaults to 0.9.
heightnumberThe vertical count of how many cloud blocks are in a cloud cell. This is also used to determine the overall count of cloud blocks of all the clouds. Defaults to 3.
lerpFactornumberThe lerp factor used to translate cloud blocks from their original position to their new position. Defaults to 0.3.
noiseScalenumberThe scale of the noise used to generate the clouds. Defaults to 0.08.
octavesnumberThe number of octaves used to generate the noise. Defaults to 5.
seednumberThe seed used to generate the clouds. Defaults to -1, which draws a random seed at construction. A World replaces that with the server's world seed once INIT delivers it (Clouds.setSeed), so every client of one world grows the same deck; name a seed here to override.
sideShadenumberBrightness of the vertical faces of a cloud block relative to its top, 0..1. Defaults to 0.86.
speedFactornumberThe speed at which the clouds drift along -z, in blocks per second of the clock handed to Clouds.update. Defaults to 8.
sunColor?Vec3NodeThe sun's colour and strength, for a volumetric deck's light.
sunDirection?Vec3NodeToward the light the flanks shade by; straight up without one.
sunTintnumberExtra brightness given to faces pointing at the sun, as a fraction. Defaults to 0.12.
sunlightIntensity?FloatNode-
thresholdnumberThe threshold at which noise values are considered to be "cloudy" and should generate a new cloud block. Defaults to 0.05.
verticalNoiseScale?numberThe scale of the noise along the vertical axis. Defaults to noiseScale. Raise it above noiseScale for a shallow deck: a handful of layers span almost no noise at the horizontal scale, so every column fills to the same layer and the top comes out perfectly flat.
widthnumberThe number of cloud cells along each axis of the grid, width * width in total. Defaults to 8.

ColorNode​

Ƭ ColorNode: Node<"color">


CommandInfo​

Ƭ CommandInfo<T>: Object

Information about a command including its processor and documentation.

Type parameters​

NameType
Textends ZodObject<Record<string, ZodTypeAny>> = ZodObject<Record<string, never>>

Type declaration​

NameType
aliasesstring[]
argsT
category?string
descriptionstring
flagsstring[]
isHiddenboolean
isTabCompletePreFilteredboolean
process(args: z.infer<T>) => void
tabCompletePartial<Record<string, (currentValue: string, context: TabCompleteContext) => string[]>>

CommandOptions​

Ƭ CommandOptions<T>: Object

Type parameters​

NameType
Textends ZodObject<Record<string, ZodTypeAny>> = ZodObject<Record<string, never>>

Type declaration​

NameType
aliases?string[]
args?T
category?string
descriptionstring
flags?string[]
isHidden?boolean
isTabCompletePreFiltered?boolean
tabComplete?Partial<Record<keyof z.infer<T>, (currentValue: string, context: TabCompleteContext) => string[]>>

Coords2​

Ƭ Coords2: [number, number]


Coords3​

Ƭ Coords3: [number, number, number]


CoupledPart​

Ƭ CoupledPart: Object

One other voxel a coupled block is stored together with: where it sits in this block's unrotated local frame, and the block id it must hold. Mirrors the server CoupledPart.

Type declaration​

NameType
idnumber
offsetCoords3

CreatureBodyOptions​

Ƭ CreatureBodyOptions: ColorCanvasBoxOptions


CreatureHeadOptions​

Ƭ CreatureHeadOptions: ColorCanvasBoxOptions & { faceColor: Color | string ; neckGap?: number }


CreatureLegOptions​

Ƭ CreatureLegOptions: ColorCanvasBoxOptions & { betweenLegsGap?: number ; frontBackGap?: number }


CreatureOptions​

Ƭ CreatureOptions: Object

Type declaration​

NameType
body?Partial<CreatureBodyOptions>
head?Partial<CreatureHeadOptions>
idleLegSwing?number
legs?Partial<CreatureLegOptions>
nameTagOptions?Partial<NameTagOptions>
positionLerp?number
rotationLerp?number
swingLerp?number
walkingSpeed?number

CrustedFluidShaderOptions​

Ƭ CrustedFluidShaderOptions: Object

A surface for a hot, viscous fluid: a dark cooled crust broken into plates over glowing seams, drifting along the fluid's own flow, built on the chunk lighting shader so it sits in the same world as every other block face.

  • Flow. A top face drifts along the mesher's per-corner surface flow (the same field that bends the water's crests), a wall slides straight down, so a fall runs faster than the sheet feeding it, and an underside stays. Offsets restart every cycle behind a two-generation cross-over, the usual flow-map trick, so a varying flow field never shears the pattern for longer than one cycle. A still pool drifts a little on a heading drawn per generation.
  • Crust. Each generation is a cellular field of plates. A plate forms hot when its generation rises, darkens as it cools, and heats up again and breaks as its generation fades, so the crust reforms continuously instead of cross-fading. A slow heat field makes some patches run hotter than others, so the cycle never pulses over a whole lake at once.
  • Voxel grain. Everything is evaluated per texel on the block-aligned grid (texelsPerBlock, 16 by default), offsets advance in whole texels, and heat maps onto a six-entry palette in flat bands: pixel art, not a smooth noise render. A texel smaller than a screen pixel would alias into sparkle (there is no mip chain for a procedural pattern), so the pattern settles to its mean colour past a screen-footprint threshold.
  • Light. Crust (palette 0 and 1) is lit by the sun and sky like a solid face, over a small self-light so it stays readable in the dark; seams (palette 2 to 5) glow at their own colour. Block light is left out on purpose: the fluid's own emitted light would flood its crust to full brightness and flatten it. A per-direction face shade darkens walls and undersides so a fall reads as a solid column, and crust plates pick up a faint dome relief from the sun's heading.

Every value is a uniform, so a game can tune the look live on the returned uniforms without a recompile. The hooks plug into World.customizeMaterial for the fluid block, with kind seeThrough: the crust replaces the water's surface optics, not the solid shading.

Type declaration​

NameTypeDescription
bands?[number, number, number, number]Heat thresholds for the ember, seam, hot seam and core bands.
crustSceneLight?numberCrust response to the sun and sky light reaching the face.
crustSelfLight?numberCrust brightness without any light.
cycleSeconds?numberSeconds per crust generation. Must divide the shader clock's wrap period so the wrap lands on a generation boundary.
faceShades?{ bottom: number ; sideX: number ; sideZ: number ; top: number }Face shade for the +-X walls, +-Z walls, underside and top.
faceShades.bottomnumber-
faceShades.sideXnumber-
faceShades.sideZnumber-
faceShades.topnumber-
fallCrust?numberCrust hold on a wall: below 1 a fall runs hotter than a pool.
fallFlowSpeed?numberSlide of a wall (a fall), in blocks per second.
fallStretch?numberPlate elongation down a wall (1 keeps them round).
farFadeAnisotropy?numberHow much more a grazing view may squeeze the pattern along one screen axis than along the other before that axis alone settles it, like anisotropic texture filtering. 1 settles by the squeezed axis alone, which flattens a pool seen from its shore a few blocks out.
farFadeTexelFootprint?numberTexels per screen pixel past which detail starts settling to the mean colour; at 4x this it is settled.
formTime?numberFraction of a generation a new plate takes to cool into crust.
glowStrength?numberMultiplier on the glowing bands.
grain?numberPer-texel heat jitter, which dithers the band edges.
meanGlow?numberShare of seam colour in the far mean colour.
palette?ColorRepresentation[]Six colours from coldest to hottest: dark crust, lit crust, ember, seam, hot seam, seam core. The first two are lit; the rest glow.
plateTexels?numberMean plate size, in texels.
relief?numberPlate dome relief on crust, 0 to 1: how far the plate's shaded half falls from the lit crust colour toward the dark one.
seamWidth?numberSeam half-width in plate units (distance to the plate border).
surfaceFlowSpeed?numberDrift of a running top face, in blocks per second.
texelsPerBlock?numberTexels per block of the grid the pattern snaps to.
wave?{ amplitude: number ; speed: number }Scale on the shared surface wave height and speed.
wave.amplitudenumber-
wave.speednumber-
zone?{ amplitude: number ; base: number ; scale: number ; speed: number }Heat-field scale (per block), base, amplitude and speed (per second).
zone.amplitudenumber-
zone.basenumber-
zone.scalenumber-
zone.speednumber-

CrustedFluidSurface​

Ƭ CrustedFluidSurface: Object

A crusted fluid's chunk shading and the uniforms that tune it live.

Type declaration​

NameTypeDescription
hooksChunkShadingHooksFor World.customizeMaterial(block, null, { kind: "seeThrough", hooks }).
uniformsReturnType<typeof crustUniforms>-

CullOptionsType​

Ƭ CullOptionsType: Object

Type declaration​

NameType
dimensionsCoords3
maxCoords3
minCoords3
realMaxCoords3
realMinCoords3

DebugOptions​

Ƭ DebugOptions: Object

Type declaration​

NameType
asyncPeriod?number
containerId?string
dataClass?string
dataStyles?StyleDecl
entriesClass?string
entriesStyles?StyleDecl
lineClass?string
lineStyles?StyleDecl
newLineStyles?StyleDecl
onByDefault?boolean
showVoxelize?boolean
stats?boolean
statsStyles?StyleDecl

DeepPartial​

Ƭ DeepPartial<T>: { [P in keyof T]?: DeepPartial<T[P]> }

Type parameters​

Name
T

EntitiesOptions​

Ƭ EntitiesOptions: Object

Type declaration​

NameTypeDescription
offscreenRadiusOf?(entity: Entity) => number | undefined-
offscreenUpdateIntervalnumberFrames between updates of an entity outside the camera's view and farther than a few blocks from it, staggered across entities (1: every entity every frame). An entity whose motion and pose follow the clock (damping and springs by elapsed time, poses from the shader clock) only coarsens what nobody sees. A herd posed every frame behind the player was most of a crowded frame. Needs the camera passed to Entities.update.
physicsPhysicsEngine | nullThe physics engine to keep entities' replicated colliders in, usually world.physics: the boxes a server's CollidersComp gives an entity (its colliders metadata), placed at its replicated position for as long as it is in range, so the player stops at them as at blocks. Without one, colliders are ignored. Example ts const entities = new VOXELIZE.Entities({ physics: world.physics });
releasedTickRetentionSecondsnumberSeconds a released entity's tick watermark is kept so a late, out-of-order UPDATE for it cannot resurrect it. Reordering on the unordered lane is a matter of seconds; past this the watermark is dropped, which is what keeps the map from growing by one entry for every creature that ever streamed past the player.
stalenessTimeoutSecondsnumberSeconds an entity may go without any server message before it is considered lost and released. Covers dropped out-of-range and delete notifications so no entity can stay frozen forever.
streamSilenceGraceSecondsnumberSeconds of total message silence after which staleness releases are suspended, so reconnects and tab suspensions do not purge live entities.

EntityCollidersMetadata​

Ƭ EntityCollidersMetadata: [number, number, number, number, number, number][]

Solid boxes the server gives an entity (its CollidersComp), relative to its position: [minX, minY, minZ, maxX, maxY, maxZ] each.


EntityFaceShades​

Ƭ EntityFaceShades: readonly [number, number, number, number, number, number]


EntityFogUniforms​

Ƭ EntityFogUniforms: SkyFogInputs & { lightCones: LightConeUniforms }

The live world's atmosphere for entity materials: its sky fog, the camera's water, and the light cones. The same nodes the chunks read.


EntityLightSample​

Ƭ EntityLightSample: Object

What one whole-object light sample knows about the point it stands on. Every field is in the chunk shader's own units so the composition below can follow the fragment program line for line.

Type declaration​

NameTypeDescription
ambientColorColor-
ambientFloornumbermax(uMinLightLevel + uBaseAmbient, 0).
clusterBnumber-
clusterGnumber-
clusterRnumberClustered local-light irradiance at the point (queryLocalLights), before any diffuse response. Unbounded: a lit floor's proxy carries the intensity of several emitters.
downTransmitColorDownwelling transmittance of the water column above the point; white when dry. Scales every sun-path term exactly as downTransmit does.
floodBnumber-
floodGnumber-
floodRnumberFlood block light per channel, level / maxLightLevel, 0..1.
floodRemaindernumberFraction of the flood term this point keeps once analytic lights have claimed their share (blockLightFloodRemainder), 0..1. 1 with local lights off.
lightHue?readonly [number, number, number]Colour of the analytic lights around the point (LocalLightSample.lightHue): the flood borrows it for the channels it has run out of, like the chunk fragment. Absent or zero leaves the flood's own hue.
shadowFactornumberSun visibility along the sun ray: 1 in the open, 1 - shadowStrength when a voxel blocks it — the whole-object stand-in for getShadow().
sunColorColor-
sunExposurenumbersunlight / maxLightLevel, 0..1 — the shader's vLight.a.
sunlightIntensitynumber-
underwaterFillColorScattered surface light filling the water around the point; black when dry. Added to the sun path like underwaterFill.

EntityLightValue​

Ƭ EntityLightValue: Object

The light an entity material is drawn in: a colour the CPU samples at its owner (LightShined), changed in place. The material holds it (userData.entityLight) and its graph reads it per draw.

Type declaration​

NameType
valueColor

EntityLivenessOptions​

Ƭ EntityLivenessOptions: Object

Type declaration​

NameTypeDescription
stalenessTimeoutSecondsnumberSeconds an entity may go without any message before it is considered lost and released. The server keep-alive cadence is roughly one second, so this should comfortably exceed several missed keep-alives.
streamSilenceGraceSecondsnumberSeconds of total message silence after which staleness judgment is suspended. A quiet stream means the connection itself is degraded (disconnect, tab suspension), not that individual entities were lost.

EntityMetadata​

Ƭ EntityMetadata: Object

Type declaration​

NameType
colliders?EntityCollidersMetadata
rigidBody?EntityRigidBodyMetadata

EntityRigidBodyMetadata​

Ƭ EntityRigidBodyMetadata: Object

Type declaration​

NameType
fluidRationumber
isInFluidboolean

EntityShadowBody​

Ƭ EntityShadowBody: Object

What one body's shadow reads besides the world's lighting. Every material of the body holds the same record (setShadowBody), so one write reaches all its parts, and the parts of every body share one graph.

Type declaration​

NameTypeDescription
ignoresSelfnumber1: nothing inside selfBounds shades any face (a placed viewmodel).
minOccluderDepthnumberShadow-map depth an occluder must lie past to shade (0: any).
selfBoundsVector4The body's bounding sphere in world space (centre, radius): the slope bias that keeps a sun-averted face out of its own body's shadow never reaches past it. Radius 0: no bounds.
worldMatrixMatrix4From where the body is drawn to where it is shaded, plus worldOffset.
worldOffsetVector3-

EntityShadowBodyInputs​

Ƭ EntityShadowBodyInputs: Object

A body's inputs as a shader reads them.

Type declaration​

NameType
ignoresSelfFloatNode
minOccluderDepthFloatNode
selfBoundsVec4Node
worldMatrixMat4Node
worldOffsetVec3Node

EntityShadowShading​

Ƭ EntityShadowShading: ReturnType<typeof entityShadow>


EntityShadowUniforms​

Ƭ EntityShadowUniforms: ReturnType<typeof createEntityShadowUniforms>

The world's lighting as an entity's shadow reads it: the sun, the cascades and their maps. What belongs to one body (its bounds, where it is drawn from) is its EntityShadowBody.


EntitySurfaceOptions​

Ƭ EntitySurfaceOptions: Pick<InstancedSkinnedMaterialOptions, "useFaceUV" | "useVertexColor" | "atlasGridCols" | "atlasGridRows" | "partCount" | "emissiveFace">


Event​

Ƭ Event: Object

A Voxelize event from the server.

Type declaration​

NameTypeDescription
namestringThe name to identify the event.
payload?EventPayloadAdditional information of the event.

EventHandler​

Ƭ EventHandler<TPayload>: (payload: TPayload) => void

The handler for an event sent from the Voxelize server.

Type parameters​

NameType
TPayloadEventPayload

Type declaration​

▸ (payload): void

Parameters​
NameType
payloadTPayload
Returns​

void


EventPayload​

Ƭ EventPayload: JsonPrimitive | { [key: string]: EventPayload | undefined; } | EventPayload[]


FacePainter​

Ƭ FacePainter: (ctx: CanvasRenderingContext2D, face: number, width: number, height: number) => void

Type declaration​

▸ (ctx, face, width, height): void

Parameters​
NameType
ctxCanvasRenderingContext2D
facenumber
widthnumber
heightnumber
Returns​

void


FarBuiltTile​

Ƭ FarBuiltTile: Object

A tile's meshes, built off the main thread.

Type declaration​

NameType
buildMsnumber
landFarMeshData | null
skyFarMeshData | null

FarFaceLook​

Ƭ FarFaceLook: Object

What one block face looks like from far away: the mean of its texels in linear RGB, whether it takes a sample's regional tint (the face's stageTintMask), and the texels themselves (RGBA8 sRGB, size square, top row first) when the face has a texture.

Type declaration​

NameType
colorreadonly [number, number, number]
isTintedboolean
pixels?ArrayLike<number>
size?number

FarFaceSide​

Ƭ FarFaceSide: "top" | "side"


FarSeamShading​

Ƭ FarSeamShading: ReturnType<typeof farSeam>


FarTerrainBudget​

Ƭ FarTerrainBudget: Object

One client's request budget: a token bucket refilled by wall time.

Type declaration​

NameType
burstnumber
maxTilesPerRequestnumber
tilesPerSecondnumber

FarTerrainDescriptor​

Ƭ FarTerrainDescriptor: Object

What the server tells every client about its far terrain (INIT options).

Type declaration​

NameTypeDescription
baseStepnumberBlocks between samples at the finest level; each level doubles it.
budget?FarTerrainBudgetWhat one client may ask for: the server refuses the rest of a request past it, and a refused tile is asked again only after the retry window.
levelsnumberDetail levels the server serves, 1..4.
materials?FarTerrainMaterial[]What each material class is made of, indexed by a sample's class. Absent leaves the colours to the client's palette.
seabedMaterial?numberThe class of the sea floor, which shallow far water shows through.
skyMaterial?numberThe class floating land is painted with.
tileSamplesnumberSamples per tile side including the shared edge row (33 -> 32 cells).
trees?FarTerrainTree[]The tree species tiles' canopy samples name, by index.
waterSurfacenumberThe y of the far water plane.

FarTerrainMaterial​

Ƭ FarTerrainMaterial: Object

The blocks one material class is made of (registry block ids).

Type declaration​

NameTypeDescription
covers?{ block: number ; share: number }[]Blocks lying flat over part of the ground (snow, an outcrop), with the share of it each hides.
deep?numberThe block below the side block (rock under soil); side when absent.
sidenumberThe block under it: a wall shows top's side face on its highest block, this block's below for sideDepth blocks, and deep under that.
sideDepth?numberBlocks of side under the top block before deep; 3 when absent.
topnumberThe block whose upward face is the class's ground.

FarTerrainOptions​

Ƭ FarTerrainOptions: Object

Type declaration​

NameTypeDescription
budgetHeadroomnumberTiles of the server's budget (descriptor.budget) never spent, so a request that arrives sooner after the last than it was sent is not refused for the difference.
buildBudgetMsnumberMain-thread time one update may spend reading faces.
buildMesh(input: FarMeshInput) => Promise<FarBuiltTile | null> | nullBuilds a tile's meshes; the default hands it to a worker. A test, or a host without workers, passes its own.
castShadow(input: FarShadowInput) => Promise<{ buildMs: number ; lines: Uint16Array } | null> | nullCasts the sun shadow lines (far-terrain-shadow), as half floats; the default hands it to the mesh workers. A host that builds its own meshes gets no shadows unless it passes this too.
distancenumberHow far past the viewer the layer reaches, in blocks; 0 turns it off.
edgeBandnumberThe outer share of the reach across which the layer thins into the haze, reaching it at the reach, so its edge never cuts against the sky.
evictAfterMsnumberA tile no plan has drawn for this long leaves even under the cap: long enough that a trip away and back (a teleport home) finds the tiles it left still resident.
faceLook(block: number, side: FarFaceSide, stage: number) => FarFaceLook | null | nullWhat a block face looks like from afar, texels included (the world reads them off the atlas), or null while its texture is not painted yet. Used to paint the descriptor's materials.
faceLookTimeoutMsnumberHow long a face may stay unreadable before the layer paints it grey and says so, rather than never drawing.
fadeMsnumberHow long a tile takes to dissolve in or out when the detail changes.
lodFarLodOptionsHow the layer chooses each tile's level of detail.
maxBuildsInFlightnumberTile builds in flight at once.
maxResidentTilesnumberTiles kept resident at most; the least recently drawn leave first.
maxTilesPerRequestnumberTiles one request may name; the server caps it too.
paletteArrayLike<number>Linear RGB per class, flattened, for a server whose descriptor names no materials. A class past the end takes the last entry; an empty palette draws grey.
pendingGuardRadiusnumberChunk columns nearer the viewer's than this, in chunks, show sky and fog while still on their way, whatever tile could stand in: right by the viewer, a coarse tile shows through the walls of a canyon. Further out any drawn tile stands in. 0 lets one stand in everywhere. The default 1 guards only the viewer's own column: a wider guard opened holes of fog right ahead of anyone flying faster than chunks load.
requestIntervalMsnumberLeast time between two requests.
retryAfterMsnumberA requested tile that has not arrived in this long is asked again.
seamBandnumberBlocks of the loaded area's outer edge that hand over to the far layer across a dithered band, up to half a chunk; 0 (the default) keeps the edge hard (see WorldOptions.farTerrainSeamBand).
skySideColorColor | string | number-
skyTopColorColor | string | numberColour of floating land's top and of its underside and walls, when the descriptor names no skyMaterial.
waterColorColor | string | numberThe far water plane's colour.

FarTerrainSharedUniforms​

Ƭ FarTerrainSharedUniforms: SkyFogInputs & SurfaceWeatherUniforms & Pick<ChunkUniforms, "sunlightIntensity" | "minLightLevel" | "baseAmbient" | "faceShades" | "farCoverMask" | "farCover" | "farSeam"> & Pick<ShaderLightingUniforms, "sunDirection" | "sunColor" | "ambientColor" | "skyTopColor" | "skyMiddleColor" | "waterFresnelStrength" | "waterTint">

Everything the far layer reads from the world: the chunks' sky fog and daylight, their seam (written by the far layer), their weather, and the chunk water's sky and tint.


FarTerrainStats​

Ƭ FarTerrainStats: Object

Counters a harness can read to prove the budget.

Type declaration​

NameTypeDescription
batchPagesnumberPages of the batch the tile meshes are drawn from, one draw call each.
buildsInFlightnumberBuilds handed to the worker and not back yet.
bytesReceivednumber-
chunksHeldnumberLoaded chunks hidden while the far layer stands in for their unfinished meshes.
distancenumber-
faceLookMsnumber-
facesMissingnumber-
facesPendingnumber-
facesResolvednumberBlock faces read for the descriptor's materials, those still waiting for their texture, those painted grey because they never became readable, and the main-thread ms the reads took.
isActiveboolean-
lastBuildMsnumberWorker ms the last tile build took, and the highest since the peaks were reset.
lastShadowMsnumberWorker ms the last cast of the far sun shadows took.
lastUpdateMsnumberMain-thread ms the last update spent (planning, requests, mask).
lastUploadMsnumberMain-thread ms the last built tile took to become a mesh, and the highest.
levelCountsnumber[]Tiles drawn this frame at each level, finest first.
maskRebuildsnumberMask rebuilds.
meshBytesnumberBytes of vertex and index data across resident meshes.
meshesnumberTile meshes (land + sky) shown.
peakBuildMsnumber-
peakUpdateMsnumberHighest lastUpdateMs since the counters were last read.
peakUploadMsnumber-
pendingCoverednumberChunk columns inside the render radius the last mask covered because they were still on their way (not loaded yet), inside the guard radius or under no drawn tile: 0 once everything inside has landed.
pendingStoodInnumberChunk columns still on their way the last mask left to the far layer, under drawn tiles: the strip a flight brings inside the render radius, or the ground around a teleport's end, keeps the terrain it showed.
quadsFarMeshCountsQuads of the drawn land by what they are.
ringsnumberDetail levels drawn this frame.
tilesBuiltnumber-
tilesDrawnnumberTiles drawn this frame, and those the detail rules want.
tilesReceivednumber-
tilesRejectednumber-
tilesRequestednumber-
tilesResidentnumber-
tilesWantednumber-
totalUpdateMsnumberMain-thread ms spent across every update, and how many there were.
trianglesnumberTriangles across every built tile mesh in the scene.
updatesnumber-

FarTerrainTree​

Ƭ FarTerrainTree: Object

A tree species: the block its crown is made of and the log it stands on, and the stage its crown's leaves mostly hold (absent: 0), which picks the look they wear where the block has stage faces.

Type declaration​

NameType
leavesnumber
leavesStage?number
lognumber

FarTileData​

Ƭ FarTileData: Object

One decoded tile. Samples are row-major by z then x.

Type declaration​

NameTypeDescription
bytesnumberBytes of the reply payload, for the wire budget.
canopyUint8Array | nullThe tree crowns over each sample's cell as (top, bottom, cover, kind): top and underside in blocks above the surface, the share of the cell covered (255 all), and the species index with bit 7 on the cell its trunk stands in; or null for none.
colorsUint8ArrayMaterial class per sample.
heightsUint16ArrayTop face y per sample.
keyFarTileKey-
sizenumberSamples per side.
skyUint16Array | null(top, bottom) per sample of floating land, 0 where none; or null.
stepnumberBlocks between samples.
tintsUint8Array | nullRGB tint per sample for the faces that take one, 128 meaning unchanged (a chunk's biomeTints encoding); or null for none.

FarTileKey​

Ƭ FarTileKey: Object

Type declaration​

NameType
levelnumber
txnumber
tznumber

FindSimilarOptions​

Ƭ FindSimilarOptions: Object

Type declaration​

NameType
maxSuggestions?number

FloatNode​

Ƭ FloatNode: Node<"float">

Typed TSL node aliases, so shading signatures read like the GLSL they replace.


FluidQuery​

Ƭ FluidQuery: (vx: number, vy: number, vz: number) => boolean

Type declaration​

▸ (vx, vy, vz): boolean

Parameters​
NameType
vxnumber
vynumber
vznumber
Returns​

boolean


FormatSuggestionOptions​

Ƭ FormatSuggestionOptions: Object

Type declaration​

NameType
maxFallbackItems?number

GroundHeightSampler​

Ƭ GroundHeightSampler: (x: number, y: number, z: number) => number | null

Type declaration​

▸ (x, y, z): number | null

Parameters​
NameType
xnumber
ynumber
znumber
Returns​

number | null


HeadLedBodyOptions​

Ƭ HeadLedBodyOptions: Object

How far a look may stray from the body before the body turns, how fast it turns, and how close to the look a standing body settles.

Type declaration​

NameTypeDescription
reachnumberRadians the look may sit off the body before a standing body turns.
settlenumberRadians off the look a standing body's turn ends at.
turnRatenumberRadians per second a standing body turns to catch its look up.

HeadOptions​

Ƭ HeadOptions: ColorCanvasBoxOptions & { faceColor: Color | string ; neckGap?: number }


HeapReader​

Ƭ HeapReader: () => HeapSample | null

Reads the current heap, or returns null when the engine exposes no heap numbers at all (every non-Chromium browser).

Type declaration​

▸ (): HeapSample | null

Returns​

HeapSample | null


HeapSample​

Ƭ HeapSample: Object

A single reading of the renderer's JavaScript heap.

Type declaration​

NameType
limitBytesnumber
usedBytesnumber

HiddenTabTicker​

Ƭ HiddenTabTicker: (onTick: () => void, intervalMs: number) => () => void

Type declaration​

▸ (onTick, intervalMs): () => void

Parameters​
NameType
onTick() => void
intervalMsnumber
Returns​

fn

▸ (): void

Returns​

void


HitFlashProfile​

Ƭ HitFlashProfile: Object

A flash's timing and strength.

Type declaration​

NameType
fadeMsnumber
holdMsnumber
peaknumber
popAmountnumber
popMsnumber

IVec2Node​

Ƭ IVec2Node: Node<"ivec2">


IVec3Node​

Ƭ IVec3Node: Node<"ivec3">


ImageResolver​

Ƭ ImageResolver: (name: string) => string

Type declaration​

▸ (name): string

Parameters​
NameType
namestring
Returns​

string


InputOccasion​

Ƭ InputOccasion: "keydown" | "keypress" | "keyup"

The occasion that the input should be fired.


InputSpecifics​

Ƭ InputSpecifics: Object

The specific options of the key to listen to.

Type declaration​

NameTypeDescription
checkType?"key" | "code"The type of key to check for. Defaults to key.
identifier?stringA special identifier to tag this input with. This is useful for removing specific inputs from the input listener later on.
occasion?InputOccasionThe occasion that the input should be fired. Defaults to keydown.

InstanceAttribute​

Ƭ InstanceAttribute: THREE.BufferAttribute | THREE.InterleavedBufferAttribute

A per-instance attribute: its own buffer, or a view into a packed one.


IntNode​

Ƭ IntNode: Node<"int">


IsolatedFaceEntry​

Ƭ IsolatedFaceEntry<TMaterial>: Object

Type parameters​

Name
TMaterial

Type declaration​

NameType
blockIdnumber
createdAtnumber
faceNamestring
materialTMaterial
stateSurfaceState
voxelCoords3

ItemRendererFactory​

Ƭ ItemRendererFactory: (itemDef: ItemDef, world: World) => ItemRenderer

Type declaration​

▸ (itemDef, world): ItemRenderer

Parameters​
NameType
itemDefItemDef
worldWorld
Returns​

ItemRenderer


ItemSlotsOptions​

Ƭ ItemSlotsOptions: Object

Type declaration​

NameType
activatedByDefaultboolean
focusFirstByDefaultboolean
horizontalCountnumber
perspectiveCameraPerspective
scrollable?boolean
slotClassstring
slotFocusClassstring
slotGapnumber
slotHeightnumber
slotHoverClassstring
slotMarginnumber
slotPaddingnumber
slotStylesPartial<CSSStyleDeclaration>
slotSubscriptClassstring
slotSubscriptStylesPartial<CSSStyleDeclaration>
slotWidthnumber
verticalCountnumber
wrapperClassstring
wrapperPaddingnumber
wrapperStylesPartial<CSSStyleDeclaration>
zoomnumber

LazyWorkKind​

Ƭ LazyWorkKind: string


LegOptions​

Ƭ LegOptions: ColorCanvasBoxOptions & { betweenLegsGap?: number }

Parameters to create the legs of a character. Defaults to:

{
gap: 0.1 * CHARACTER_SCALE,
layers: 1,
side: THREE.DoubleSide,
width: 0.25 * CHARACTER_SCALE,
widthSegments: 3,
height: 0.25 * CHARACTER_SCALE,
heightSegments: 3,
depth: 0.25 * CHARACTER_SCALE,
depthSegments: 3,
betweenLegsGap: 0.2 * CHARACTER_SCALE,
}

where CHARACTER_SCALE is 0.9.


LightBatch​

Ƭ LightBatch: Object

Type declaration​

NameTypeDescription
batchIdnumber-
completedJobsnumber-
jobsLightJob[]-
pendingDispatchLightJobGroup[]Jobs of this batch that have not been handed to a worker yet, grouped by the chunk snapshot they share. Dispatch copies every chunk a group's light can reach, so groups wait here as cheap descriptors instead of as multi-megabyte copies.
resultsLightBatchResult[]-
totalJobsnumber-

LightBatchResult​

Ƭ LightBatchResult: Object

Type declaration​

NameType
borderNeighborsLightWorkerBorderNeighbor[]
boundingBoxBoundingBox
colorLightColor
modifiedChunksLightWorkerModifiedChunk[]

LightColor​

Ƭ LightColor: "RED" | "GREEN" | "BLUE" | "SUNLIGHT"

Sunlight or the color of torch light.


LightConeAuditEntry​

Ƭ LightConeAuditEntry: Object

Type declaration​

NameTypeDescription
materialstring-
pathstringNames from the scene root down to the mesh.

LightConeInput​

Ƭ LightConeInput: Object

Type declaration​

NameTypeDescription
angleDegnumberFull outer cone angle in degrees.
colorColor-
directionVector3-
innerRationumberInner (full-brightness) cone angle as a fraction of the outer angle.
intensitynumber-
originVector3-
rangenumber-
scatterStrengthnumber-
submersionnumber0 above water to 1 submerged; drives extinction and beam glow.

LightConeShading​

Ƭ LightConeShading: ReturnType<typeof lightConeShading>


LightConeUniforms​

Ƭ LightConeUniforms: ReturnType<typeof createLightConeUniforms>

The live cones, packed four vec4 per cone so they bind as one buffer: (origin.xyz, submersion), (direction.xyz, 0), (colour x intensity, 0), (cosOuter, 1 / (cosInner - cosOuter), range, scatterStrength).


LightHandle​

Ƭ LightHandle: number

Stable identity of a registered local light. Packed index:20 | generation:12; 0 is the invalid handle. Handles are plain numbers: storable, comparable, and allocation-free.


LightJob​

Ƭ LightJob: Object

Type declaration​

NameType
batchIdnumber
boundingBoxBoundingBox
colorLightColor
jobIdstring
lightOps{ floods: LightNode[] ; pendingRemovals?: LightNode[] ; removals: Coords3[] }
lightOps.floodsLightNode[]
lightOps.pendingRemovals?LightNode[]
lightOps.removalsCoords3[]
retryCountnumber

LightJobGroup​

Ƭ LightJobGroup: Object

The jobs of one batch that read the same chunks, sent to one worker over one snapshot.

A batch builds a job per colour, and an edit's four colours cover almost the same box: sent apart, each carried its own copy of every chunk in it, so a fire spreading through a forest copied the same sixty chunks four times a batch. The worker runs a group's jobs one after another on the one copy; a chunk's light word holds all four channels and each job's result is merged through its own colour mask, so they do not disturb each other.

Type declaration​

NameTypeDescription
jobsLightJob[]-
maxChunkCoords2-
minChunkCoords2The chunk rectangle the snapshot is laid out on, inclusive.
reachableboolean[]For each cell of the rectangle (x major, z minor, the order the snapshot is sent in), whether any seed's light can reach that chunk. Light travels at most maxLightLevel columns sideways from where it starts — the same bound a job's box is built from — so a chunk further than that from every seed is sent as absent, and the worker's floods stop at it. A box grown around seeds along a diagonal or a ring is mostly such chunks.
reachableCountnumber-

LightNode​

Ƭ LightNode: Object

Type declaration​

NameType
levelnumber
voxelCoords3

LightOperations​

Ƭ LightOperations: Object

Type declaration​

NameType
floods{ blue: LightNode[] ; green: LightNode[] ; red: LightNode[] ; sunlight: LightNode[] }
floods.blueLightNode[]
floods.greenLightNode[]
floods.redLightNode[]
floods.sunlightLightNode[]
hasOperationsboolean
removals{ blue: Coords3[] ; green: Coords3[] ; red: Coords3[] ; sunlight: Coords3[] }
removals.blueCoords3[]
removals.greenCoords3[]
removals.redCoords3[]
removals.sunlightCoords3[]

LightQualityTier​

Ƭ LightQualityTier: "ultra" | "high" | "medium" | "low" | "potato" | "off"

off is the user-facing disable: exactly the legacy flood-lit frame plus emissive faces. potato is the identical-looking low-end fallback tier — same rendering, kept separate so a device auto-downgrade and an explicit user setting remain distinguishable.


LightShadowPolicy​

Ƭ LightShadowPolicy: "none" | "voxelMask" | "shadowMap"


LightShape​

Ƭ LightShape: "point" | "spot" | "capsule"


LightShinedOptions​

Ƭ LightShinedOptions: Object

Type declaration​

NameTypeDescription
lerpFactornumberThe lerping factor of the brightness of each mesh. Defaults to 0.1.
maxBrightnessnumberCap on the composed light multiplier, applied after tone mapping. The composition already runs through the chunk shader's ACES curve, which tops out near 1.03, so this only trims that asymptote: the materials under this effect are unlit and untonemapped, and any multiplier past 1 pushes their texture toward white. Defaults to 1.
resampleDistancenumberMovement in blocks past which an object is resampled immediately instead of waiting out its interval: light data is voxel-grained, so a fast mover can cross into differently-lit voxels between scheduled samples. Defaults to 0.5.
sampleIntervalFramesnumberFrames between fresh light samples for a stationary object. Each sample pays a sun raycast, a water-column walk, and a local-light query, while the sampled color is only ever consumed through the per-frame lerpFactor smoothing — a filter whose settling time is already several frames long, so a stationary object cannot display the difference between "sampled every frame" and "sampled every few frames". Objects are phase-staggered so the samples spread across frames instead of bunching. Defaults to 4.
skipDetachedbooleanSkip a registered object whose ancestors do not end in a Scene. The entity manager releases an entity by detaching its root, so an object lit below that root (a character inside its entity) keeps a parent and would otherwise be traversed, resampled and lerped every frame although nothing draws it. Registering and removing in pairs is still the rule; this only bounds the cost of a missed remove. Needs every lit object to live under a real Scene (the world, an overlay scene), so it is off by default. Defaults to false.

LightWorkerBorderNeighbor​

Ƭ LightWorkerBorderNeighbor: Object

Type declaration​

NameType
coordsCoords2
maxYnumber
minYnumber

LightWorkerModifiedChunk​

Ƭ LightWorkerModifiedChunk: Object

Type declaration​

NameType
coordsCoords2
lightsUint32Array
maxYnumber
minYnumber

LightWorkerResult​

Ƭ LightWorkerResult: Object

Type declaration​

NameTypeDescription
borderNeighborsLightWorkerBorderNeighbor[]Chunks the job did not write light into but whose meshes read a voxel it did: a light set in a chunk's border column shades the faces of the chunk next door (and the diagonal one at a corner). They carry no lights to merge — only the y-range to remesh.
jobIdstring-
modifiedChunksLightWorkerModifiedChunk[]-
pendingFloods?LightNode[]Set when the worker hit its node budget mid-flood (e.g. a long open sunlight shaft under a floating island) and deferred the rest of the BFS rather than dropping it. The caller resubmits these as a follow-up job on the same bounding box so the region ends up fully lit instead of permanently partial.
pendingRemovals?LightNode[]-

LoadPhaseDrainScheduling​

Ƭ LoadPhaseDrainScheduling: "task" | "frame"


LoadPhaseTaskPriority​

Ƭ LoadPhaseTaskPriority: "background" | "user-visible"


LocalLightAirlightOptions​

Ƭ LocalLightAirlightOptions: Object

Type declaration​

NameTypeDescription
coreRationumberRadius of a light's scattering core, as a fraction of its range: the glow is a broad haze thickening toward the source, never a hot point.
dimmerMsnumberTime constant of the daylight/submersion dimmer, in ms.
fadeMsnumberFade in and out of the set, in ms (the grid's slot fade).
fillCoreScalenumberRoom fill core, as a multiple of the air core.
fillFloodMasknumber1: room fill lands only where the fragment's own flood reaches, so it never passes a wall; 0: unmasked (reaches past the flood, and leaks).
fillRangeScalenumberRoom fill reaches this multiple of a light's range.
fillStrengthnumberRoom fill: share of a light's energy bounced onto unlit surfaces.
hysteresisnumberAn incumbent's score multiplier against challengers.
lightsPerTierRecord<LightQualityTier, number>Steady lights in the set, per quality tier (0 turns the layer off).
maxAddednumberSoft ceiling on the linear light the air adds to a pixel.
openSkySharenumberShare of the air glow kept under open sky at night.
strengthnumberIn-scatter per block of air along a view ray.
visibilityIntervalMsnumberOne set member's line of sight is re-tested every this many ms.
visibilityTolerancenumberA line-of-sight hit this close to a light (blocks) still counts as seeing it; the hit block holding the light always does. Kept under half a block: a light one wall away (a lamp in the next room) is hidden, however near the wall stands to it.

LocalLightInputs​

Ƭ LocalLightInputs: Object

Type declaration​

NameType
airLocalLightAirlight["uniforms"]
gridLightClusterGrid["uniforms"]
shadow{ atlas: TextureInput ; params: Vec4Node & { value: unknown } ; params2: Vec4Node & { value: unknown } }
shadow.atlasTextureInput
shadow.paramsVec4Node & { value: unknown }
shadow.params2Vec4Node & { value: unknown }

LocalLightShading​

Ƭ LocalLightShading: ReturnType<typeof localLightShading>


LoneCubeCorner​

Ƭ LoneCubeCorner: Object

Type declaration​

NameType
aonumber
lightnumber

LoneCubeNeighborhood​

Ƭ LoneCubeNeighborhood: Object

The cells round the cube, by offset from it. The cube's own cell is the cube: opaque and unlit, whatever the world holds there while it moves.

Type declaration​

NameType
isOpaque(dx: number, dy: number, dz: number) => boolean
isWet(dx: number, dy: number, dz: number) => boolean
lights(dx: number, dy: number, dz: number) => readonly [number, number, number, number]

Mat3Node​

Ƭ Mat3Node: Node<"mat3">


Mat4Node​

Ƭ Mat4Node: Node<"mat4">


MemoryPressureOptions​

Ƭ MemoryPressureOptions: Object

Type declaration​

NameTypeDescription
recoveryHeapRationumberRatio at or below which pressure is considered relieved. Kept under MemoryPressureOptions.sheddingHeapRatio so the monitor has hysteresis instead of flapping around a single threshold.
sampleIntervalMsnumberMilliseconds between heap samples. Zero or less disables the watchdog.
shedCooldownMsnumberMinimum milliseconds between two shed actions while pressure persists.
sheddingHeapRationumberusedJSHeapSize / jsHeapSizeLimit at or above which the renderer is treated as under pressure and load shedding begins. A worker that runs out of V8 heap takes the whole renderer process down with it, so this sits well below the limit rather than near it.
sheddingSampleCountnumberConsecutive over-threshold samples required before shedding engages, so one transient spike (a large chunk batch mid-flight) does not throw away work that was about to be collected anyway.

MemoryPressureStatus​

Ƭ MemoryPressureStatus: Object

Type declaration​

NameTypeDescription
heapLimitBytesnumber-
heapRationumber-
heapUsedBytesnumber-
isHeapReadablebooleanFalse on engines that expose no heap numbers; the monitor stays inert.
isUnderPressureboolean-
shedCountnumber-

MemoryPressureVerdict​

Ƭ MemoryPressureVerdict: "steady" | "shed" | "relieved"

What a sample concluded: shed asks the owner to drop load now, relieved says pressure is over, steady means do nothing.


MeshApplyStats​

Ƭ MeshApplyStats: Object

Cumulative cost of turning finished mesh results into live scene geometry (buildChunkMesh), the main-thread half of every remesh. bytes counts the geometry attribute payload applied, which is what the GPU upload scales with. Cumulative since world init so a caller can difference two reads.

Type declaration​

NameType
bytesnumber
countnumber
maxMsnumber
totalMsnumber

MeshResultType​

Ƭ MeshResultType: Object

Type declaration​

NameType
indicesFloat32Array
normalsFloat32Array
positionsFloat32Array

MeshTransferBenchmarkIteration​

Ƭ MeshTransferBenchmarkIteration: Object

Type declaration​

NameType
inputBytesnumber
outputBytesnumber
serializeMsnumber
totalMsnumber
workerMsnumber

MeshTransferBenchmarkModeResult​

Ƭ MeshTransferBenchmarkModeResult: Object

Type declaration​

NameType
avgSerializeMsnumber
avgTotalMsnumber
avgWorkerMsnumber
isSharedArrayBufferAvailableboolean
iterationsMeshTransferBenchmarkIteration[]
measuredIterationsnumber
p50TotalMsnumber
p95TotalMsnumber
strategyWorkerTransferStrategy
totalInputBytesnumber
totalOutputBytesnumber
warmupIterationsnumber

MeshTransferBenchmarkOptions​

Ƭ MeshTransferBenchmarkOptions: Object

Type declaration​

NameType
cxnumber
cznumber
level?number
measuredIterations?number
warmupIterations?number

MeshTransferBenchmarkResult​

Ƭ MeshTransferBenchmarkResult: Object

Type declaration​

NameType
cxnumber
cznumber
levelnumber
serializeSpeedupnumber
sharedMeshTransferBenchmarkModeResult
speedupnumber
transferMeshTransferBenchmarkModeResult

MeshTransferDispatch​

Ƭ MeshTransferDispatch: (cx: number, cz: number, level: number) => Promise<{ geometries: object[] ; inputBytes: number ; outputBytes: number ; serializeMs: number ; workerMs: number } | null>

Type declaration​

▸ (cx, cz, level): Promise<{ geometries: object[] ; inputBytes: number ; outputBytes: number ; serializeMs: number ; workerMs: number } | null>

Parameters​
NameType
cxnumber
cznumber
levelnumber
Returns​

Promise<{ geometries: object[] ; inputBytes: number ; outputBytes: number ; serializeMs: number ; workerMs: number } | null>


MeshWorkerTransferSample​

Ƭ MeshWorkerTransferSample: Object

Type declaration​

NameType
atnumber
inputBytesnumber
outputBytesnumber
serializeMsnumber
strategyWorkerTransferStrategy
totalMsnumber
workerMsnumber

MeshWorkerTransferStats​

Ƭ MeshWorkerTransferStats: Object

Type declaration​

NameType
jobCountnumber
recentSamplesMeshWorkerTransferSample[]
strategyWorkerTransferStrategy
totalInputBytesnumber
totalOutputBytesnumber
totalSerializeMsnumber
totalWorkerMsnumber

MethodOutcome​

Ƭ MethodOutcome: { kind: "ran" } | { handledBy: string[] | null ; kind: "unhandled" ; world: string } | { kind: "rejected" ; reason: string ; world: string } | { kind: "unanswered" ; waitedMs: number }

What the server did with one call, as Method.confirm found out.

  • ran: a handler ran it and did not turn it down. Whatever the handler does later (a spawn, a remesh) is not covered.
  • unhandled: the world has no handler under that name. handledBy lists the worlds on the same server that do, or is null when the server keeps no index of them.
  • rejected: the world's guard refused it, or its handler turned it down or panicked; reason says which and why.
  • unanswered: the server did not answer within the wait (a dropped socket, a stalled world). The call may or may not have run.

NameTagDistance​

Ƭ NameTagDistance: Object

How a name tag behaves with distance from the camera, in world units.

Type declaration​

NameTypeDescription
fadeEndnumberBy this distance the tag has faded out completely, and past it the tag is not drawn at all, so a crowd of far tags costs no draw calls. Infinity keeps the tag at every distance.
fadeStartnumberUp to this distance the tag shows at full opacity.
seeThroughDistancenumberWithin this distance the tag draws over everything, so it stays readable through thin cover and never flickers behind it. Past it the tag is depth tested like the world around it, so terrain between the camera and a far tag hides it instead of letting it show through. Infinity never depth tests.

NameTagOptions​

Ƭ NameTagOptions: Partial<NameTagDistance> & { backgroundColor?: string ; color?: string ; fontFace?: string ; fontSize?: number ; yOffset?: number }

Parameters to create a name tag.


NamedSkinnedPart​

Ƭ NamedSkinnedPart<TBone>: Omit<SkinnedPart, "bone"> & { bone: TBone }

A SkinnedPart whose bone is named instead of numbered.

Type parameters​

NameType
TBoneextends string

NetworkConnectionOptions​

Ƭ NetworkConnectionOptions: Object

Type declaration​

NameTypeDescription
getTicket?() => Promise<string | null>-
reconnectTimeout?numberMilliseconds between reconnection attempts after the socket drops. Defaults to DEFAULT_RECONNECT_TIMEOUT_MS; pass 0 to disable automatic reconnection.
secret?string-
ticket?string | nullSigned session ticket proving who this client is (id, name, role, ...). Sent as ?ticket= on the socket upgrade and in the WebRTC offer. A server with session authentication derives the client id from it and ignores client_id; without one the client is admitted only where the server trusts client-chosen ids.
useWebRTC?boolean-

NetworkOptions​

Ƭ NetworkOptions: Object

Type declaration​

NameTypeDescription
cacheRegistrybooleanKeep the server's block registry (the bulk of every INIT) in Cache Storage or IndexedDB between joins and page loads. A JOIN then names the registry kept and the server leaves it out of the INIT while it still matches; see ./registry-cache. Servers that do not know the handshake ignore it, and a client without a kept registry gets the full INIT.
decodeJobTimeoutMsnumberMilliseconds one decode job may take before its worker is presumed dead or hung. A worker the renderer kills (out of memory, most often) dies without an error event, and its job would never settle: the page stayed connected and joined while every packet after it waited forever. Past this the worker is replaced and the job's packets are decoded again. Must be positive: decoded messages are delivered in the order their packets arrived, so a job that never settled would hold back every message behind it.
joinAnswerTimeoutnumberMilliseconds a join request handed to an open socket may go unanswered before it is sent again, loudly. The server answers every such request with an INIT, an ERROR or a close, and a repeated JOIN makes it replay the whole INIT, which the page then applies a second time. A loaded server can take well over NetworkOptions.joinRetryTimeout to answer, so this one only bounds a server that never does.
joinRetryTimeoutnumberMilliseconds a (re)join handshake may await its INIT before a join request that never reached an open socket is sent again.
maxBacklogFactornumber-
maxDecodeAttemptsnumberTimes one job's packets are decoded before they are given up on, loudly. Bounds a packet that kills or hangs every worker it is handed to.
maxDecodeWorkersnumberDecode workers to run, at most one per core. Every worker is a V8 isolate, and every isolate in a renderer (the page and all of its workers) draws its heap from one shared pointer-compression cage of about 4 GB, whatever heap limit each isolate reports; the renderer dies when their sum reaches it. A decode worker that has been busy keeps tens of megabytes of young generation committed for good, and decoding (LZ4 and protobuf) is light enough that a few workers keep up with any stream, so one per core spent the shared budget for nothing.
maxPacketsPerDecodeJobnumberPackets one decode job carries. A tick's backlog goes to as few workers as this allows rather than being spread over all of them, so the workers a light stream does not need stay idle and small, and no single job's decoded messages can balloon a worker's heap. What a tick does not hand out waits in the packet queue as raw buffers, outside the V8 heap.
maxPacketsPerTicknumber-
maxPendingCommandPacketsnumberUpper bound on command packets (see COMMAND_PACKET_TYPES) held for retry after a send raced a closing socket. Beyond it the oldest are dropped loudly and counted in Network.droppedCommandCount: bounded loss beats unbounded buffering, but a command must never vanish in silence.
maxQueuedPacketsnumberUpper bound on buffered inbound packets. Beyond it the oldest packets are dropped, loudly and counted in Network.droppedPacketCount: the interest/keep-alive protocol re-converges on fresh state, so bounded loss beats unbounded memory growth when processing stalls.
registryCacheWaitMsnumberMilliseconds an INIT that left the registry out may wait for the kept copy to finish loading from storage. The JOIN itself never waits: it names the registry storage says it keeps, and the read (started when the network is created, or with a later JOIN) has normally landed by the time the INIT does. Past this the client joins again, on a fresh socket and without a digest, and gets the full registry.

OrderIndependentSeparator​

Ƭ OrderIndependentSeparator: Object

A surface whose far side is only ever seen through it, the way water refracts what lies beyond it: per pixel, every blended fragment behind its nearest face (by depth) is composited into the scene first, so the surface can read it, and the face itself and everything in front of it accumulate afterwards. The surface needs no rule of its own: its nearest face lies at that depth, and any face of it farther back is behind it like anything else, so water seen through water is refracted too.

Type declaration​

NameTypeDescription
biasnumberHow far behind that face, in blocks, a fragment has to be to count as behind it.
depth() => Texture | null-

OrderIndependentSkipReason​

Ƭ OrderIndependentSkipReason: "canvas" | "no-depth-texture" | "multisampled" | "not-perspective" | "special-depth"

Why a render of the scene drew its blended layers in list order.


OrderIndependentStats​

Ƭ OrderIndependentStats: Object

Type declaration​

NameTypeDescription
adoptednumberMaterials found able to accumulate.
drawnAfterstring[]Blended materials that cannot accumulate and draw over the composite.
openednumberRenders that accumulated their blended layers.
skippedPartial<Record<OrderIndependentSkipReason, number>>Renders with the armed camera that could not, by reason.

OrderIndependentTransparencyOptions​

Ƭ OrderIndependentTransparencyOptions: Object

Order-independent transparency (weighted blended): every blended surface the world draws — glass, water, cutouts' translucent texels, particles, sprites, effects — accumulates into one target in any order and is composited once over the scene, so no draw order can paint one layer over another that is in front of it. See World.prepareTransparency.

Type declaration​

NameTypeDescription
solidTexelAlphanumberThe texel alpha at or above which a see-through block's texel is solid: it draws with the cutouts and writes depth instead of blending.
weightsOrderIndependentWeights-

OrderIndependentWeights​

Ƭ OrderIndependentWeights: Object

The depth weight of a blended fragment, by its distance from the camera in blocks: scale / (1 + d / nearDistance + (d / farDistance)⁶), clamped to [min, max]. Layers within nearDistance weigh about the same, and past it a layer twice as far weighs about half, so the alpha in the weight (more opaque layers count more) decides most of a mix, as compositing back to front would: a clear pane at the camera does not wash out the coloured glass behind it. Past farDistance the weight falls off fast; the clamp keeps the half-float sums in range.

Type declaration​

NameType
farDistancenumber
maxnumber
minnumber
nearDistancenumber
scalenumber

OverdueChunkRequest​

Ƭ OverdueChunkRequest: ChunkRequestHistory & { name: string }


ParsedRegistry​

Ƭ ParsedRegistry: Object

Type declaration​

NameType
blocksById[number, any][]
blocksByName[string, any][]
idMap[number, string][]
nameMap[string, number][]

PartialRecord​

Ƭ PartialRecord<K, T>: { [P in K]?: T }

Type parameters​

NameType
Kextends keyof any
TT

PeersOptions​

Ƭ PeersOptions: Object

Parameters to customize the peers manager.

Type declaration​

NameTypeDescription
autoAddToSelfboolean-
countSelfbooleanWhether or not should the client themselves be counted as "updated". In other words, whether or not should the update function be called on the client's own data. Defaults to false.
updateChildrenbooleanWhether or not should the peers manager automatically call update on any children mesh. Defaults to true.

PerspectiveOptions​

Ƭ PerspectiveOptions: Object

Parameters to create a new Perspective instance.

Type declaration​

NameTypeDescription
blockMarginnumberThe margin between the camera and any block that the camera is colliding with. This prevents the camera from clipping into blocks. Defaults to 0.3.
ignoreFluidsbooleanWhether or not should the camera ignore fluid block collisions. Defaults to true.
ignoreSeeThroughbooleanWhether or not should the camera ignore see-through block collisions. Defaults to true.
maxDistancenumberThe maximum distance the camera can go from the player's center. Defaults to 5.
swimDistanceBonusnumberExtra camera distance while swimming in second/third person. Defaults to 3.
zoomInLerpnumberPer-frame factor (at 60 fps) the camera closes toward a nearer obstruction. High, so a wall swinging in behind the player never shows the inside of a block. Defaults to 0.85.
zoomOutDelaynumberSeconds the view must stay clear before the camera starts easing back out. A gap in a fence or canopy shorter than this never moves the camera at all, so a row of posts behind the player reads as one obstruction rather than a pump per post. Defaults to 0.25.
zoomOutLerpnumberPer-frame factor (at 60 fps) the camera eases back out once an obstruction clears. Low on purpose: the voxel raycast behind the player flips between hit and miss in discrete steps as they walk past posts, trunks, and canopy gaps, and a symmetric fast lerp turned every flip into a visible zoom pump. Snapping in and gliding out merges those into one dip. Defaults to 0.12.

PortraitOptions​

Ƭ PortraitOptions: Object

Parameters to create a portrait with.

Type declaration​

NameTypeDescription
heightnumberThe height of the portrait canvas. Defaults to 100 pixels.
lightRotationOffsetnumberThe rotation around the y axis about the camera. This is used to calculate the position of the light. Defaults to -Math.PI / 8.
perspectiveCameraPerspectiveThe position of where the camera should be looking at. Defaults to pxyz, which means that the camera will be looking at the center of the object from the positive x, y, and z axis scaled by the zoom.
renderOncebooleanWhether or not should this portrait only render once. Defaults to false.
widthnumberThe width of the portrait canvas. Defaults to 100 pixels.
zoomnumberThe arbitrary zoom from the camera to the object. This is used to calculate the zoom of the camera. Defaults to 1.

ProcessedUpdate​

Ƭ ProcessedUpdate: Object

Type declaration​

NameType
newBlockBlock
newIdnumber
newRotationBlockRotation
oldBlockBlock
oldIdnumber
oldRotationBlockRotation
oldStagenumber
stagenumber
voxelCoords3

ProtocolWS​

Ƭ ProtocolWS: WebSocket & { sendEvent: (event: any) => boolean }


RegionArenaStats​

Ƭ RegionArenaStats: Object

Region arenas' regions, pages and sections, in all and per bucket.

Type declaration​

NameType
bucketsRecord<string, { pages: number ; regions: number ; sections: number }>
pagesnumber
regionsnumber
sectionsnumber

RelayedEventHandler​

Ƭ RelayedEventHandler<TPayload>: (payload: TPayload, meta: RelayedEventMeta) => void

Type parameters​

NameType
TPayloadEventPayload

Type declaration​

▸ (payload, meta): void

Parameters​
NameType
payloadTPayload
metaRelayedEventMeta
Returns​

void


RelayedEventMeta​

Ƭ RelayedEventMeta: Object

Who a relayed effect came from and where it happens, stamped by the server.

Type declaration​

NameTypeDescription
position?[number, number, number]-
senderIdstringThe sender's client id, set by the server: a payload cannot forge it.

RigidControlState​

Ƭ RigidControlState: Object

The state of which a Voxelize Controls is in.

Type declaration​

NameTypeDescription
crouchingbooleanWhether if the client is attempting to crouch, if the crouch key is pressed. Defaults to false.
currentJumpTimenumberSeconds left of the current jump's push, while its key is held. Defaults to 0.
headingnumberIn radians, the heading y-rotation of the client. Defaults to 0.
isJumpingbooleanWhether or not is the client jumping, in the air. Defaults to false.
jumpCountnumberHow many times has the client jumped. Defaults to 0.
jumpingbooleanWhether if the client is attempting to jump, if the jump key is pressed. Defaults to false.
runningbooleanWhether if the client is running. Defaults to false.
sprintingbooleanWhether if the client is attempting to sprint, if the sprint key is pressed. Defaults to false.

RigidControlsOptions​

Ƭ RigidControlsOptions: Object

Parameters to initialize the Voxelize Controls.

Type declaration​

NameTypeDescription
airJumpsnumberHow many times can a client jump in the air. Defaults to 0.
airMoveMultnumberThe factor applied to the movements of the client in air, such as while half-jump. Defaults to 0.7.
alwaysSprintbooleanSprint factor would be on always. Defaults to false.
autoJumpbooleanJump automatically at a ledge too tall to step onto but low enough for a jump to clear, the way voxel games with an auto-jump option do. The jump is a real one through the normal jump path, started ahead of the ledge so the feet pass its top on the way up instead of bumping the face first. Off while crouching, swimming, climbing, flying, or walking backwards. Defaults to true.
autoJumpCooldownnumberMilliseconds after an automatic jump before another may fire. Defaults to 100.
autoJumpFacingDotnumberCosine between the look direction and the travel direction below which auto-jump stays off, so walking backwards into a ledge never hops onto it blind. Pure strafing (cosine 0) still hops. Defaults to -0.15.
autoJumpLookaheadnumberSeconds of travel scanned ahead for a jumpable ledge. The jump fires as soon as a ledge enters this window, so it must exceed the time the jump takes to rise past the tallest auto-jumpable ledge (about 0.24 s for 1.2 blocks at the default impulse and gravity). Defaults to 0.3.
autoJumpMaxHeightnumberTallest rise auto-jump attempts, in blocks. Kept under what the jump actually clears (the apex from jumpImpulse against gravity, 1.29 at the defaults) so the landing has margin. Defaults to 1.2.
autoJumpMinLookaheadnumberMinimum scan distance in blocks, so a client standing against a ledge still hops the moment it starts walking into it. Defaults to 0.2.
bodyDepthnumberThe depth of the client's avatar. Defaults to 0.8 blocks.
bodyHeightnumberThe height of the client's avatar. Defaults to 1.55 blocks.
bodyWidthnumberThe width of the client's avatar. Defaults to 0.8 blocks.
crouchBodyHeightnumberThe height of the client's avatar when crouching. Defaults to bodyHeight * 0.83.
crouchFactornumberThe factor to the movement speed when crouch is applied. Defaults to 0.6.
eyeHeightnumberThe ratio to bodyHeight at which the camera is placed from the ground. Defaults at 0.9193548387096774.
fluidExitClearancenumberA body treading fluid with its head out that presses into a bank no taller than fluidExitMaxHeight over the surface climbs out: launched so its feet peak this far over the bank's top. 0 turns the climb off. Defaults to 0.3.
fluidExitMaxHeightnumberTallest bank, over a fluid's surface, a body treading it climbs out onto. Defaults to 1.2.
fluidPushForcenumberThe strongest upward impulse a held jump key gives in fluid: what one frame at referenceFrameRate may add, scaled by frame time at any other rate. Treading water spends it swimming up at the swim speed and holding the body at fluidTreadEyeHeight. Defaults to 0.3.
fluidTreadEyeHeightnumberHeight of the eyes over a fluid's surface where a body treading it, its jump key held, comes to rest. Defaults to 0.25.
flyClimbSpeedPenaltynumberFraction of fly speed lost at a straight-up climb when pitch steering is active, trading speed for altitude. Defaults to 0.
flyDiveSpeedBoostnumberExtra speed multiplier granted at a straight-down dive when pitch steering is active. 1.2 means a vertical dive flies at 2.2x the base fly speed. Scales quadratically with dive steepness. Defaults to 0.
flyForcenumberThe level of force at which a client flies at. Defaults to 80.
flyImpulsenumberThe vertical impulse a held fly-up or fly-down key gives: what one frame at referenceFrameRate adds, scaled by frame time at any other rate. Defaults to 2.5.
flyInertianumberThe inertia of a client when they're flying. Defaults to 6.
flyPitchSteeringnumberHow much the camera pitch steers fly movement, from 0 (movement stays horizontal) to 1 (movement follows the full look vector, elytra-style). Defaults to 0.
flySpeednumberThe level of speed at which a client flies at. Defaults to 40.
initialDirectionCoords3-
initialPositionCoords3Initial position of the client. Defaults to (0, 80, 10).
jumpForcenumberThe upward force a held jump key adds for the first jumpTime of a jump, so holding it lifts the jump a little higher than the impulse alone. Defaults to 3.5.
jumpImpulsenumberThe level of impulse at which the client jumps upwards. Defaults to 8.
jumpTimenumberHow long, in milliseconds, a held jump key keeps pushing (jumpForce) after the jump starts. Defaults to 50ms.
maxPolarAnglenumberMaximum polar angle that camera can look up to. Defaults to Math.PI * 0.99
maxSpeednumberThe maximum level of speed of a client. Default is 6 .
minPolarAnglenumberMinimum polar angle that camera can look down to. Defaults to Math.PI * 0.01.
moveForcenumberThe level of force of which the client can move at. Default is 30.
positionLerpnumberThe interpolation factor of the client's position. Defaults to 1.0.
referenceFrameRatenumberThe frame rate, in frames per second, that the per-frame tunables (flyImpulse, fluidPushForce, swimAABBLerp, the ladder's easing) were tuned at. Each frame applies them scaled by how many of these frames it lasted, so a held key climbs, swims or flies the same distance per second at any frame rate, and exactly as tuned at this one. Defaults to 120.
responsivenessnumberHow fast, per second, a client's velocity settles onto the one its input asks for, once it is close enough that the movement force no longer caps the change. Default is 240.
restoreFootSnapEpsilonnumber-
rotationLerpnumberThe interpolation factor of the client's rotation. Defaults to 0.9.
runningFrictionnumberDefault running friction of a client. Defaults to 0.1.
sensitivitynumberThe mouse sensitivity. Defaults to 100.
sprintFactornumberThe factor to the movement speed when sprint is applied. Defaults to 1.4.
standingFrictionnumberDefault standing friction of a client. Defaults to 4.
statusSpeedFactornumberServer-provided temporary effects; applies only to ordinary ground walking.
statusSwimFactornumberServer-provided temporary effects; applies only to swimming.
stepEyeClearancenumberHeight, in blocks, the eye always keeps above the top of a step it just climbed while it eases up after the body. Caps how far the eye may trail when a staircase stacks steps faster than they settle, so the camera never sinks into the tread it stands on. Defaults to 0.25.
stepGrazeRationumberAlong-face to into-face motion ratio above which contact with a ledge is a graze that slides along it rather than an approach that steps onto it. 4 ignores approaches shallower than ~14°, so brushing a block while walking past does not pop the client onto it. 0 steps on any blocked contact. Defaults to 4.
stepHeightnumberHow tall a client can step up. Defaults to 0.5.
stepSmoothTimenumberHow long, in milliseconds, the eye takes to close 95% of a one-block auto-step; smaller steps settle proportionally faster (a half slab in half the time). The body itself climbs the step in a single physics tick; this eases only the eye (and what follows it: the streamed position, the third-person character) up after it on a critically damped spring, so the rise is an S-curve with no pop and no overshoot at any frame rate. 0 snaps the eye with the body. Defaults to 250.
swimAABBLerpnumberLerp factor for the swim hitbox height transition, per frame at referenceFrameRate. Defaults to 0.08.
swimBodyHeightnumberCollision height while swimming. Defaults to 0.4.
swimForcenumberForce applied while swimming. Defaults to 28.
swimFrictionnumberFriction while swimming and moving. Defaults to 0.05.
swimIdleStandDelaynumberTime without swim movement input before returning to an upright pose. Defaults to 3000.
swimRestoreGraceFramesnumberFrames to keep the swim AABB after restoring a saved swimming session. Defaults to 2.
swimSpeednumberTarget speed while swimming. Defaults to 4.5.
swimSubmersionRationumberMinimum ratio of the body submerged before swimming mechanics activate. Defaults to 0.95.

RosterPool​

Ƭ RosterPool: THREE.Object3D & { dispose: () => void }


RosterUpdate​

Ƭ RosterUpdate: (deltaTime: number, renderer: THREE.Renderer) => void

Type declaration​

▸ (deltaTime, renderer): void

Parameters​
NameType
deltaTimenumber
rendererTHREE.Renderer
Returns​

void


ScalarInput​

Ƭ ScalarInput: UniformNode<number>


SectionExtentOptions​

Ƭ SectionExtentOptions: Object

Type declaration​

NameType
chunkSizenumber
maxHeightnumber
subChunksnumber

SectionVisibilityGraphOptions​

Ƭ SectionVisibilityGraphOptions: Object

Type declaration​

NameType
chunkSizenumber
maxHeightnumber
subChunksnumber

SerializedBlockRotation​

Ƭ SerializedBlockRotation: { [K in "PX" | "NX" | "PY" | "NY" | "PZ" | "NZ"]?: number }

The wire shape of a block rotation inside server-authored block rules: the Rust BlockRotation enum serializes as a single-key object mapping the axis to the y-rotation angle in radians, e.g. { "PX": 0 }.


SerializedRegistry​

Ƭ SerializedRegistry: string | SerializedRegistryPayload

The wire form of a registry: a JSON string (what serialize returns) or, for tests and in-process callers, the already-parsed payload.


SerializedRegistryPayload​

Ƭ SerializedRegistryPayload: Object

Type declaration​

NameType
blocksById[number, any][]
idMap[number, string][]
nameMap[string, number][]
versionnumber

ShaderLightingUniforms​

Ƭ ShaderLightingUniforms: ReturnType<typeof createShaderLightingUniforms>


ShadowInvalidationCause​

Ƭ ShadowInvalidationCause: "blockEdit" | "chunkMeshed" | "eviction" | "tierChange" | "manualRegion" | "lightMoved" | "lightRotated" | "incompleteDraw"


SkyFogInputs​

Ƭ SkyFogInputs: Pick<ChunkUniforms, "fogColor" | "fogNear" | "fogFar" | "fogHeightOrigin" | "fogHeightDensity" | "fogVerticalBlend" | "aerialHaze" | "skyFogTopColor" | "skyFogMiddleColor" | "skyFogBottomColor" | "skyFogOffset" | "skyFogVoidOffset" | "skyFogExponent" | "skyFogExponent2" | "skyFogDimension" | "skyFogStrength" | "skyGlowSunDirection" | "skyGlowColor" | "skySunHaloColor" | "skyMoonHaloColor" | "skySunDiscColor" | "skyMoonDiscColor" | "skyDiscRadii" | "skyMoonFace" | "cameraSubmersion" | "cameraWaterPlaneY" | "underwaterAmbient" | "underwaterViewScale"> & Pick<ShaderLightingUniforms, "directSunlight">

The inputs every fogged surface reads: the chunk set and the beam.


SkyFogShading​

Ƭ SkyFogShading: ReturnType<typeof skyFog>


SkyGlowInputs​

Ƭ SkyGlowInputs: Pick<SkyFogInputs, "skyGlowSunDirection" | "skyGlowColor" | "skySunHaloColor" | "skyMoonHaloColor" | "skySunDiscColor" | "skyMoonDiscColor" | "skyDiscRadii" | "skyMoonFace" | "directSunlight">

The sky's own light: its glow toward the sun and moon, and their discs.


SkyGlowUniforms​

Ƭ SkyGlowUniforms: Object

The sky's own light, drawn by the dome and by every fogged surface from one set of uniform nodes (skyGlow), so the haze in front of a sunset wears exactly the light of the sky behind it. Colours are linear and already scaled by their strength; all black, the default, adds nothing. The world keeps sunDirection on the drawn disc each frame (getSunDiscDirection); a host paints the colours.

Type declaration​

NameTypeDescription
colorUniformNode<"vec3", Color>The broad aura round the sun and the band along the horizon under it.
discRadiiUniformNode<"vec2", Vector2>The discs' angular radii in radians: x the sun, y the moon.
moonDiscColorUniformNode<"vec3", Color>-
moonFaceUniformNode<"vec3", Vector3>The moon's face as the fog carries it. xy is its phase: the direction of its light in the disc's own frame (moonPhaseLit), x across the terminator and y toward the eye. z is how many texels across the host draws the moon (moonTexelFace), 0 for a smooth disc. (0, 1, 0), the default, is a smooth full moon; a host with neither never touches it.
moonHaloColorUniformNode<"vec3", Color>The halo round the moon's disc.
sunDirectionUniformNode<"vec3", Vector3>Toward the sun's disc, never clamped or tilted; the moon is opposite.
sunDiscColorUniformNode<"vec3", Color>The discs as the host draws them in the sky (colour times how much of it shows), for the fog to carry: terrain hides the drawn disc by depth even where its haze has made it the sky's own colour.
sunHaloColorUniformNode<"vec3", Color>The halo the haze scatters round the sun's disc.

SkyOptions​

Ƭ SkyOptions: Object

Type declaration​

NameTypeDescription
dimensionnumberThe dimension of the dodecahedron sky. The inner canvas box is 0.8 times this dimension.
lerpFactornumberThe lerp factor for the sky gradient. The sky gradient is updated every frame by lerping the current color to the target color. set by the setTopColor, setMiddleColor, and setBottomColor methods.
textureBloomIntensitynumberThe emissive boost applied to painted sky texels above textureBloomThreshold. Defaults to 2.0.
textureBloomThresholdnumberThe luminance at which painted sky textures begin to feed bloom. Defaults to 0.72.
transitionSpannumber-

SkyShadingCycleData​

Ƭ SkyShadingCycleData: Object

Type declaration​

NameType
color{ bottom: Color | string ; middle: Color | string ; top: Color | string }
color.bottomColor | string
color.middleColor | string
color.topColor | string
namestring
skyOffsetnumber
startnumber
voidOffsetnumber

SlotContent​

Ƭ SlotContent: { type: "empty" } | { count: number ; id: number ; type: "block" } | { count: number ; data?: Record<string, unknown> ; id: number ; type: "item" }


SoundEffectEventHandler​

Ƭ SoundEffectEventHandler: (payload: SoundEffectEventPayload) => void

Type declaration​

▸ (payload): void

Parameters​
NameType
payloadSoundEffectEventPayload
Returns​

void


SoundEffectEventPayload​

Ƭ SoundEffectEventPayload: Object

Type declaration​

NameType
idstring
pitch?number
position?[number, number, number]
radius?number
sourceClientId?string
volume?number

SunShadowOptions​

Ƭ SunShadowOptions: Object

Type declaration​

NameTypeDescription
isFastbooleanThe 5-tap cross in the near cascades too, for surfaces whose own motion or layering swallows soft shadow detail (water, panes, leaves).

SurfaceKind​

Ƭ SurfaceKind: "atlas-slot" | "own-face" | "isolated-face"


SurfaceState​

Ƭ SurfaceState: "unknown" | "default" | "fallback" | "painted"

  • unknown: the checker.
  • default: an isolated face wearing its face's default art while it waits for the voxel's own paint (blank paper, an empty frame).
  • fallback: painted by World.fillUnpaintedSurfaces, not by its own texture.
  • painted: its own art.

SurfaceTally​

Ƭ SurfaceTally: Object

Type declaration​

NameType
defaultnumber
fallbacknumber
paintednumber
totalnumber
unknownnumber

SurfaceWeatherShading​

Ƭ SurfaceWeatherShading: ReturnType<typeof surfaceWeather>


SurfaceWeatherUniforms​

Ƭ SurfaceWeatherUniforms: ReturnType<typeof createSurfaceWeatherUniforms>


TabCompleteContext​

Ƭ TabCompleteContext: Object

Options for adding a command.

Type declaration​

NameType
argsRecord<string, string>

TargetType​

Ƭ TargetType: "All" | "Player" | "Entity"


TexelAlphaCuts​

Ƭ TexelAlphaCuts: Object

The two alphas that sort a texel into a hole, a tint or a solid.

Type declaration​

NameTypeDescription
holenumberBelow this a texel is a hole: the see-through materials' alpha test.
solidnumberAt or above this a texel is solid.

TexelClasses​

Ƭ TexelClasses: Object

Which kinds of texel a see-through surface's textures hold.

Type declaration​

NameTypeDescription
solidbooleanTexels at or above the solid alpha: they hide what is behind them.
translucentbooleanTexels between the hole and solid alphas: they tint what is behind.

TexelForks​

Ƭ TexelForks: Object

Type declaration​

NameType
solidMaterial
translucentMaterial

TexelPlan​

Ƭ TexelPlan: "as-is" | "solid" | "translucent" | "split"

How a see-through mesh draws its texels when blended layers do not depend on draw order:

  • as-is: its material already draws every texel the right way: a cutout with no translucent texels writes depth for all of them, a blended surface with no solid ones blends all of them.
  • solid: a blended surface whose texels are all solid draws as a cutout.
  • translucent: a cutout whose kept texels are all translucent blends.
  • split: solid texels draw with depth, translucent ones blend, from the same buffers in two draws.

TextureCensus​

Ƭ TextureCensus: Object

Type declaration​

NameTypeDescription
atlasSlotsSurfaceTally-
isolatedFacesSurfaceTally-
ownFacesSurfaceTally-
unpaintedUnpaintedSurface[]Every surface not wearing its own art, worst first.

TextureFillResult​

Ƭ TextureFillResult: Object

Type declaration​

NameType
colorstring
filled{ atlasSlots: number ; isolatedFaces: number ; ownFaces: number }
filled.atlasSlotsnumber
filled.isolatedFacesnumber
filled.ownFacesnumber

TextureInfo​

Ƭ TextureInfo: Object

Type declaration​

NameType
blockIdnumber
blockNamestring
canvasHTMLCanvasElement | null
faceNamestring
materialKeystring
rangeUV | null
type"shared" | "independent" | "isolated"

TextureInput​

Ƭ TextureInput: TextureNode & { value: Texture }

A texture input: node.value swaps the texture it reads.


TextureSlotKind​

Ƭ TextureSlotKind: "color" | "depth" | "float" | "uint"

What kind of texture a slot will hold, which fixes its binding type.


TransparencyFlags​

Ƭ TransparencyFlags: Object

Type declaration​

NameType
isFluidboolean
isSeeThroughboolean
lightAttenuationnumber
transparentStandaloneboolean

TransparentMedium​

Ƭ TransparentMedium: "air" | "water"

The medium a see-through effect sits in, as far as water is concerned.


TransparentSortClassification​

Ƭ TransparentSortClassification: "single-plane" | "plane-triggers" | "distance"

How a translucent mesh decides when to re-sort:

  • "single-plane" — every face lies in one plane, so no camera ray can ever hit two faces; the mesh never needs sorting.
  • "plane-triggers" — all faces are axis-aligned quads. A valid painter's order can only change when the camera crosses one of the mesh's distinct face planes, so re-sorts fire on plane crossings instead of distance moved (Sodium's trigger model).
  • "distance" — geometry with non-axis-aligned faces falls back to the original re-sort-every-half-block behavior.

TransparentSortStats​

Ƭ TransparentSortStats: Object

Cumulative main-thread cost of per-face translucency sorting across all meshes since page load: how many sorts ran, their total/max milliseconds, and the number of faces pushed through the radix sort. Difference two reads for a window; a camera strafe re-sorts every mesh each time it crosses the movement threshold, which is exactly the cost this exists to expose.

Type declaration​

NameType
countnumber
facesnumber
maxMsnumber
totalMsnumber

UV​

Ƭ UV: Object

The UV range of a texture on the texture atlas.

Type declaration​

NameTypeDescription
endUnumberThe ending U coordinate of the texture.
endVnumberThe ending V coordinate of the texture.
startUnumberThe starting U coordinate of the texture.
startVnumberThe starting V coordinate of the texture.

UVec2Node​

Ƭ UVec2Node: Node<"uvec2">


UVec3Node​

Ƭ UVec3Node: Node<"uvec3">


UVec4Node​

Ƭ UVec4Node: Node<"uvec4">


UintNode​

Ƭ UintNode: Node<"uint">


UnderwaterFogInputs​

Ƭ UnderwaterFogInputs: Object

The inputs of the fog the camera looks through under water.

Type declaration​

NameType
cameraSubmersionFloatNode
cameraWaterPlaneYFloatNode
underwaterAmbientVec3Node
underwaterViewScaleFloatNode

UniformRef​

Ƭ UniformRef<T>: Object

A live value the CPU writes and shaders read: a TSL uniform or texture node.

Type parameters​

Name
T

Type declaration​

NameType
valueT

UniformTypeOf​

Ƭ UniformTypeOf<T>: T extends Color ? "vec3" : T extends Matrix4 ? "mat4" : T extends Matrix3 ? "mat3" : T extends Vector4 ? "vec4" : T extends Vector3 ? "vec3" : T extends Vector2 ? "vec2" : T extends number ? "float" : never

The TSL type a uniform of value T takes in shading code. A Color uniform is built as color and generates as a vec3; typing it as one lets colours mix with the vectors they are lit by.

Type parameters​

Name
T

UnpaintedSurface​

Ƭ UnpaintedSurface: Object

Type declaration​

NameTypeDescription
ageMs?numberIsolated faces only: how long the material has existed.
blockIdnumber-
blockNamestring-
faceNamestring-
kindSurfaceKind-
stateExclude<SurfaceState, "painted">-
textureGroupstring | null-
voxel?Coords3Isolated faces only: the voxel whose face this is.

UpdatingRosterPool​

Ƭ UpdatingRosterPool: RosterPool & { update: (deltaTime: number, renderer: Renderer) => void }


ValueUniform​

Ƭ ValueUniform<T>: UniformNode<UniformTypeOf<T>, Widen<T>>

Type parameters​

Name
T

Vec2Node​

Ƭ Vec2Node: Node<"vec2">


Vec3Node​

Ƭ Vec3Node: Node<"vec3">


Vec3Tuple​

Ƭ Vec3Tuple: readonly [number, number, number]


Vec4Node​

Ƭ Vec4Node: Node<"vec4">


VolumetricCloudLayer​

Ƭ VolumetricCloudLayer: Object

One horizontal slab of cloud.

Type declaration​

NameTypeDescription
bottomnumberHeight of the slab's underside, in blocks.
bottomRoundnumberFraction of the slab height over which the underside rounds off.
cellCoords3Blocks per texel of the noise volume. In the voxel style this is the size of one cloud cube.
coveragenumberShare of the sky the slab covers, 0..1.
coverageScalenumberHow many noise tiles one sweep of the coverage map spans.
driftnumberShare of the deck's drift speed this slab moves with: valley cloud barely moves while the high deck sails over it.
extinctionnumberLight lost per block through cloud at full density.
offsetnumberShifts this slab's noise so two slabs never repeat each other.
shadeFloornumberBrightness of the slab's underside relative to its top, 0..1.
topnumberHeight of the slab's top, in blocks.
topRoundnumberFraction of the slab height over which the top rounds off.

VolumetricCloudStyle​

Ƭ VolumetricCloudStyle: "voxel" | "soft"

How a volumetric deck is drawn.


VolumetricCloudsOptions​

Ƭ VolumetricCloudsOptions: Object

Type declaration​

NameTypeDescription
fadeStartRationumberFraction of maxDistance where the deck starts fading into the haze.
layersVolumetricCloudLayer[]At most two slabs.
maxDistancenumberHow far a ray marches, in blocks.
noiseSizeCoords3Texels of the tileable noise volume.
seednumber-
speednumberThe drift speed along -z, in blocks per second of the shared clock.
styleVolumetricCloudStyle-

VolumetricCloudsSharedUniforms​

Ƭ VolumetricCloudsSharedUniforms: VolumetricCloudsSharedInputs

What a volumetric deck reads from the rest of the world (fog, sky glow, sun, and the cloud colour the day cycle drives): pass the classic deck's Clouds.shared and both decks light and haze alike.


VoxelBoxBand​

Ƭ VoxelBoxBand: Object

One band of a box laid out as a single chunk the mesher reads: a cell of air round the box on every side, and one row of the box above and below the band so its faces cull against the rows they meet.

Type declaration​

NameTypeDescription
firstRownumberThe band's first row of the box.
heightnumberThe chunk's height: the band's rows plus one above and one below.
lightsUint32Array-
rowsnumberRows of the box the band meshes.
sidenumberThe chunk's width and depth (the wider of the box's two, plus the air).
voxelsUint32Array-

VoxelBoxBandOptions​

Ƭ VoxelBoxBandOptions: Object

Type declaration​

NameTypeDescription
firstRownumber-
lightAt(x: number, y: number, z: number) => number-
rowsnumber-
sizeCoords3-
voxelsUint32Array-

VoxelBoxInput​

Ƭ VoxelBoxInput: Object

A box of voxels to mesh on its own, away from the chunks.

Type declaration​

NameTypeDescription
bandHeight?numberRows meshed per worker job, at most a section's height.
isRelit?booleanIts light is rewritten as it moves (relightLoneCube): every piece keeps a mesh of its own rather than riding the shared opaque batch.
isUrgent?booleanMesh ahead of the chunk queue.
originCoords3The box's lowest corner in the world, where it stands: lights and regional tints are read from the world there.
sizeCoords3Voxels along x, y and z.
voxelsUint32ArrayRaw voxel words, x outermost, then y, then z (a chunk's layout); 0 is air.

VoxelBoxMesh​

Ƭ VoxelBoxMesh: Object

Type declaration​

NameTypeDescription
bandsnumberJobs the box was meshed in, one per band of rows.
dispose() => void-
groupGroupThe box on its own forks of the chunk materials, its lowest corner at the group's origin. Not added to anything: the caller places and moves it, and its textures ride it wherever it goes (VoxelBoxTexelFrame).
mainThreadMsnumber-
maxSliceMsnumberThe most main-thread time any one frame spent building voxel boxes while this one was built (the budget is shared by every box at once).
totalMsnumberFrom the call to every band back from the workers, and the main thread's share of that: filling the bands and building the meshes.
trianglesnumber-

VoxelBoxWorkCost​

Ƭ VoxelBoxWorkCost: Object

What a run of voxel-box work cost the main thread.

Type declaration​

NameTypeDescription
mainThreadMsnumber-
maxSliceMsnumberThe most any one slice ran while this work was queued, including other boxes' work sharing it.

VoxelInteractOptions​

Ƭ VoxelInteractOptions: Object

Parameters to customize the VoxelInteract instance.

Type declaration​

NameTypeDescription
highlightColorColorThe color of the highlight. Defaults to 0xffffff.
highlightLerpnumberThe lerping factor of the highlight. Defaults to 0.8.
highlightOpacitynumberThe opacity of the highlight. Defaults to 0.8.
highlightScalenumberThe scale of the block highlight. Defaults to 1.002.
highlightType"box" | "outline"The type of the block highlight. Box would be a semi-transparent box, while outline would be 12 lines that outline the block's AABB union. Defaults to "box".
ignoreFluidsbooleanWhether or not should the VoxelInteract instance ignore fluids when raycasting. Defaults to true.
inverseDirectionbooleanWhether or not should the VoxelInteract instance reverse the raycasting direction. Defaults to false.
potentialVisualsbooleanDebug Whether or not should there be arrows indicating the potential block placement's orientations. Defaults to false.
reachDistancenumberThe maximum distance of reach for the VoxelInteract instance. Defaults to 32.

VoxelLightVolumeOptions​

Ƭ VoxelLightVolumeOptions: Object

Type declaration​

NameType
chunkSizenumber
maxChunk[number, number]
maxHeightnumber
maxLightLevelnumber
minChunk[number, number]

WaterChannelCoefficients​

Ƭ WaterChannelCoefficients: Object

Per-channel coefficients for Beer-Lambert water extinction, expressed per block (~meter) of water. All water rendering derives from this one table.

Type declaration​

NameType
bluenumber
greennumber
rednumber

WaterColumnSample​

Ƭ WaterColumnSample: Object

Type declaration​

NameTypeDescription
depthnumber-
roofed?booleanThe column ends at a roof: surfaceY is its underside.
surfaceYnumber-

WaterOpticsFrameInput​

Ƭ WaterOpticsFrameInput: Object

Type declaration​

NameTypeDescription
columnWaterColumnSample | nullThe water column over the camera this frame (null in air), measured by the caller — World.measureWaterColumnAt resolves the chunk once and walks it directly, which is why the query is not taken here.
deltaSecondsnumber-
sunStrengthnumber-

WorkerPoolJob​

Ƭ WorkerPoolJob: Object

A worker pool job is queued to a worker pool and is executed by a worker.

Type declaration​

NameTypeDescription
buffers?Transferable[]Any array buffers (transferable) that are passed to the worker.
messageanyA JSON serializable object that is passed to the worker.
resolve(value: any) => void-
timeoutMs?numberMilliseconds this job may run before its worker is presumed dead. A worker that OOMs mid-job dies without any error event, which used to leave the slot occupied and the job unresolved forever (frozen lighting/meshing). On timeout the worker is replaced and the job resolves null.

WorkerPoolOptions​

Ƭ WorkerPoolOptions: Object

Parameters to create a worker pool.

Type declaration​

NameTypeDescription
maxQueuedJobs?numberJobs allowed to wait for a free worker before the oldest are shed (resolved null, exactly like a dead worker). Left undefined the queue is unbounded, which is only safe when the caller gates dispatch on WorkerPool.availableCount: every queued job holds its serialized payload alive, so a caller that enqueues faster than workers drain turns the queue into an unbounded allocation. Opt in only from callers that treat a null result as a retryable failure.
maxWorkernumberThe maximum number of workers to create. Defaults to 8.
name?stringThe name prefix for workers in this pool. Workers will be named {name}-0, {name}-1, etc. Shows up in DevTools for debugging.
readyMessageType?stringThe type of the message a worker posts once its start-up has finished, for workers whose start-up is asynchronous (a wasm module instantiating on init). Until a worker has posted it the pool hands it no job, a replacement included, and a job's reply is never mistaken for it. Without it a worker takes jobs as soon as it exists.

WorkerTransferConfig​

Ƭ WorkerTransferConfig: Object

Type declaration​

NameType
maxRecentSamplesnumber
modeWorkerTransferMode

WorkerTransferMode​

Ƭ WorkerTransferMode: "auto" | WorkerTransferStrategy


WorkerTransferStrategy​

Ƭ WorkerTransferStrategy: "transfer" | "shared"


WorldChunkEvents​

Ƭ WorldChunkEvents: Object

Type declaration​

NameType
chunk-data-loaded(data: ChunkDataEventData) => void
chunk-loaded(data: ChunkEventData) => void
chunk-mesh-loaded(data: ChunkMeshEventData) => void
chunk-mesh-unloaded(data: ChunkMeshEventData) => void
chunk-mesh-updated(data: ChunkMeshUpdateEventData) => void
chunk-unloaded(data: ChunkEventData) => void
chunk-updated(data: ChunkUpdateEventData) => void
world-definition-changed(data: { next: string ; previous: string }) => void

WorldClientOptions​

Ƭ WorldClientOptions: Object

The client-side options to create a world. These are client-side only and can be customized to specific use.

Type declaration​

NameTypeDescription
blockTextureFiltering"nearest" | "mip-aniso"How the block atlas samples at glancing angles. "nearest" (the default) is the original path: no mips, so a steep wall far from straight-on aliases into streaks because there is no lower-resolution level to fall back to. "mip-aniso" builds a full mip chain (NearestMipmapNearestFilter — each level stays hard-edged, only the level picked changes, so up-close texels stay exactly as crisp) plus anisotropy 4 for the glancing-angle case specifically. Costs a mip chain build per atlas upload and gl.generateMipmap after every animated-tile patch (AtlasTexture.flushAnimationPatches); A/B before defaulting a consumer to it. World.setBlockTextureFiltering flips it live for an A/B run without rebuilding the world.
borderSwapHoldMsnumberHow long, in milliseconds, a finished re-mesh of a section already on screen may wait for a ready neighbour to draw before it swaps in. The re-mesh removes the wall the section drew against that neighbour while it was missing, so swapping it in first opened a gap along the border. 0 swaps every re-mesh in on arrival, the old behaviour. Read on every apply, so it can be flipped for A/B timing. Defaults to 20000, below the 30 s mesh-job watchdog the held job still counts against.
chunkCullShadowSafeDistancenumberBlocks within which chunks stay visible even when the camera is looking away from them, because geometry behind the camera still casts shadows into the view. Defaults to 160 blocks, comfortably past the shadow cascades' 128-block reach; shorten it below that and near shadows start vanishing as the player turns. In blocks rather than chunks so that a world choosing a coarser chunk size does not silently pin hundreds of chunks visible.
chunkLoadExponentnumberThe exponent applied to the ratio that chunks are loaded, which would then be used to determine whether an angle to a chunk is worth loading. Defaults to 8.
chunkRequestOverdueMsnumberHow long a chunk may stay asked for with no data arriving before the world reports it as unanswered, in milliseconds. The request itself is retried every chunkRerequestIntervalMs meanwhile; the report names each stuck chunk once per interval while it stays stuck, with how often it was asked for and whether any request left this client. 0 turns the report off. Defaults to 60000ms.
chunkRerequestIntervalMsnumberHow long a requested chunk may go unanswered before the request is presumed lost and reissued, in milliseconds. Defaults to 5000ms.
chunkUniformValuesPartial<Record<keyof ChunkRenderer["uniforms"], number>>Starting values for the chunk shading's numeric uniforms (their nodes are shared by every material, so they are set, never replaced). Defaults to {}.
clientOnlyMeshingbooleanWhether to use client-only meshing. When true, chunks are always meshed locally. When false, server-provided meshes are used for initial chunk load. Defaults to true.
cloudsOptionsPartial<CloudsOptions>The options to create the clouds. Defaults to {}.
defaultRenderRadiusnumberThe default render radius of the world, in chunks. Change this through world.renderRadius. Defaults to 8 chunks.
distantDetailCullBelowYnumber | nullWorld Y under which distant chunks are left unmeshed, trading the terrain below it for a much larger render radius. Only chunks farther away than nearDetailRadius are culled; the ones around the player always mesh to the ground, and a chunk fills in the rest as the player approaches. null (the default) meshes everything everywhere. Culling leaves the underside of distant terrain open, so this is only invisible when something opaque sits over the cut — a cloud deck whose lowest surface is above the cut line. Set it above that and distant mountains read as hollow shells. For the same reason the cull applies only while the player is above this line. Underneath it the deck is no longer in the way, so the world meshes in full and gives up the range until they climb back over it. Only applies under clientOnlyMeshing; server-meshed worlds render what they are sent.
distantDetailCullHysteresisnumberHow far above distantDetailCullBelowY the player must climb before culling resumes, having dropped below it. Falling below the line always suspends culling immediately — the gap only delays switching it back on, so that standing at the line does not flip the two states frame by frame. Defaults to 8 blocks.
farTerrainDistancenumberHow far the far-terrain layer reaches past the viewer, in blocks, in a world that serves far terrain (farTerrain in its INIT options). 0 (the default) draws none. Change it through world.farTerrainDistance.
farTerrainEdgeBandnumberThe outer share of the far layer's reach across which it thins into the haze, so its edge never cuts against the sky. Defaults to 0.1.
farTerrainFogFarRationumberWith the far layer on, fog closes at this multiple of its reach. Past 1 the layer's far stretch stays partly clear (a range 850 blocks off is about half hazed at 1.6 with a 1024 reach) and the layer thins into the haze across its outer farTerrainEdgeBand. Defaults to 1.
farTerrainFogNearRationumberWith the far layer on, fog starts at this fraction of the render distance and closes at the far layer's edge, so loaded terrain stays nearly clear and the far layer fades into haze. Defaults to 0.6.
farTerrainPalettenumber[]Linear RGB per class the world's far-terrain sampler emits, flattened ([r0, g0, b0, r1, ...]), for a world whose descriptor names no materials (with materials the layer paints each class from its blocks' textures). An empty palette (the default) draws every class grey.
farTerrainSeamBandnumberHow many blocks of the loaded area's outer edge hand over to the far layer across a dithered band, up to half a chunk; 0 leaves the edge hard. Defaults to 0: the band dithers by screen pixel, which shimmers as the view moves, and over anything standing off the ground (a floating island, a tall crown) it interleaves two different shapes.
farTerrainSkySideColorstringUnderside and wall colour of far floating land, without a skyMaterial.
farTerrainSkyTopColorstringTop colour of far floating land, without a skyMaterial.
farTerrainWaterColorstringThe far water plane's colour. Defaults to a deep sea blue.
fogCullSlacknumberBlocks past the fog far edge a section may reach before fog culling hides it, absorbing the difference between a section's center distance and the nearest fragment the fog actually shades.
fogDistancenumber | nullA fixed fog distance in blocks, independent of renderRadius. null (the default) derives fog from fogNearRenderRatio/fogFarRenderRatio as before, so fog moves every time the radius changes. Set it to hold fog steady across radius changes — for example raising renderRadius for a vista capture without paying for fog pushed out to match. Always clamped to at most the current render distance (world.fogDistance, World.getBaseFogRange).
fogFarRenderRationumberFraction of render distance where horizon fog fully hides terrain. Defaults to 0.78.
fogNearRenderRationumberFraction of render distance where horizon fog starts. Defaults to 0.45.
isCullingChunksByFogbooleanWhether the occlusion walk also prunes sections past the fog's far edge, where every fragment already resolves to pure fog color.
isCullingChunksByFrustumbooleanWhether whole chunk subtrees are hidden while the camera cannot see them. three.js culls per mesh, but it pays to walk the scene graph first: every node is visited by the matrix pass and the culling pass whether or not it ends up drawn, and a wide render radius is tens of thousands of visits per frame. Testing one box per chunk and hiding the ones that miss lets the renderer skip those branches outright. Requires a camera to be passed to World.update; without one there is nothing to cull against and every chunk stays visible.
isCullingChunksByOcclusionbooleanWhether to hide chunk sections the camera provably cannot see through the terrain, walking the mesher-reported face-connectivity graph outward from the camera's own section (Sodium-style occlusion culling). An enclosed interior stops drawing the world around it. Requires WorldClientOptions.isCullingChunksByFrustum, since the walk also carries the frustum test.
isCullingSpectatorByOcclusionbooleanWhether the occlusion walk keeps running for a spectating (noclip) camera. A noclip camera can sit inside rock, where faces between solid voxels are never meshed and it sees straight through to whatever the walk would call hidden; so while any voxel the near plane can touch is opaque the walk steps aside for frustum-only culling, and everywhere else (open air, a cave it flew into) it culls exactly as it does for a walking player. false suspends occlusion for the whole flight, the old behaviour. Read every frame, so it can be flipped for A/B timing.
isOcclusionOpenAtPendingChunksbooleanWhether a chunk joins the occlusion walk as open air from the moment it is requested, until its own connectivity lands. A chunk with no node blocks every path through it (the walk never turns back), so without this the open terrain behind each still-loading chunk was culled and popped in when the hole filled. false is the old behaviour; read when each request is issued.
lightJobRetryLimitnumberMaximum number of retries for stale light jobs before falling back to sync. Defaults to 3.
lightJobTimeoutMsnumberMilliseconds a light worker job may run before its worker is presumed dead (an OOMed worker dies without any error event) and replaced. Defaults to 20000.
lightSnapshotBudgetBytesnumberBytes of chunk copies the light workers may hold at once. A relight copies every chunk its light can reach, so jobs that would take the copies in flight past this wait for one to come back; a single job larger than the whole budget still runs, alone, with a warning. Defaults to 96 MB.
localLightsPartial<LocalLightsOptions>Budgets, capacities, and quality tier of the local light emitter system (world.localLights). See LocalLightsOptions for the knobs; defaults make an unconfigured world pay nothing.
maxChunkRequestsPerUpdatenumberThe maximum chunk requests this world can request from the server per world update. Defaults to 12 chunks.
maxDetailRefinementsPerUpdatenumberHow many chunks may have their culled levels queued for meshing per world update. Refinement is spread over frames and ordered nearest-first so walking into a region never lands as one burst of mesh jobs. Defaults to 4 chunks.
maxImmediateServerUpdatesnumberServer update batches larger than this are drained through the incremental per-frame update queue instead of being applied (and relit) synchronously in one shot. Defaults to 500 updates.
maxLightWorkersnumberMaximum concurrent light workers. Defaults to 2.
maxLightsUpdateTimenumber-
maxMeshWorkersnumberMesh workers for the world's own chunks, never more than the device has cores. Each holds the mesher and its copy of the block registry (tens of megabytes), so a page that loads few chunks, or runs on a device short of memory, asks for fewer. Defaults to 4.
maxMeshesPerUpdatenumberChunk sections the mesh dispatcher may start in about a frame, air sections (which finish without a worker) included; the rest wait for the next frame. Workers are refilled as their jobs finish, so this only bounds the main thread's dispatch work. Defaults to 32.
maxOptimisticClientUpdatesnumberClient batches larger than this skip the optimistic local apply (with its per-frame relight) and stream straight to the server; the world catches up from the server's tick-batched echo. Keeps bulk edits (WorldEdit) from freezing the tab and guarantees the whole batch is on the wire before any reload. Defaults to 4000 updates.
maxProcessesPerUpdatenumberThe maximum amount of chunks received from the server that can be processed per world update. By process, it means to be turned into a Chunk instance. Defaults to 8 chunks.
maxQueuedWorkerJobsnumberJobs allowed to wait for a free mesh or light worker before the oldest are shed. Dispatch is already gated on free worker slots, so this is the backstop that keeps a future caller from parking unbounded serialized chunk payloads in a pool queue. Defaults to 8.
maxUpdatesPerUpdatenumberThe maximum voxel updates that can be sent to the server per world update. Defaults to 1000 updates.
maxUrgentMeshWorkersnumberDedicated mesh workers reserved for client-originated voxel edits, never more than maxMeshWorkers.
maxVoxelHistoryPerVoxelnumberPrevious values retained per voxel. Defaults to 4.
maxVoxelHistoryVoxelsnumberDistinct voxels tracked by World.getPreviousValueAt. The history is a debugging convenience, not gameplay state, so it evicts oldest-first instead of growing with every voxel a session ever edits. Defaults to 4096.
memoryPressurePartial<MemoryPressureOptions>Renderer heap watchdog thresholds. See MemoryPressureOptions.
mergeChunkGeometriesbooleanWhether to merge chunk geometries to reduce draw calls. Useful for mobile. Defaults to false.
meshApplyBudgetMsnumberPer-frame time budget for applying completed regular mesh results on the main thread, in milliseconds. At least one result always applies per frame; the budget is checked after each apply. Urgent (player-edit) results and the initial join flow bypass the budget entirely. Defaults to 3.
meshJobTimeoutMsnumberMilliseconds a mesh worker job may run before its worker is presumed dead and replaced. Defaults to 30000.
meshJobsInFlightnumberRegular (non-urgent) chunk mesh jobs running at once; each worker that finishes takes the next nearest section. More stream terrain in sooner and cost frame time: on a sprint flight (M5 Max) 2 drew a column about 0.9 s after it came into range where 1 took 1.7 s, for about a millisecond more a frame, and 3 or 4 doubled the slowest frames. Capped by the mesh worker pool. Defaults to 2.
minLightLevelnumberThe minimum light level even when sunlight and torch light levels are at zero. Defaults to 0.04.
nearDetailRadiusnumberChunk radius within which every sub-chunk level is meshed regardless of distantDetailCullBelowY. Defaults to 10 chunks.
orderIndependentTransparencyOrderIndependentTransparencyOptions | nullDraw every blended surface order-independently (see OrderIndependentTransparencyOptions): water, glass, the translucent texels of any see-through block, and every transparent material in the world's scene, accumulated in any order and composited once. Requires the host to draw the world with World.renderFrame into a render target with a float depth texture; a frame that cannot accumulate says why and draws its layers in list order. null (the default) keeps the sorted pipeline: per-face sorting, medium bands and the per-pixel water side of glass.
plantDetailDistancenumber | nullBlock distance out to which plant decoration (grass tufts, flowers — any block the registry marks isPlant) is drawn. Beyond it those meshes are hidden. null (the default) draws them everywhere. Plants cannot share a mesh with the terrain: each species is its own double-sided alpha-tested material, so a chunk with grass and two flower species costs three extra draw calls no matter how few blocks are in them. Across a wide render disc that is most of the frame's draw calls spent on geometry a metre wide, which past a couple of hundred blocks covers well under a pixel. This hides whole meshes rather than fading them, so set it past the point where a tuft is still resolvable or the boundary reads as a moving edge in the ground cover.
regionArenasChunkRegionArenasOptions | nullRegion buffer arenas for the shared-opaque chunk bucket. See ChunkRegionArenasOptions. null disables batching and keeps per-section meshes.
skyOptionsPartial<SkyOptions>The options to create the sky. Defaults to {}.
statsSyncIntervalnumberThe interval between each time the world requests the server for its stats. Defaults to 500ms.
sunlightChangeSpannumberThe fraction of the day that sunlight takes to change from appearing to disappearing or disappearing to appearing. Defaults to 0.1.
sunlightEndTimeFracnumberThe fraction of the day that sunlight starts to disappear. Defaults to 0.7.
sunlightStartTimeFracnumberThe fraction of the day that sunlight starts to appear. Defaults to 0.25.
swayProfileCapacitynumberSlots in the shared cutout buckets' sway-profile uniform table (one vec4 pair each). Slot 0 is reserved for "no sway", so a world can register one fewer distinct profile than this. Defaults to 16.
textureUnitDimensionnumberThe default dimension to a single unit of a block face texture. If any texture loaded is greater, it will be downscaled to this resolution. Defaults to 8 pixels.
timeForceThresholdnumberThe threshold to force the server's time to the client's time. Defaults to 0.1.
tuftDetailDistancenumber | nullBlock distance out to which blocks' tufts (Block.tufts) are drawn; beyond it a chunk's tuft batch is hidden and its canopies are their plain cubes. null (the default) draws them everywhere. Like plantDetailDistance it hides whole sections rather than fading, so set it where a tuft's ragged edge no longer reads.
unpaintedFallbackColorstringThe flat colour World.fillUnpaintedSurfaces paints over a surface still wearing the magenta-and-black unknown checker when there is no better default to give it. A quiet warm grey by default, so a stage with a missing texture reads as unfinished rather than broken.
useLightWorkersbooleanWhether to use web workers for light calculations. Defaults to true.
volumetricCloudsOptionsPartial<VolumetricCloudsOptions> | nullA volumetric cloud deck drawn beside (or instead of) the meshed one; null draws none. Change it live with World.setVolumetricClouds. Defaults to null.

WorldClock​

Ƭ WorldClock: Object

The world clock as the server keeps it: a time of day that wraps at timePerDay, and a count of the days it has completed. Together they unwrap into elapsedSeconds, the monotonic clock every client of a world shares.

Type declaration​

NameTypeDescription
daynumberDays completed since the clock began.
timenumberSeconds into the current day, in [0, timePerDay).

WorldFogRange​

Ƭ WorldFogRange: Object

The chunk shader's fog near/far, in blocks from the camera.

Type declaration​

NameType
farnumber
nearnumber

WorldMemoryCounters​

Ƭ WorldMemoryCounters: Object

A snapshot of every queue and in-flight set in the voxel update -> relight -> remesh pipeline. See World.getMemoryCounters.

Type declaration​

NameTypeDescription
activeLightBatchPendingJobsnumber-
activeLightBatchUndispatchedJobsnumber-
blockUpdatesAppliednumberCumulative since world init, so a caller can difference two reads to charge a burst of activity (a water spread, a bulk fill) with exactly the voxel writes and light work it caused.
blockUpdatesQueuenumber-
blockUpdatesToEmitnumber-
lightJobHighWaterChunksnumber-
lightJobQueuenumber-
lightJobsSchedulednumber-
lightQueuenumber-
lightQueuedBytesnumber-
lightSeedsAnalyzednumberRemoval + flood seeds handed to the light engine, all colors.
lightWorkingnumber-
loadedChunksnumber-
memoryPressureMemoryPressureStatus-
meshDirtyKeysnumber-
meshInFlightJobsnumber-
meshQueuenumber-
meshQueuedBytesnumber-
meshWorkingnumber-
urgentMeshQueuenumber-
urgentMeshQueuedBytesnumber-
urgentMeshWorkingnumber-
voxelHistoryVoxelsnumber-

WorldOptions​

Ƭ WorldOptions: WorldClientOptions & WorldServerOptions

The options to create a world. This consists of WorldClientOptions and WorldServerOptions.


WorldServerOptions​

Ƭ WorldServerOptions: Object

The options defined on the server-side, passed to the client on network joining.

Type declaration​

NameTypeDescription
airDragnumberThe air drag of everything physical.
chunkSizenumberThe width and depth of a chunk, in blocks.
doesTickTimeboolean-
fluidDensitynumberThe density of the fluid in this world.
fluidDragnumberThe fluid drag of everything physical.
gravitynumber[]The gravity of everything physical in this world.
maxChunk[number, number]The maximum chunk coordinate of this world, inclusive.
maxHeightnumberThe height of a chunk, in blocks.
maxLightLevelnumberThe maximum light level that propagates in this world, including sunlight and torch light.
minBounceImpulsenumberThe minimum bouncing impulse of everything physical in this world.
minChunk[number, number]The minimum chunk coordinate of this world, inclusive.
seednumberThe server's world seed. Shared cosmetic randomness — the cloud deck, the shooting-star schedule — derives from it so every client of one world sees the same sky.
subChunksnumberThe number of sub-chunks that divides a chunk vertically.
timePerDaynumberThe time per day in seconds.
waterLevelnumberThe nominal water level of this world, in blocks.

Variables​

AIRLIGHT_SLOTS​

• Const AIRLIGHT_SLOTS: 12

Uniform slots of the air-light set: the steady lights of the richest tier plus room for lights still fading out of it. Compile-time in every shader that reads the set (the air effect, the chunk room fill).


BLOCK_LIGHT_GAIN​

• Const BLOCK_LIGHT_GAIN: 2.2


BLOCK_LIGHT_HUE_RAMP_LEVEL​

• Const BLOCK_LIGHT_HUE_RAMP_LEVEL: number

One flood level (0..1 units): a channel below the peak fades its hue share in over this much of its own level, or over the peak itself when the peak is fainter, so the peak channel is never dimmed.


BLOCK_LIGHT_LOG2_RATIO​

• Const BLOCK_LIGHT_LOG2_RATIO: number

15 log2(ratio): the geometric curve's exponent per unit of level.


BLOCK_LIGHT_OWNERSHIP_GAIN​

• Const BLOCK_LIGHT_OWNERSHIP_GAIN: 1.5

Safety gain on the analytic claim when it suppresses the baked flood term: the two models approximate the same sources with different falloff curves, so ownership must saturate decisively near a source (fully analytic — N·L and shadows undiluted) while still fading smoothly to the flood look at the claim's edge. Shared by the chunk shader and the CPU entity mirror; change neither side alone.


BLOCK_LIGHT_OWNERSHIP_TAIL​

• Const BLOCK_LIGHT_OWNERSHIP_TAIL: Readonly<{ from: 0.1 = 0.1; gain: 0.6 = 0.6; to: 0.5 = 0.5 }>

The gain a faint claim takes instead: under to it falls toward gain, reached at from. The claim is measured against the flood's curve before the flood's own gain, so 0.6 is about one to one in light: out in a lamp's tail it owns a fragment only while it lights it more than its flood would. At the near gain it owned the whole of its reach, where its own light (the kernel, its window and the flood mask together) drops to nothing over the last few blocks: a torch's pool ended on an edge, with the flood's long soft tail kept off it.


BLOCK_LIGHT_TAIL​

• Const BLOCK_LIGHT_TAIL: number

ratio^15, subtracted so level 0 maps to exactly 0.


BLOCK_LIGHT_TRANSFER​

• Const BLOCK_LIGHT_TRANSFER: Readonly<{ adaptation: 0.13 = 0.13; ceilingWeight: 0.6 = 0.6; dominanceKnee: 0.06 = 0.06; gain: 2.2 = 2.2; hueLevels: 12 = 12; lampWhite: 1.2 = 1.2; mountFar: 2.5 = 2.5; mountNear: 0.5 = 0.5; ratio: 0.8 = 0.8; tightKernelCoreRatio: 0.2 = 0.2; tightKernelGain: 2 = 2.0 }>

How flood block light (torches, lanterns, glowberries) turns into light on a surface: the single source for the chunk fragment, its local-light ownership math and every CPU mirror (entity light, the client's entity lighting utils). See docs/design/rendering/2026-09-23-block-light- illumination.md, steps 6 and 7.

The flood stores 0..15 per channel and loses one level per block. The legacy map (smoothstep, gain 1.2, per-channel ACES) turned that into a flat plateau with a cliff at the edge, and walked every coloured light's hue to pure red as its weaker channels died first. The geometric map keeps a fixed ratio per level, so the decline is even block to block and a light keeps its hue while its channels are alive; the tone map preserves hue for block-lit fragments. Daylight is unchanged: every new term rides torchDominance, which is 0 in a sunlit frame.

The chunk shading's TSL twin is shading/block-light.ts; change neither alone.


BLOCK_LIGHT_TRANSFER_KERNEL_CORE​

• Const BLOCK_LIGHT_TRANSFER_KERNEL_CORE: 0.2

The analytic kernel's core, as a fraction of a light's range.


BLOCK_LIGHT_WARM_TINT​

• Const BLOCK_LIGHT_WARM_TINT: readonly [number, number, number]

Warm tint for flood light; saturated emitters keep their own hue. Gold rather than orange: under (1.05, 0.92, 0.75) on top of a torch's own amber, green crops went olive and soil went rust, and a lit field lost the colours that tell its plants apart.


BLUE_LIGHT​

• Const BLUE_LIGHT: "BLUE"

The string representation of blue light.


BOX_SIDES​

• Const BOX_SIDES: BoxSides[]

The six default faces of a canvas box.


BYTE_VECTOR_STRIDE​

• Const BYTE_VECTOR_STRIDE: 4

WebGPU vertex strides are whole 4-byte words, so an attribute of three one-byte components (a quantized normal, a biome tint) needs a fourth. three pads such an attribute itself, but it re-pads it on every upload with a per-vertex loop that makes a view per vertex: a merged section updated in play allocated ~150 MB/s and stalled frames on the collector. Chunk geometry carries these attributes four-wide from the start (the shaders read three; the fourth is dropped).


CANVAS_BOX_ATLAS_GUTTER​

• Const CANVAS_BOX_ATLAS_GUTTER: 8

Texels of the face's own repeat kept round each face in a merged layer's atlas. Face origins and cell edges land on multiples of it too, so for a face whose size is a multiple of eight the first three mip levels hold exactly the texels its own wrapping texture's mips did.


CANVAS_BOX_GROUP_FACES​

• Const CANVAS_BOX_GROUP_FACES: readonly BoxFace[]

The face each BoxGeometry group draws, by group index (px, nx, py, ny, pz, nz): the order of a layer's per-face material array.


CHAT_HISTORY_METHOD​

• Const CHAT_HISTORY_METHOD: "vox-builtin:chat-history"

Method a client calls for an older page of the world's chat history.


CHAT_HISTORY_PAGE_SIZE​

• Const CHAT_HISTORY_PAGE_SIZE: 50

Lines one history page asks for by default (the server caps it at 100).


CHUNK_DAYLIGHT​

• Const CHUNK_DAYLIGHT: Object

The chunk fragment's daylight terms for an open face in full sun (no shadow, no occlusion, no block light), as the numbers both shaders use. The chunk material (chunk-material.ts) is the source of truth; far-terrain.test.ts reads both and fails when either side changes alone.

Type declaration​

NameTypeDescription
bounce0.04ambientColor * 0.04 * (1 - shadow): light bounced into shade.
brightTexture{ from: 0.75 = 0.75; to: 0.95 = 0.95 }smoothstep(0.75, 0.95, texLuma): how bright a texture counts as.
brightTexture.from0.75-
brightTexture.to0.95-
brightTextureSun0.7mix(1, 0.7, isBrightTex): the sun a bright texture keeps.
daylightBalancereadonly [1, 1, 1]Daylight white balance.
groundAmbient0.4ambientColor * 0.4: the sky ambient a face looking down gets.
shadedAmbient0.72mix(0.72, 1, shadow): the sky ambient a shaded face keeps.
starlightreadonly [0.025, 0.03, 0.04]vec3(0.025, 0.03, 0.04) * sunVisibility: starlight under open sky.
sunWrap{ bias: 0.15 = 0.15; scale: 0.85 = 0.85 }max(rawNdotL * 0.85 + 0.15, 0): the wrapped sun.
sunWrap.bias0.15-
sunWrap.scale0.85-
toneMap{ a: 2.51 = 2.51; b: 0.03 = 0.03; c: 2.43 = 2.43; d: 0.59 = 0.59; e: 0.14 = 0.14 }The ACES fit (x (2.51 x + 0.03)) / (x (2.43 x + 0.59) + 0.14).
toneMap.a2.51-
toneMap.b0.03-
toneMap.c2.43-
toneMap.d0.59-
toneMap.e0.14-

CHUNK_PENDING_GRACE_MS​

• Const CHUNK_PENDING_GRACE_MS: 6000

How long after loading a chunk column may still count as pending while it owes its mesh. Past this the far layer may show through it again: a section a missing neighbour keeps failing to mesh (the loaded disc's perimeter has no outer halo) must not pin sky over the far layer for the rest of the session, and a chunk that is simply slow gets the old behaviour back, the far layer standing in until its terrain lands.


CHUNK_WATER_FRESNEL​

• Const CHUNK_WATER_FRESNEL: Object

The chunk water's Fresnel on a top face, as the numbers both shaders use; far-terrain.test.ts fails when either side changes alone.

Type declaration​

NameType
basenumber
maxnumber

CHUNK_WATER_TINT​

• Const CHUNK_WATER_TINT: Object

How much of its tint the chunk water's colour takes with distance, on a top face where the vertical term is 0: near up close, toward far as 1 - exp(-distance * perBlock) grows, scaled by reach.

Type declaration​

NameType
far0.28
near0.1
perBlock0.008
reach0.72

CONNECTIVITY_FULL​

• Const CONNECTIVITY_FULL: 32767

All fifteen unordered face pairs connected — the encoding for a section the eye passes straight through (all air, or not yet meshed).


CRUSTED_FLUID_DEFAULTS​

• Const CRUSTED_FLUID_DEFAULTS: Required<CrustedFluidShaderOptions>


DEATH_BODY_GONE_MS​

• Const DEATH_BODY_GONE_MS: number

Milliseconds from start() until the body has shrunk to nothing — the moment a dying thing is gone from where it fell. Anything that follows a death (a wake teleport, a respawn) keys off this so it lands only once observers have watched the body vanish.


DEFAULT_BLOCK_MAX_STACK​

• Const DEFAULT_BLOCK_MAX_STACK: 64


DEFAULT_CHUNK_SWAY​

• Const DEFAULT_CHUNK_SWAY: ChunkSwayConstants


DEFAULT_ENTITY_FACE_SHADES​

• Const DEFAULT_ENTITY_FACE_SHADES: EntityFaceShades


DEFAULT_METHOD_CONFIRM_TIMEOUT_MS​

• Const DEFAULT_METHOD_CONFIRM_TIMEOUT_MS: 5000


DEFAULT_PART_TEXEL_DENSITY​

• Const DEFAULT_PART_TEXEL_DENSITY: TexelDensity

Texels per block for part atlases built here, and the smallest face.


EMISSIVE_LEVELS​

• Const EMISSIVE_LEVELS: [number, number, number, number]

The four strengths an emissive face can render at, indexed by the two AO bits under the vertex emissive bit. Mirrors EMISSIVE_LEVELS in crates/mesher/src/mesher/vertex_light.rs; change neither side alone.


ENTITY_ATLAS_COLS​

• Const ENTITY_ATLAS_COLS: 6


ENTITY_AVERAGE_NDOTL​

• Const ENTITY_AVERAGE_NDOTL: 0.5

Average of the shader's wrapped NdotL over a body's faces. A cube in midday sun: the top face near 0.75, the bottom at 0, the sides between, averaging about one half. Also the N·L the local-light Lambert wrap is evaluated at.


ENTITY_HEMISPHERE_BLEND​

• Const ENTITY_HEMISPHERE_BLEND: 0.5

The sky hemisphere blend vWorldNormal.y * 0.5 + 0.5 averaged over a body: vertical faces sit at 0.5 and top and bottom cancel, so the sky ambient lands between groundColor and uAmbientColor.


ENTITY_SHADOW_DISTANCE​

• Const ENTITY_SHADOW_DISTANCE: 32

Blocks from the player within which entities cast dynamic shadows. The cascade entity refresh and the caller's decision of whether any entity is worth a refresh at all must agree on this number, or entities outside it trigger full cascade re-renders for shadows that are then distance-culled before drawing.


ENTITY_SHADOW_SELF_BOUNDS_MARGIN​

• Const ENTITY_SHADOW_SELF_BOUNDS_MARGIN: 0.15

InstancedSkinnedMaterialOptions.shadowSelfBoundsMargin's default.


FAR_TERRAIN_METHOD​

• Const FAR_TERRAIN_METHOD: "vox-builtin:far-terrain"

The method a client calls for far-terrain tiles, and its reply's name.


FLOW_CREST_PHASE_PER_HEIGHT​

• Const FLOW_CREST_PHASE_PER_HEIGHT: number

Radians of flow-crest phase per block of rest height: one full crest every WATER_OPTICS.flowCrestSpacingBlocks blocks on a sheet falling a full stage per block.


FLUID_SPILL_CORNER_MIN_HEIGHT​

• Const FLUID_SPILL_CORNER_MIN_HEIGHT: number

Rest height within its voxel above which a fluid surface vertex is a spill corner — one the mesher raised to the full block because fluid stands on a voxel sharing it, so the sheet meets the wall of the block pouring onto it. A resting surface sits at WATER_OPTICS.fluidSurfaceHeight and every flow stage only lowers it, so nothing else reaches past this midpoint. The vertex stage leaves these corners out of the wave: the wall edge they are welded to sits on its voxel floor and cannot move with them.


FLUID_WAVE​

• Const FLUID_WAVE: Object

The swell a resting fluid surface rides: three octaves of the chunk shader's simplex noise over world x/z and the shader clock. The vertex stage sums this table (fluidWaveNode), and fluidWaveOffset sums the same octaves on the CPU, so something floating on the water can ride the surface the player sees instead of sinking into its crests. The shader clock follows the world's shared clock, so every client draws, and floats on, the same swell.

Type declaration​

NameTypeDescription
octavesreadonly [{ amplitude: 0.08 = 0.08; driftX: 0.3 = 0.3; driftZ: -0.2 = -0.2; frequency: 0.15 = 0.15; seed: 0 = 0 }, { amplitude: 0.04 = 0.04; driftX: -0.5 = -0.5; driftZ: 0.4 = 0.4; frequency: 0.4 = 0.4; seed: 10 = 10 }, { amplitude: 0.02 = 0.02; driftX: 0.7 = 0.7; driftZ: -0.5 = -0.5; frequency: 0.8 = 0.8; seed: 20 = 20 }]-
timeScale0.0006Shader clock (ms) to wave time.

FROZEN_METADATA_KEY​

• Const FROZEN_METADATA_KEY: "frozen"

Metadata key the server sets on entities pinned by the freeze mechanic. While true, the client must hold the entity's pose: its class update (animation clocks, interpolation) is skipped entirely.


GREEN_LIGHT​

• Const GREEN_LIGHT: "GREEN"

The string representation of green light.


HIT_FLASH​

• Const HIT_FLASH: Object

The flash a struck body shows, for any rig that owns its own tint: a near-white pop the frame the blow lands, then red that holds and fades. Rigs mix toward it after their lighting, so a body struck in the dark still flashes. A game passes its own HitFlashProfile for bodies that should flash fainter (faces that must stay legible, worn armour).

Type declaration​

NameType
fadeMs160
holdMs90
peak0.75
popAmount0.8
popMs40

HIT_FLASH_MS​

• Const HIT_FLASH_MS: number

Milliseconds from the blow until the flash is gone.


HIT_FLASH_POP​

• Const HIT_FLASH_POP: Color


HIT_FLASH_RED​

• Const HIT_FLASH_RED: Color

The flash's red and its pop, in the shaders' working (linear) space.


HIT_RECOIL_MS​

• Const HIT_RECOIL_MS: 120

The recoil lean a struck body takes: out and back over this long.


INVALID_LIGHT_HANDLE​

• Const INVALID_LIGHT_HANDLE: LightHandle = 0


INVALID_LOCAL_LIGHT_HANDLE​

• Const INVALID_LOCAL_LIGHT_HANDLE: number = INVALID_LIGHT_HANDLE


LAMBERT_REACH​

• Const LAMBERT_REACH: Readonly<{ end: 0.6 = 0.6; farWrap: 0.85 = 0.85; start: 0.15 = 0.15 }>

How a lamp's light loses its direction with distance. Near the lamp a surface is lit by the lamp's own ray, so its facing shapes it (LAMBERT_WRAP). Further out, what arrives has bounced off the ground and the walls on its way and comes from everywhere: the wrap rises to farWrap between start and end of the light's range. Without it a torch a block and a half over open ground lit it at a grazing angle: four blocks out the ground took a quarter of the light a wall there took, while the lamp still owned the fragment and kept the baked flood off it, so a torch's pool on the ground was half as wide with the analytic lights on as with them off.


LAMBERT_WRAP​

• Const LAMBERT_WRAP: 0.25

Same diffuse wrap the cone lights use, so a surface grazing any local light keeps the same rim response. Exported for the CPU entity mirror (composeEntityLight), which has no per-fragment normal and applies the wrap at an average N·L instead; change neither side alone.


LIGHT_CONES​

• Const LIGHT_CONES: Readonly<{ lambertWrap: 0.25 = 0.25; maxCones: 8 = 8; minCosDelta: 0.001 = 1e-3; scatterBands: 0 = 0; scatterCeiling: 0.3 = 0.3; scatterSamples: 4 = 4; scatterTexelsPerBlock: 16 = 16 }>

Engine-side budget and falloff shaping for dynamic spot-light cones (flashlights, vehicle headlights). The cone list is rebuilt every frame by the game; shaders iterate a small fixed array so the cost stays flat.


LIGHT_CONE_STRIDE​

• Const LIGHT_CONE_STRIDE: 4


LIGHT_FLAG_FLICKER​

• Const LIGHT_FLAG_FLICKER: 4


LIGHT_FLAG_MASKED​

• Const LIGHT_FLAG_MASKED: 2


LIGHT_FLAG_SHADOW_REQUEST​

• Const LIGHT_FLAG_SHADOW_REQUEST: 8


LIGHT_FLAG_STATIC​

• Const LIGHT_FLAG_STATIC: 1


LIGHT_QUALITY_TIERS​

• Const LIGHT_QUALITY_TIERS: Record<LightQualityTier, Pick<LocalLightsOptions, "maxClusteredLights" | "maxLightsPerCell" | "analyticRadius" | "fluidSpecularStrength" | "maxShadowedLights" | "shadowAtlasSize" | "shadowSlotSize" | "shadowLedgerUnitsPerFrame"> & { blockLightOwnership: number }>

Tier presets are data only: applying one changes pack-time caps and uniforms, never shaders. potato turns the clustered layer off entirely, rendering exactly the pre-local-lights frame plus emissive faces.


LOAD_PHASE_BATCH_MS​

• Const LOAD_PHASE_BATCH_MS: 8


MAX_CLUSTERED_LIGHTS​

• Const MAX_CLUSTERED_LIGHTS: 255

Hard ceiling of the packed set: a grid slot holds row + 1 in a byte.


MAX_HEAD_PITCH​

• Const MAX_HEAD_PITCH: 0.52


MAX_HEAD_YAW​

• Const MAX_HEAD_YAW: 0.78


MAX_LIGHTS_PER_CELL​

• Const MAX_LIGHTS_PER_CELL: 8

Compile-time slot count of the shader loop. Quality tiers cap how many slots the CPU fills, never this constant, so no tier change recompiles.


METHOD_REJECTED_REPLY​

• Const METHOD_REJECTED_REPLY: "vox-builtin:method-rejected"

The reply a server sends when a call reached the world and did nothing: the world's guard refused it, or its handler turned it down or panicked. { method, world, reason }.


NX_ROTATION​

• Const NX_ROTATION: 3

The numerical representation of the negative X rotation.


NY_ROTATION​

• Const NY_ROTATION: 1

The numerical representation of the negative Y rotation.


NZ_ROTATION​

• Const NZ_ROTATION: 5

The numerical representation of the negative Z rotation.


OFFSCREEN_DEFAULT_RADIUS​

• Const OFFSCREEN_DEFAULT_RADIUS: 2

Entity.offscreenRadius when an entity names none.


OIT_AFTER_RENDER_ORDER​

• Const OIT_AFTER_RENDER_ORDER: 999999.5

Transparent materials that cannot accumulate (additive light, which needs no order, and blend modes the accumulation cannot express) draw here, over the composite.


OIT_BLENDED_RENDER_ORDER​

• Const OIT_BLENDED_RENDER_ORDER: 0

Every blended material, accumulated in whatever order the list has.


OIT_CLOSE_RENDER_ORDER​

• Const OIT_CLOSE_RENDER_ORDER: 999999

Switches back and composites the accumulation over the scene.


OIT_DEPTH_WRITING_RENDER_ORDER​

• Const OIT_DEPTH_WRITING_RENDER_ORDER: -0.75

Transparent materials that write depth: cutouts, solid texels, masks.


OIT_OPEN_RENDER_ORDER​

• Const OIT_OPEN_RENDER_ORDER: -0.5

Switches the scene's target to the accumulation target.


OIT_PHASE_ALL​

• Const OIT_PHASE_ALL: 0

Which fragments of a blended material a pass keeps.


OIT_PHASE_BEHIND​

• Const OIT_PHASE_BEHIND: 1


OIT_PHASE_FRONT​

• Const OIT_PHASE_FRONT: 2


OIT_SPLIT_RENDER_ORDER​

• Const OIT_SPLIT_RENDER_ORDER: 999998

With a separating surface in view (see OrderIndependentSeparator): composites what lies behind it, then draws the blended band again for the surface and what lies in front of it.


ON_REQUEST_METADATA_METHOD​

• Const ON_REQUEST_METADATA_METHOD: "vox-builtin:on-request-metadata"

Method that asks the server for the world's on-request entity metadata keys (debug views it replicates only on request) or stops them.


OPAQUE_RENDER_ORDER​

• Const OPAQUE_RENDER_ORDER: 100


ORDER_INDEPENDENT_KEY​

• Const ORDER_INDEPENDENT_KEY: "orderIndependent"

Set material.userData[ORDER_INDEPENDENT_KEY] = false to keep a material out.


PIGMENT_CODE​

• Const PIGMENT_CODE: 15

Stack-count code that marks a colour-table face under the sign bit (mirrors PIGMENT_CODE in the mesher's vertex_light.rs and in shaders.ts). Such a face keeps its table colour in every climate.


POINT_FACE_GUARD_TAN_HALF​

• Const POINT_FACE_GUARD_TAN_HALF: 1.04

Half-FOV tangent of a point-light cube face. Exactly 90° would put shared cube edges precisely on the map border, where PCF taps clamp; the 4 % guard band renders a sliver past the edge so filtered lookups near a face boundary still land on real depth. The sampling reconstruction uses the same constant, so render and lookup always agree.


POSITION_BLOCK_BIAS​

• Const POSITION_BLOCK_BIAS: 32

Compact vertex format for chunk geometry, adapted from Sodium's compact vertex layout. Positions store as unsigned 16-bit fixed point in 1/positionUnitsPerBlock block units, biased by POSITION_BLOCK_BIAS blocks so face geometry that pokes slightly outside its section (rotated plant crosses, dynamic-pattern parts) stays representable. The scale is derived per world from its section extent — Sodium can hardcode one scale because its sections are always 16 blocks tall, but a world here may run a single 352-block sub-chunk, and a fixed scale wide enough for the small case silently wraps every vertex above the u16 ceiling in the tall one. UVs store as normalized u16 (the atlas keeps every vertex UV inside [0, 1]; greedy tiling reconstructs its repeat from world position in the fragment shader). Normals store as normalized i8. Together with the i32 packed light this is 17 bytes of attributes per vertex, down from 36; the four-byte light twist (quad-light.ts) brings it to 21.

The dequantization scale and bias live in the mesh (or arena instance) matrix, never in the shader: the CSM depth pass renders the whole scene through one scene.overrideMaterial and can only be correct if the transform carries the mapping back to block space. Chunk materials still receive POSITION_UNITS_PER_BLOCK as a define because sway and wave displacement math reads the raw position attribute before any matrix applies.

Geometry that the transparent sorter rewrites on the main thread (fluids and depth-non-writing see-through blocks such as glass) keeps full f32 attributes: the sorter's per-face keys read positions directly, and those buckets are a small fraction of the scene. isMainThreadSortedBlock mirrors the depthWrite rule in chunk-materials.ts exactly — every material therefore serves either only quantized or only float meshes.


POSITION_STRIDE​

• Const POSITION_STRIDE: 4

Quantized positions are 16-bit (vertex-quantization.ts), and WebGPU has no three-wide 16-bit vertex format: three widened every such attribute to 32 bits on its first upload, a fresh array per mesh that also replaced the geometry's own, so a chunk's positions took twice the memory and the region arenas adopted the widened type for every page. They are carried four-wide (uint16x4) instead, the fourth lane holding the vertex's sway profile (World.swayProfileTable, 0 for none): a shared cutout needs no attribute of its own for it, and every quantized chunk geometry shares one vertex layout.


PX_ROTATION​

• Const PX_ROTATION: 2

The numerical representation of the positive X rotation.


PY_ROTATION​

• Const PY_ROTATION: 0

The numerical representation of the positive Y rotation.


PZ_ROTATION​

• Const PZ_ROTATION: 4

The numerical representation of the positive Z rotation.


QUAD_LIGHT_CORNER_FLAG​

• Const QUAD_LIGHT_CORNER_FLAG: 64

Flag added to a byte whose vertex is a diagonal corner (never reached by a twist).


QUAD_LIGHT_TWIST_BIAS​

• Const QUAD_LIGHT_TWIST_BIAS: 30

Twist bias: a twist spans -30..30 (four corners of 0..15), stored 0..60.


QUAD_LIGHT_TWIST_NEUTRAL​

• Const QUAD_LIGHT_TWIST_NEUTRAL: readonly [number, number, number, number]

What a vertex without the attribute reads: no twist, not a diagonal corner. Materials bind it as the attribute's default value.


REBUILD_COOLDOWN_MS​

• Const REBUILD_COOLDOWN_MS: 200

The shortest time between two regular rebuilds of one section that is already on screen. A stream of changes the player did not make (a forest burning, water running, a neighbour's light moving) re-dirties its sections every frame, and each rebuild is a worker job plus an upload of the whole section on the main thread: started as fast as the workers freed up, they took every worker and the whole apply budget, and ground with nothing drawn yet waited behind them. A section rebuilt inside this window stays dirty and picks up everything that changed meanwhile in one rebuild when it ends. A section's first mesh and its first rebuild after a quiet spell start at once, and player edits take the urgent lane.


RED_LIGHT​

• Const RED_LIGHT: "RED"

The string representation of red light.


SCENE_OVERLAY_LAYER​

• Const SCENE_OVERLAY_LAYER: 30

The dedicated render layer that all in-world overlay objects (sprite texts, nametags, and other HUD-like scene decorations) live on. Cameras that should display overlays must call camera.layers.enable(SCENE_OVERLAY_LAYER); disabling the layer on a camera renders a clean frame with no overlays, which is how pure screenshots are captured.


SEE_THROUGH_ALPHA_TEST​

• Const SEE_THROUGH_ALPHA_TEST: 0.1

Below this texel alpha a see-through chunk material discards the texel.


SHADER_CLOCK_MAX_STEP_SECONDS​

• Const SHADER_CLOCK_MAX_STEP_SECONDS: 1

A frame's advance is taken whole up to the snap: the shared clock is the truth, so a slow frame (a 2 fps background tab) keeps pace with it rather than falling behind and snapping back every few frames. A longer stall snaps.


SHADER_CLOCK_SLEW_RATE​

• Const SHADER_CLOCK_SLEW_RATE: 0.1

Seconds of correction absorbed per second of play, as a fraction: at 0.1 a 0.1s correction plays out over a second, with the animation running 10% fast or slow meanwhile.


SHADER_CLOCK_SNAP_SECONDS​

• Const SHADER_CLOCK_SNAP_SECONDS: 1

Corrections above this are taken at once; smaller ones are slewed.


SHADER_CLOCK_WRAP_SECONDS​

• Const SHADER_CLOCK_WRAP_SECONDS: 16384

Wrap period of the shader clock, in seconds: 2^14, under 2^24 ms.


SHADOW_FACE_FORWARD​

• Const SHADOW_FACE_FORWARD: readonly [number, number, number][]

Cube-face bases for local point-light shadows, index-matched between this table (which builds the render cameras) and the reconstruction in shader.ts (which turns a fragment position back into a face UV + depth). The basis is right-handed for a camera looking down forward (right × up = -forward); change neither side alone.

Faces: 0 +X, 1 -X, 2 +Y, 3 -Y, 4 +Z, 5 -Z.


SHADOW_FACE_RIGHT​

• Const SHADOW_FACE_RIGHT: readonly [number, number, number][]


SHADOW_FACE_UP​

• Const SHADOW_FACE_UP: readonly [number, number, number][]


SHARED_CHUNK_MATERIAL_KEYS​

• Const SHARED_CHUNK_MATERIAL_KEYS: readonly ["shared-opaque", "shared-cutout", "shared-cutout-plant", "shared-cutout-cube", "shared-tufts"]

The bucket materials many blocks draw with at once.


SHARED_CUTOUT_CUBE_MATERIAL_KEY​

• Const SHARED_CUTOUT_CUBE_MATERIAL_KEY: "shared-cutout-cube"


SHARED_CUTOUT_MATERIAL_KEY​

• Const SHARED_CUTOUT_MATERIAL_KEY: "shared-cutout"


SHARED_CUTOUT_PLANT_MATERIAL_KEY​

• Const SHARED_CUTOUT_PLANT_MATERIAL_KEY: "shared-cutout-plant"


SHARED_OPAQUE_MATERIAL_KEY​

• Const SHARED_OPAQUE_MATERIAL_KEY: "shared-opaque"


SHARED_TUFTS_MATERIAL_KEY​

• Const SHARED_TUFTS_MATERIAL_KEY: "shared-tufts"

Every tufted block's tufts (Block.tufts): one double-sided cutout material on the atlas, so the mesher lays each tuft quad once and a chunk's tufts of every species are one batch.


SPOT_GUARD_SCALE​

• Const SPOT_GUARD_SCALE: 1.05

The same guard applied to a spot cone's authored outer angle.


SUNLIGHT​

• Const SUNLIGHT: "SUNLIGHT"

The string representation of sunlight.


SURFACE_OPEN_LIGHT​

• Const SURFACE_OPEN_LIGHT: Object

The voxel sunlight (0..1) over which a material's faces count as open to the sky (uSurfaceOpenLight, per material). A solid face carries the light of the air in front of it, which only the open sky keeps at its full level. A see-through block (leaves, glass, plants) carries its own voxel's light instead, which its own attenuation has already lowered: a canopy's top leaves read 13 of 15 under open sky and the leaves a block deeper 11, so they open lower and sharper.

Type declaration​

NameType
seeThroughreadonly [number, number]
solidreadonly [0.85, 0.98]

SURFACE_POCK_MEAN​

• Const SURFACE_POCK_MEAN: number

The mean brightness a pock adds to a texel over time at full chance: what the pattern averages to once texels are too small to draw it.


SURFACE_RESPONSE​

• Const SURFACE_RESPONSE: Object

How far a chunk material takes the weather (uSurfaceResponse, per material): its wetness. Zero skips the material entirely.

Type declaration​

NameTypeDescription
cutout1Leaves and other cutouts.
fluid0Fluids: their own rings, in the water's branch.
seeThrough0Blended see-through blocks (glass): never darkened.
solid1Solid ground and everything drawn like it.

SURFACE_WEATHER​

• Const SURFACE_WEATHER: Object

The tuning of every surface-weather term, shared by the shading and its CPU twins.

Type declaration​

NameTypeDescription
coatMean{ from: -0.02 = -0.02; to: 1.04 = 1.04 }The share of ground the coat covers on average at coat c, as speckle + (1 - speckle) smoothstep(from, to, drifts) (fit to the drift field, within about 1%): what a coat seen from too far to resolve its drifts is drawn as.
coatMean.from-0.02-
coatMean.to1.04-
coatSpeckle0.2-
driftContrast1.45-
driftFadeFrom0.35Blocks per pixel over which the drift patches hand over to their mean.
driftFadeTo1-
driftScaleLarge3.5The coat's drift field: two octaves (blocks per cell), weights, contrast.
driftScaleSmall1.3-
driftSoftness0.12Half-width of the coat's drift edge; the even speckle a fresh coat starts with (single texels, the first minute); and the coat past which the drifts begin to fill.
driftStart0.2-
driftWeightLarge0.7-
lineBand6.25The default half-width of the band the coat fades in over, blocks.
lineJitterLarge{ cell: 23 = 23; swing: 6 = 6 }The roughening of the snow line, blocks: two octaves of (cell, swing).
lineJitterLarge.cell23-
lineJitterLarge.swing6-
lineJitterSmall{ cell: 7 = 7; swing: 2 = 2 }-
lineJitterSmall.cell7-
lineJitterSmall.swing2-
pockCellTexels4Drop pocks: texels per cell side (one splash at a time per cell), slots per second per cell, the share of slots that splash at full rain, and each frame's end (seconds) and brightness: a dot, a plus, a faint ring.
pockChance0.6-
pockFadeFrom0.8Pixels per texel over which a pock hands over to its average shimmer.
pockFadeTo2-
pockFramesreadonly [0.04, 0.09, 0.15]-
pockGround0.35-
pockRate0.8-
pockSky0.35What a pock adds: this much of the sky's light, and of the ground's own.
pockWeightsreadonly [1, 0.8, 0.35]-
ringChance0.7-
ringCrest0.3How far a ring's crest lifts the water toward the sky it mirrors.
ringFadeFrom14-
ringFadeTo36-
ringLayers3Rain rings on still water: three layers of one-block cells, a ring's life (s), its widest radius (blocks), the wave's sharpness (radians per block), the share of slots that ring, the slope it tilts the surface by, and the distance (blocks) it fades over.
ringLife0.75-
ringRadius0.3-
ringSharpness45-
ringSlope0.25-
sideWet0.25Wetness a wall keeps, and what facing into the wind adds.
upFrom0.55World normal y over which a face counts as facing up.
upTo0.9-
wetDarken0.65Albedo scale of fully wet porous ground, and its saturation lift.
wetSaturation0.15-
windwardWet0.6-

SURFACE_WEATHER_TEXELS​

• Const SURFACE_WEATHER_TEXELS: 16

Texels per block side: the grid every ground effect snaps to.


TORCH_GAIN​

• Const TORCH_GAIN: 2.2

vec3 torchLight = smoothTorch * gain (block-light-transfer.ts).


TRANSPARENT_CUTOUT_RENDER_ORDER​

• Const TRANSPARENT_CUTOUT_RENDER_ORDER: number

See-through chunk meshes that write depth (alpha-tested cutouts such as foliage) draw before everything blended. A cutout hides what is behind its painted texels either way, and its depth then hides a blended layer behind it, where drawn after it the cutout would paint over one in front of it.


TRANSPARENT_FLUID_RENDER_ORDER​

• Const TRANSPARENT_FLUID_RENDER_ORDER: 100001


TRANSPARENT_MEDIUM_KEY​

• Const TRANSPARENT_MEDIUM_KEY: "transparentMedium"

The userData key a see-through object names its TransparentMedium under (@voxelize/particles writes the same key on its soft layers).


TRANSPARENT_OVER_FLUID_RENDER_ORDER​

• Const TRANSPARENT_OVER_FLUID_RENDER_ORDER: number

The part of a blended see-through mesh (glass) in front of the water draws here, after the water and the see-through effects in the camera's medium: water composites a copy of everything drawn before it, so a pane drawn first is painted over by the pool behind it. The part behind the nearest water face stays at TRANSPARENT_RENDER_ORDER, where that copy sees it; which part is which is decided per pixel (WaterDepthPass). Layers a host draws at whole steps above TRANSPARENT_FLUID_RENDER_ORDER (rain) still draw after both.


TRANSPARENT_RENDER_ORDER​

• Const TRANSPARENT_RENDER_ORDER: 100000


TUFTS_FACE_NAME​

• Const TUFTS_FACE_NAME: "voxelize:tufts"

The face name of a chunk geometry holding a block's tufts (Block.tufts), apart from its cube. Mirrors the mesher's TUFTS_FACE_NAME.


UNDERSIDE_CRITICAL_COS​

• Const UNDERSIDE_CRITICAL_COS: number

Cosine of the critical angle, from straight up, seen from below.


UNHANDLED_METHOD_REPLY​

• Const UNHANDLED_METHOD_REPLY: "vox-builtin:unhandled-method"

The reply a server sends when the world a call reached has no handler under its name: { method, world, handledBy? }, where handledBy names the worlds on the same server that do handle it.


UNREADABLE_TEXELS​

• Const UNREADABLE_TEXELS: Readonly<TexelClasses>

What a surface whose pixels cannot be read is taken to hold: both.


VOLUMETRIC_CLOUD_MAX_LAYERS​

• Const VOLUMETRIC_CLOUD_MAX_LAYERS: 2


VOXELIZE_BUILTIN_RELAY_EVENT​

• Const VOXELIZE_BUILTIN_RELAY_EVENT: "vox-builtin:relay"

The lane for peer effects: see Events.emitRelayed. The server must open each name with World::relay_client_event.


VOXELIZE_BUILTIN_SOUND_EFFECT_EVENT​

• Const VOXELIZE_BUILTIN_SOUND_EFFECT_EVENT: "vox-builtin:sound-effect"


VOXEL_NEIGHBORS​

• Const VOXEL_NEIGHBORS: number[][]


WATER_DEPTH_BIAS_BLOCKS​

• Const WATER_DEPTH_BIAS_BLOCKS: 0.02

How far behind a water face, in blocks, a pane fragment has to lie to count as behind it: a pane face flush with a water face (a tank's inner wall) stays in front of the water it holds.


WATER_DEPTH_DRAWN​

• Const WATER_DEPTH_DRAWN: 2


WATER_DEPTH_DRY​

• Const WATER_DEPTH_DRY: 1


WATER_DEPTH_SIDE_BEHIND​

• Const WATER_DEPTH_SIDE_BEHIND: 1


WATER_DEPTH_SIDE_FRONT​

• Const WATER_DEPTH_SIDE_FRONT: 2


WATER_DEPTH_SIDE_OFF​

• Const WATER_DEPTH_SIDE_OFF: 0

What a blended see-through fragment does with the water's depth (ChunkMaterial.waterDepthSide, see WaterDepthPass): nothing, keep only what lies behind the nearest water face, or only what lies in front of it.


WATER_DEPTH_UNKNOWN​

• Const WATER_DEPTH_UNKNOWN: 0

What the water's depth holds for a render (waterDepthState): nothing drawn for it (every pane fragment counts as behind the water, the order from before the depth existed), no water near any pane in view (every fragment is in front), or the depth of the water near the panes in view.


WATER_OPTICS​

• Const WATER_OPTICS: Readonly<{ aboveSurfaceScatterDepthScale: 0.3 = 0.3; airSideFaceAlphaScale: 0.42 = 0.42; airSideFaceGlossScale: 0 = 0.0; airSideFaceRefractionTintScale: 0.3 = 0.3; airSideFaceTintMix: 0.85 = 0.85; baseWaveFadeEndBlocks: 256 = 256; baseWaveFadeStartBlocks: 144 = 144; bedCausticDepthFalloff: 0.08 = 0.08; bedCausticStrength: 2.4 = 2.4; bodySurfaceSearchRadius: 32 = 32; bodySurfaceSearchVoxels: 4096 = 4096; causticDepthFalloff: 0.7 = 0.7; causticLensSlope: 0.1 = 0.1; causticStrength: 0.35 = 0.35; crestHighlightFull: 0.95 = 0.95; crestHighlightStart: 0.62 = 0.62; deepSurfaceClearDepth: 3 = 3; deepSurfaceExtinction: 0.08 = 0.08; deepSurfaceScatterScale: { blue: number = 0.62; green: number = 0.42; red: number = 0.35 } ; depthSmoothingSpeed: 7 = 7; distantFresnelFactor: 0.55 = 0.55; downwellingExtinction: { blue: number = 0.038; green: number = 0.055; red: number = 0.14 } ; enclosedReflectance: 0.25 = 0.25; enclosedSheenStrength: 0.5 = 0.5; enclosedTintFloor: 0.25 = 0.25; floorAbsorptionMaxDepth: 4 = 4; floorAbsorptionPathScale: 1.6 = 1.6; flowBandSpeed: 6.5 = 6.5; flowCrestSpacingBlocks: 1.5 = 1.5; flowSlopeAmplitude: 0.09 = 0.09; flowStreakStrength: 0.4 = 0.4; fluidStageDropoff: 0.1 = 0.1; fluidSurfaceHeight: 0.875 = 0.875; fresnelAlphaStrength: 0.65 = 0.65; grazingBumpKeep: 0.3 = 0.3; lightFilterFloor: 0.04 = 0.04; maxSurfaceScanBlocks: 96 = 96; nightScatterFloor: 0.06 = 0.06; nightViewExtinctionBoost: 3.5 = 3.5; paneFallbackPathBlocks: 3 = 3; paneMaxPathBlocks: 48 = 48; paneViewExtinctionScale: 0.28 = 0.28; pocketRoofScanBlocks: 16 = 16; pocketSurfaceSearchVoxels: 512 = 512; reflectionFoldbackExponent: 8 = 8; reflectionFoldbackStrength: 0.5 = 0.5; refractedSurfaceAlphaFloor: 0.8 = 0.8; refractionFullStrengthCos: 0.85 = 0.85; refractionGrazingCutoffCos: 0.3 = 0.3; refractionMaxDrawingBufferPixels: 8000000 = 8_000_000; refractionSlopeScale: 2 = 2.0; refractiveIndex: 1.333 = 1.333; rippleFadeEndBlocks: 96 = 96; rippleFadeStartBlocks: 48 = 48; ripplePatchFloor: 0.3 = 0.3; scatterFillBase: 0.03 = 0.03; scatterFillSunStrength: 0.2 = 0.2; shallowScatterDensity: 0.5 = 0.5; shallowScatterMaxMix: 0.35 = 0.35; skyExposureFull: number ; skyExposureNone: number ; skyFadeExtinction: 0.1 = 0.1; specularBroadBaseStrength: 0.04 = 0.04; specularBroadTopStrength: 0.06 = 0.06; specularMediumStrength: 0.12 = 0.12; submergedWallAlphaScale: 0.55 = 0.55; submersionFallSpeed: 11 = 11; submersionRiseSpeed: 16 = 16; sunGlintFarStartCos: 0.95 = 0.95; sunGlintFarStrength: 0.3 = 0.3; sunGlintFullCos: 0.9998 = 0.9998; sunGlintStartCos: 0.996 = 0.996; sunGlintStrength: 0.9 = 0.9; surfaceAbsorptionScale: 0.55 = 0.55; surfaceAlphaFloor: 0.58 = 0.58; surfaceNormalLayers: { bump: number = 0.05; drift: number[] ; rotation: number = 0.0; stretch: number[] ; tileBlocks: number = 40 }[] ; surfaceNormalTexture: { anisotropy: number = 4; gain: number = 0.5; latticePeriod: number = 4; octaves: number = 2; ridgeSharpness: number = 1.3; seed: number = 1337; size: number = 256 } ; surfaceScatterColor: "#37b6c5" = "#37b6c5"; undersideCleanSoftness: 0.22 = 0.22; undersideDistortion: 0.55 = 0.55; undersideFilmScale: 1.3 = 1.3; undersideGlitterCos: 0.9985 = 0.9985; undersideGlitterStrength: 1.6 = 1.6; undersideMirrorOpacity: 0.95 = 0.95; undersideMirrorScale: 1.15 = 1.15; undersideReflectionRipple: 0.14 = 0.14; undersideReflectionScale: 1.35 = 1.35; undersideRippleKeep: 0.45 = 0.45; undersideRippleShade: 0.08 = 0.08; undersideSceneGrazingShare: 0.6 = 0.6; undersideSceneTransmit: 0.85 = 0.85; undersideShallowBedDepth: 4 = 4; undersideShallowBedLift: 0.55 = 0.55; undersideShimmerStrength: 0.05 = 0.05; undersideTransmitFalloff: 2 = 2; undersideTransmitOverhead: 0.55 = 0.55; undersideWebStrength: 0.55 = 0.55; undersideWindowGain: 1.25 = 1.25; undersideWindowOpacity: 0.93 = 0.93; undersideWindowRippleKeep: 0.8 = 0.8; undersideWindowSoftness: 0.12 = 0.12; underwaterInScatterTilt: 0.35 = 0.35; viewExtinctionScale: 0.22 = 0.22; wallPathBlocks: 1 = 1.0; waterlineFadeDepth: 0.12 = 0.12; wetFloorDarken: 0.8 = 0.8 }>

The single source of truth for how water absorbs and scatters light.

Every underwater visual — fog color and density, terrain and entity light attenuation, sky dome fading, first-person prop tinting — is derived from these values so the whole scene stays physically coherent.


WATER_PANE_EXTINCTION​

• Const WATER_PANE_EXTINCTION: WaterChannelCoefficients

Extinction along the run of water seen through a tank window.


WATER_SURFACE_SCATTER_COLOR​

• Const WATER_SURFACE_SCATTER_COLOR: Color


WATER_VIEW_EXTINCTION​

• Const WATER_VIEW_EXTINCTION: WaterChannelCoefficients


WideBranchBits​

• Const WideBranchBits: Object

The state wide branch voxels keep in raw bits 16-23. Mirrors WideBranchBits in the mesher crate.

Type declaration​

NameTypeDescription
isCut(raw: number) => boolean-
shellOffset(raw: number) => [number, number]-
size(raw: number) => number-

WideBranchSection​

• Const WideBranchSection: Object

A branch section wider than one voxel: one square tube reaching radius texels each way from the axis through its core cell's centre, cut into the cells it covers. Mirrors WideBranchSection in the mesher crate.

Type declaration​

NameType
cellBoxes(radius: number, texelsPerBlock: number, da: number, db: number) => [number, number, number, number][]
reach(radius: number, texelsPerBlock: number) => number
span(radius: number, texelsPerBlock: number, d: number) => [number, number]

Y_ROT_MAP​

• Const Y_ROT_MAP: [number, number][] = []

A rotational map used to get the closest y-rotation representation to a y-rotation value.

Rotation value -> index


Y_ROT_MAP_EIGHT​

• Const Y_ROT_MAP_EIGHT: [number, number][] = []


Y_ROT_MAP_FOUR​

• Const Y_ROT_MAP_FOUR: [number, number][] = []


Y_ROT_SEGMENTS​

• Const Y_ROT_SEGMENTS: 16

The amount of Y-rotation segments should be allowed for y-rotatable blocks. In other words, the amount of times the block can be rotated around the y-axis within 360 degrees.

The accepted Y-rotation values will be from 0 to Y_ROTATION_SEGMENTS - 1.


artFunctions​

• Const artFunctions: Object

A preset of art functions to draw on canvas boxes.

Type declaration​

NameType
drawCrownArtFunction
drawMoon(moonRadius: number, moonColor: string, phase: number) => (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void
drawStars(starCount: number, starColors: string[], seed?: number) => (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void
drawSun(sunRadius: number, sunColor: string) => (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void

customShaders​

• Const customShaders: Object

Ready-made customizations for World.customizeMaterial: a block that sways with a fixed profile baked into its program (sway), or the same with cross-quad shading, fixed sun incidence and no face shade (swayCross). Blocks in the shared cutout buckets should prefer World.setBlockSway, which keeps them in the bucket.

Type declaration​

NameType
sway(options: Partial<Omit<ChunkSwayConstants, "isCrossShaded">>) => Partial<ChunkMaterialOptions>
swayCross(options: Partial<Omit<ChunkSwayConstants, "isCrossShaded">>) => Partial<ChunkMaterialOptions>

defaultAirlightOptions​

• Const defaultAirlightOptions: LocalLightAirlightOptions


defaultArmsOptions​

• Const defaultArmsOptions: ArmsOptions


defaultBodyOptions​

• Const defaultBodyOptions: BodyOptions


defaultCharacterOptions​

• Const defaultCharacterOptions: CharacterOptions


defaultCreatureBodyOptions​

• Const defaultCreatureBodyOptions: CreatureBodyOptions


defaultCreatureHeadOptions​

• Const defaultCreatureHeadOptions: CreatureHeadOptions


defaultCreatureLegOptions​

• Const defaultCreatureLegOptions: CreatureLegOptions


defaultCreatureOptions​

• Const defaultCreatureOptions: CreatureOptions


defaultHeadLedBodyOptions​

• Const defaultHeadLedBodyOptions: HeadLedBodyOptions


defaultHeadOptions​

• Const defaultHeadOptions: HeadOptions


defaultLegsOptions​

• Const defaultLegsOptions: LegOptions


defaultLocalLightsOptions​

• Const defaultLocalLightsOptions: LocalLightsOptions


defaultMemoryPressureOptions​

• Const defaultMemoryPressureOptions: MemoryPressureOptions


defaultOrderIndependentTransparencyOptions​

• Const defaultOrderIndependentTransparencyOptions: OrderIndependentTransparencyOptions


defaultVolumetricCloudsOptions​

• Const defaultVolumetricCloudsOptions: VolumetricCloudsOptions


defaultWorldClientOptions​

• Const defaultWorldClientOptions: WorldClientOptions


ownedTextureSource​

• Const ownedTextureSource: SkinnedTextureSource


perDrawInputs​

• Const perDrawInputs: ConstNode<"float", number>

The node a material whose inputs are plain values holds. three re-uploads a node material's bindings each draw only while the material holds a node of its own (NodeMaterialObserver.containsNode), and otherwise only when one of three's own material properties changes; every material of a family shares this one, so it keeps their one graph.


restArgsSchema​

• Const restArgsSchema: ZodObject<{ rest: ZodOptional<ZodString> }, "strip", ZodTypeAny, { rest?: string }, { rest?: string }>

Schema for commands that take a free-form string input. Use this for commands that need the raw rest string.


sharedEntityShadowUniforms​

• Const sharedEntityShadowUniforms: EntityShadowUniforms

The one copy of the world's lighting every in-world entity material reads (creatures, characters, the arm, drops, accessories): the World writes it each frame (updateShaderLighting, then the cascade matrices again once the maps are drawn), so no owner copies it, and one graph serves every material that reads it.


transparentSortStats​

• Const transparentSortStats: TransparentSortStats


worldShadingGroup​

• Const worldShadingGroup: default

The world's shading inputs that every chunk material (and the far layer, entities, effects) reads alike: fog, sky, sun, shadows, water, wind, clock. One shared group, so they live in one uniform buffer per render context, written once a render instead of once a draw. A shared group's buffer is uploaded only when its version moves, so it updates per render (as three's own renderGroup): without one it would hold its first values for good.

Functions​

TRANSPARENT_SORT​

▸ TRANSPARENT_SORT(camera, media?): (a: TransparentSortItem, b: TransparentSortItem) => number

The transparent sort for renderer.setTransparentSort: render order first (see-through effects placed by their medium, see transparentEffectRenderOrder, or every item by its band when the source draws order-independently), then back to front. Without media every effect is taken to share the camera's air.

Parameters​

NameType
cameraObject3D<Object3DEventMap>
media?TransparentMediumSource

Returns​

fn

▸ (a, b): number

Parameters​
NameType
aTransparentSortItem
bTransparentSortItem
Returns​

number


acesFit​

▸ acesFit(x): number

The ACES fit the chunk fragment tone-maps its light multiplier through.

Parameters​

NameType
xnumber

Returns​

number


acesFitNode​

▸ acesFitNode<T>(x): T

The ACES fit the chunk light multiplier is tone-mapped through.

Type parameters​

NameType
Textends FloatNode | Vec3Node

Parameters​

NameType
xT

Returns​

T


acesToneMap​

▸ acesToneMap(x): number

The ACES fit the chunk fragment tone-maps its light through. Tops out near 1.03, so a level-15 emitter and open noon sun both land displayable.

Parameters​

NameType
xnumber

Returns​

number


advanceWorldClock​

▸ advanceWorldClock(clock, deltaSeconds, timePerDay): WorldClock

Advance the clock by deltaSeconds, wrapping the time of day and counting the wrap as a completed day — the same step the server takes each tick.

Parameters​

NameType
clockWorldClock
deltaSecondsnumber
timePerDaynumber

Returns​

WorldClock


analyticColorFromLevels​

▸ analyticColorFromLevels(r, g, b): [number, number, number]

Default analytic colour of an emitter whose flood levels are r, g, b: each channel below the brightest keeps its share of the flood's hue (see hueLevels), so the analytic hue at a light's core equals the flood's hue there.

Parameters​

NameType
rnumber
gnumber
bnumber

Returns​

[number, number, number]


analyzeLightOperations​

▸ analyzeLightOperations(world, processedUpdates): LightOperations

Parameters​

NameType
worldVoxelLightVolume
processedUpdatesProcessedUpdate[]

Returns​

LightOperations


annotateIncomingMessages​

▸ annotateIncomingMessages(messages, byteSizes): void

Parameters​

NameType
messagesMessageProtocol[]
byteSizesnumber[]

Returns​

void


applyEntityLight​

▸ applyEntityLight(material, light, cones): void

Light an entity's material by the voxel light at its owner (light) with the light cones screen-blended in, and draw the beams' in-scattered glow over its finished colour, so a body standing in a beam neither stays dark nor cuts a hole in the shaft. Composes over the material's own colour and output nodes; restore hands them back.

Parameters​

NameType
materialNodeMaterial
lightEntityLightValue
conesObject
cones.coneCountValueUniform<0>
cones.conesArrayUniform<Vector4, "vec4">

Returns​

void


applySurfaceCoatFace​

▸ applySurfaceCoatFace(uniforms, pixels): boolean

Colour the far layer's coat as a face's texels average (pixels, RGBA bytes as the atlas holds them), so distant snow matches the blocks laid near the player. Returns false, keeping the colour, while the texels are not readable yet.

Parameters​

NameType
uniformsPick<{ surfaceCoatColor: ValueUniform<Color> ; surfaceWeather: ValueUniform<Vector3> ; surfaceWeatherLine: ValueUniform<Vector4> ; surfaceWeatherMap: TextureNode<"vec4"> ; surfaceWeatherWindow: ValueUniform<Vector4> ; surfaceWind: ValueUniform<Vector4> }, "surfaceCoatColor">
pixelsArrayLike<number>

Returns​

boolean


arrayUniform​

▸ arrayUniform<T, N>(values, type): ArrayUniform<T, N>

Type parameters​

NameType
Textends Vector3 | Vector2 | Color | Vector4
Nextends ArrayElementType

Parameters​

NameType
valuesT[]
typeN

Returns​

ArrayUniform<T, N>


atlasSurface​

▸ atlasSurface(partCount, emissiveFace?): EntitySurfaceOptions

Parameters​

NameType
partCountnumber
emissiveFace?Object
emissiveFace.colorColor
emissiveFace.faceIndexnumber
emissiveFace.partIndexnumber

Returns​

EntitySurfaceOptions


auditLightCones​

▸ auditLightCones(root): LightConeAuditEntry[]

Every visible mesh under root drawn with a material that neither takes the light cones nor is exempt from them. Lines, points and sprites are skipped (they have no surface to light), as are instanced meshes drawing no instances, self-illuminated materials and additive glows, which already shine past the dark.

Parameters​

NameType
rootObject3D<Object3DEventMap>

Returns​

LightConeAuditEntry[]


band​

▸ band(x, steps): number

bandNode's twin.

Parameters​

NameType
xnumber
stepsnumber

Returns​

number


bandNode​

▸ bandNode(x, steps): FloatNode

x clamped to 0..1 and quantised to steps flat levels, 0 and 1 included (steps 2 is a hard threshold at one half).

Parameters​

NameType
xFloatNode
stepsnumber | FloatNode

Returns​

FloatNode


biomeTintAttribute​

▸ biomeTintAttribute(positions, lights, corners, size, positionUnits?, positionBias?): BufferAttribute

A compact, optional world color field. No new voxel or inventory types.

Parameters​

NameTypeDefault value
positionsFloat32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>undefined
lightsInt32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>undefined
cornersUint8Array<ArrayBufferLike>undefined
sizenumberundefined
positionUnitsnumber1
positionBiasnumber0

Returns​

BufferAttribute


biomeTintAttributeAt​

▸ biomeTintAttributeAt(«destructured»): BufferAttribute

The same field for geometry that belongs to no one chunk: each vertex takes the corners of the chunk its world position falls in, so a mesh lifted out of the world keeps the colours of the ground it stood on.

Parameters​

NameType
«destructured»BiomeTintAtOptions

Returns​

BufferAttribute


blendedKindOf​

▸ blendedKindOf(material): BlendedKind | null

Whether a material can accumulate, and how: it blends (normal blending, or custom blending equal to it, straight or premultiplied), writes colour and no depth, and is a node material whose output the accumulation's encoder reads (three hands a fragmentNode material no render-target outputs, so one cannot accumulate).

Parameters​

NameType
materialMaterial<MaterialEventMap>

Returns​

BlendedKind | null


blockAtlasSurface​

▸ blockAtlasSurface(partCount): EntitySurfaceOptions

Parameters​

NameType
partCountnumber

Returns​

EntitySurfaceOptions


blockCastsShadow​

▸ blockCastsShadow(block): boolean

Whether a block's geometry is drawn into the sun's shadow maps. The block may say so itself (castsShadow); otherwise the rule of thumb: solids and light-attenuating cutouts (leaves) cast, fluids and clear see-through blocks (glass, barriers) do not.

Parameters​

NameType
blockPick<Block, "castsShadow" | "isFluid" | "isSeeThrough" | "lightAttenuation">

Returns​

boolean


blockLightAdapt​

▸ blockLightAdapt(r, g, b, torchDominance, out): [number, number, number]

Lamplight white balance (mirrors the chunk fragment): block light moves toward its own luminance by adaptation x torchDominance, before the warm tint, so a flame reads warm rather than saturated. Daylight (dominance 0) is untouched. Writes out.

Parameters​

NameType
rnumber
gnumber
bnumber
torchDominancenumber
out[number, number, number]

Returns​

[number, number, number]


blockLightAdaptNode​

▸ blockLightAdaptNode(light, torchDominance): Node<"vec3">

Lamplight white balance: block light moves toward its own luminance by adaptation x torchDominance before the warm tint, so a flame reads warm rather than saturated (blockLightAdaptNode on the CPU).

Parameters​

NameType
lightVec3Node
torchDominanceFloatNode

Returns​

Node<"vec3">


blockLightCurve​

▸ blockLightCurve(level): number

Geometric per-level map: level 15 -> 1, each level down x ratio, 0 -> 0.

Parameters​

NameType
levelnumber

Returns​

number


blockLightCurve1Node​

▸ blockLightCurve1Node(level): FloatNode

Parameters​

NameType
levelFloatNode

Returns​

FloatNode


blockLightCurveFilledNode​

▸ blockLightCurveFilledNode(...args): Node<"vec3">

Flood level (0..1 per channel) to light: brightness from the brightest channel down the geometric per-level curve, hue from the channels' level gaps (BLOCK_LIGHT_TRANSFER.hueLevels). A channel's share fades in over its first level, and a channel that has run out borrows the hue of the analytic lights around the fragment (fill, zero when there are none), capped by what its gap still allows. The CPU twin is blockLightCurveRGB (block-light-transfer.ts); change neither alone.

Parameters​

NameType
...args[Vector3 | Node<"vec3">, Vector3 | Node<"vec3">]

Returns​

Node<"vec3">


blockLightCurveNode​

▸ blockLightCurveNode(level): Vec3Node

Parameters​

NameType
levelVec3Node

Returns​

Vec3Node


blockLightCurveRGB​

▸ blockLightCurveRGB(r, g, b, out, fill?): [number, number, number]

The curve for a flood colour (levels 0..1 per channel), as the chunk fragment evaluates it: brightness from the brightest channel, hue from the level gaps (see hueLevels). Writes out.

A channel that has run out (level 0) while the brightest one is still lit has lost its gap, and with it its share: a lamp's blue ends seven levels before its red, its green three, so the last blocks of its pool went orange and then pure red. fill hands those channels a share back: the colour of the analytic lights around the point (their channel ratios, so a lamp's amber), weighted by how much of that colour lies on the flood's own brightest channel and capped by the most the dead channel could still hold (its gap is at least the peak). Channels still lit keep their own gap's share exactly, and a channel the fill also lacks stays dark, so a pure red light stays red. No fill (no analytic light near, the off tier): channels at 0 stay 0.

Parameters​

NameType
rnumber
gnumber
bnumber
out[number, number, number]
fill?readonly [number, number, number]

Returns​

[number, number, number]


blockLightFloodRemainder​

▸ blockLightFloodRemainder(args): number

CPU mirror of the chunk shader's flood-remainder computation: the fraction of the baked flood term a point keeps, given the analytic luminance claim at that point (unfaded, scaled by the effective ownership), the raw flood level (0..1, max channel), and the window-rim fade (LocalLightSample.windowFade). Matches the shader exactly: the owned remainder uses the smoothstep denominator, then mixes toward 1 by the rim fade — the same crossfade the analytic contribution rides, so the combined block light stays continuous across the rim on entities and blocks alike. Callers may reuse one scratch args object; nothing is retained.

Parameters​

NameType
argsObject
args.floodLevelnumber
args.scaledClaimnumber
args.windowFadenumber

Returns​

number


blockLightKernelFalloff​

▸ blockLightKernelFalloff(...args): Node<"float">

Windowed inverse square: a hot core of kernelCoreRatio x range that fades evenly to zero at range (localLightFalloff is its CPU twin). d2 is the squared distance the core is measured with, which a ceiling light flattens (blockLightMountFade).

Parameters​

NameType
...args[number | Node<"float"> | Node<"uint">, number | Node<"float"> | Node<"uint">, number | Node<"float"> | Node<"uint">]

Returns​

Node<"float">


blockLightMountFade​

▸ blockLightMountFade(...args): Node<"float">

0 on a ceiling a light hangs just under (its falloff flattens there), 1 elsewhere (BLOCK_LIGHT_TRANSFER.mountNear/mountFar).

Parameters​

NameType
...args[Vector3 | Node<"vec3">, Vector3 | Node<"vec3">]

Returns​

Node<"float">


blockLightOwnershipGain​

▸ blockLightOwnershipGain(scaledClaim): number

The ownership gain for a claim (already scaled by the tier's ownership).

Parameters​

NameType
scaledClaimnumber

Returns​

number


blockLightToneMap​

▸ blockLightToneMap(r, g, b, torchDominance, out): [number, number, number]

The tone map: per-channel ACES in daylight, blending toward a hue-preserving ACES (every channel scaled by the peak's mapping, then rescaled to the per-channel result's luminance, times lampWhite) as block light dominates: the light keeps its colour, the room keeps its brightness. Writes out.

Parameters​

NameType
rnumber
gnumber
bnumber
torchDominancenumber
out[number, number, number]

Returns​

[number, number, number]


blockLightWarmTint​

▸ blockLightWarmTint(torchR, torchG, torchB, out): [number, number, number]

The warm tint for a torch colour, faded toward white by the torch light's saturation, so a coloured emitter is not pushed further toward red.

Parameters​

NameType
torchRnumber
torchGnumber
torchBnumber
out[number, number, number]

Returns​

[number, number, number]


blockSlot​

▸ blockSlot(id, count): SlotContent

Parameters​

NameType
idnumber
countnumber

Returns​

SlotContent


branchAABBsAt​

▸ branchAABBsAt(vx, vy, vz, lookup): AABB[]

The boxes the branch voxel at vx, vy, vz is drawn as, in blocks of the voxel: what bodies collide with and rays pick. A one-voxel branch, a fin, or a cell of a wide section (a core, or a shell drawing its core's tube); none for a cut core or a shell whose core is gone. The same layout as branch_layout_at in crates/mesher/src/mesher/branch.rs, box for box (branch-parity.test.ts holds the two to the server's numbers).

Parameters​

NameType
vxnumber
vynumber
vznumber
lookupBranchBlockLookup

Returns​

AABB[]


branchHoldsWater​

▸ branchHoldsWater(shape, stage): boolean

BranchShape::holds_water in crates/mesher/src/mesher/branch.rs.

Parameters​

NameType
shapeBranchShape
stagenumber

Returns​

boolean


branchRadius​

▸ branchRadius(shape, stage): number

The radius, in texels, a voxel of shape holds at stage.

Parameters​

NameType
shapeBranchShape
stagenumber

Returns​

number


buildCoverageMask​

▸ buildCoverageMask(meshedChunks, originCx, originCz, size, into?): Uint8Array

The chunk-coverage mask: size x size texels of chunk columns from (originCx, originCz), 255 where a chunk draws real terrain (or is still on its way, pendingChunksWithin) and 0 where the far layer may show. Chunks outside the window are ignored.

Parameters​

NameType
meshedChunksIterable<readonly [number, number], any, any>
originCxnumber
originCznumber
sizenumber
into?Uint8Array<ArrayBufferLike>

Returns​

Uint8Array


buildLightJobs​

▸ buildLightJobs(lightOps, batchId, options, allocateJobId): LightJob[]

Parameters​

NameType
lightOpsLightOperations
batchIdnumber
optionsVoxelLightVolumeOptions
allocateJobId(color: LightColor) => string

Returns​

LightJob[]


buildSkinnedPartsGeometry​

▸ buildSkinnedPartsGeometry(parts): THREE.BufferGeometry

Bakes a part list into the geometry a SkinnedInstancePool draws: every vertex carries its bone (skinIndex/skinWeight), its joint (pivotOffset) and its atlas row (partIndex).

Parameters​

NameType
partsreadonly SkinnedPart[]

Returns​

THREE.BufferGeometry

Example

const BONE = { BODY: 0, HEAD: 1 } as const;
const parts: SkinnedPart[] = [
{ bone: BONE.BODY, size: [0.6, 0.5, 0.9], at: [0, 0.55, 0], paint: "#8a6a4a" },
{ bone: BONE.HEAD, size: [0.4, 0.4, 0.4], at: [0, 0.8, 0.55],
pivot: [0, 0.7, 0.4], paint: "#9b7b5a" },
];
const geometry = buildSkinnedPartsGeometry(parts);

callbackRenderer​

▸ callbackRenderer(renderer): Renderer

The renderer an onBeforeRender / onAfterRender callback is handed. three's typings still name it WebGLRenderer; every renderer here is a WebGPURenderer (or its WebGL 2 fallback backend), a Renderer.

Parameters​

NameType
rendererunknown

Returns​

Renderer


canCutSolidTexels​

▸ canCutSolidTexels(material): material is ChunkMaterial

Whether a material can drop its solid texels after its alpha test: the chunk material carries the cut (cutsSolidTexels); any other material has no place for it.

Parameters​

NameType
materialMaterial<MaterialEventMap>

Returns​

material is ChunkMaterial


canvasBoxAtlasLayout​

▸ canvasBoxAtlasLayout(sizes): CanvasBoxAtlasLayout

Lay a layer's six face canvases out in one row: each face sits in a cell whose every texel is the face or its repeat, so the atlas has no empty texel for a distant mip level to average in.

Parameters​

NameType
sizesRecord<BoxFace, { height: number ; width: number }>

Returns​

CanvasBoxAtlasLayout


canvasBoxSegments​

▸ canvasBoxSegments(dims, texelsPerBlock): Object

Segment (texel) counts for a box painted at texelsPerBlock pixels per world unit: each axis gets as many texels as its length asks for, at least one, so every face has square texels whatever the box's proportions. This is what CanvasBoxOptions.texelsPerBlock resolves to.

Parameters​

NameType
dimsObject
dims.depthnumber
dims.heightnumber
dims.widthnumber
texelsPerBlocknumber

Returns​

Object

NameType
depthSegmentsnumber
heightSegmentsnumber
widthSegmentsnumber

capCadenceHz​

▸ capCadenceHz(desiredHz, maxHz, knee): number

Parameters​

NameType
desiredHznumber
maxHznumber
kneenumber

Returns​

number


clampLiftToClearance​

▸ clampLiftToClearance(lift, chassisBottomY, groundY, clearance): number

Parameters​

NameType
liftnumber
chassisBottomYnumber
groundYnumber
clearancenumber

Returns​

number


classifyTexels​

▸ classifyTexels(pixels, cuts): TexelClasses

Parameters​

NameType
pixelsArrayLike<number>
cutsTexelAlphaCuts

Returns​

TexelClasses


clipDepthTo01​

▸ clipDepthTo01(z): FloatNode

Clip-space depth (clip.z / clip.w of a projection three built for the renderer) to the 0..1 a depth texture stores: WebGPU's clip depth already is it, WebGL's runs -1..1. Picked when the shader is built, by the backend it is built for.

Parameters​

NameType
zFloatNode

Returns​

FloatNode


clockStepSince​

▸ clockStepSince(deltaSeconds, nowSeconds, syncedAtSeconds): number

The part of a frame's deltaSeconds the local clock still has to advance. Server time arrives between frames and is taken as "now", so it already covers the stretch of the frame before it landed; adding the whole delta on top counted that stretch twice. At 60fps that is a few milliseconds, but after a hitch or in a throttled tab it put the clock most of a frame ahead, and the next STATS snapped it back: cloud drift and water lurched forward and back twice a second. syncedAtSeconds is when the server time was taken, on the same clock as nowSeconds; -Infinity when no sync landed since the last frame.

Parameters​

NameType
deltaSecondsnumber
nowSecondsnumber
syncedAtSecondsnumber

Returns​

number


colorTemperatureToRgb​

▸ colorTemperatureToRgb(kelvin): [number, number, number]

Kelvin to linear RGB, Tanner Helland's fit, normalized so the hottest channel is 1. Evaluated once per registration, never per frame.

Parameters​

NameType
kelvinnumber

Returns​

[number, number, number]


compareChunkRequestPriority​

▸ compareChunkRequestPriority(a, b): number

Parameters​

NameType
aChunkRequestCandidate
bChunkRequestCandidate

Returns​

number


componentOf​

▸ componentOf(vector, index): Node<"float">

Component index (a runtime int) of a vector node, as WGSL v[i] / GLSL v[i]: the typings only declare element on arrays.

Parameters​

NameType
vectorNode<"vec2"> | Node<"vec3"> | Node<"vec4">
indexNode<"int"> | Node<"uint">

Returns​

Node<"float">


composeEntityLight​

▸ composeEntityLight(s, out): Color

CPU mirror of the chunk fragment's light composition, for objects lit as a whole rather than per fragment: players and peers, block-entity meshes, dropped models. Writes the multiplier for the object's albedo into out.

The terrain screen-blends its sun and block-light terms and tone-maps the result, so a level-15 emitter under a fragment lands near 1.0. Composing the same inputs additively and leaving them untonemapped — sun plus ambient plus torch plus every analytic light in the cell — put a player at 1.5–2.5× the brightness of the block under their feet: the white blob on the lantern floor, and the glowing swimmer beside an underwater lamp. Following the fragment program step for step keeps the object and the ground it stands on in agreement under every sky and in every water.

Skipped on purpose, because a whole object has none of the inputs: vertex AO, the per-axis face shade, the bright-texture sun reduction, cone lights, and the emissive bypass. Zero cluster light is an exact identity through the blend, matching the shader's guarded cluster stage.

Parameters​

NameType
sEntityLightSample
outColor

Returns​

Color


computeBodySupport​

▸ computeBodySupport(state, bodyX, bodyZ, maxTilt, minPlantedCount, outNormal): number | null

Parameters​

NameType
stateGaitState
bodyXnumber
bodyZnumber
maxTiltnumber
minPlantedCountnumber
outNormalVector3

Returns​

number | null


computeHeadLook​

▸ computeHeadLook(headLookTarget, entityX, entityY, entityZ, currentBodyDirectionY, newDirectionY, smoothedHeadYaw, smoothedHeadPitch, motion?): HeadLookResult

Parameters​

NameTypeDescription
headLookTarget[number, number, number]-
entityXnumber-
entityYnumber-
entityZnumber-
currentBodyDirectionYnumber-
newDirectionYnumber-
smoothedHeadYawnumber-
smoothedHeadPitchnumber-
motion?HeadLookMotionThe head's springs: an eased turn on real time. Without it the head closes a fixed share of the gap every frame, which snaps.

Returns​

HeadLookResult


computeNormalsFromBuffers​

▸ computeNormalsFromBuffers(positions, indices): Float32Array

Flat per-face normals for indexed chunk geometry: every vertex of a triangle gets that triangle's normal (chunk quads never share vertices across faces). Dependency-free so a worker can import it alone.

Parameters​

NameType
positionsArrayLike<number>
indicesArrayLike<number>

Returns​

Float32Array


computeQuadLightTwist​

▸ computeQuadLightTwist(lights, indices): Uint8Array

Per-vertex twist bytes (four per vertex) for a chunk geometry's packed lights and indices. Quads that do not follow the mesher's index pattern keep the neutral bytes.

Parameters​

NameType
lightsArrayLike<number>
indicesArrayLike<number>

Returns​

Uint8Array


configurePerfLogging​

▸ configurePerfLogging(isEnabled): void

Parameters​

NameType
isEnabledboolean

Returns​

void


countLightSeeds​

▸ countLightSeeds(ops): number

Every removal and flood seed across all colors — the work a batch buys.

Parameters​

NameType
opsLightOperations

Returns​

number


createBudgetedDrain​

▸ createBudgetedDrain(budgetMs, work, onDrained?): BudgetedDrain

Parameters​

NameType
budgetMsnumber
work() => BudgetedWorkOutcome
onDrained?() => void

Returns​

BudgetedDrain


createChainBinding​

▸ createChainBinding(boneIndices, restJoints): ChainBinding

Parameters​

NameType
boneIndicesreadonly number[]
restJointsreadonly Vector3[]

Returns​

ChainBinding


createChunkUniforms​

▸ createChunkUniforms(): Object

Every world-wide input the chunk shading reads, as TSL nodes: node.value is what the host writes, as it wrote the { value } records these replace. One set per world (ChunkRenderer.uniforms).

Returns​

Object

NameTypeDescription
aerialHazeValueUniform<Vector4>Aerial perspective (skyFog): x the haze per block of path at the base height, y that base height, z the height over which the air thins by e, w the most of the sky it can lay over a surface. Off (w 0) unless the host turns it on.
aoValueUniform<Vector4>-
atlasSizeValueUniform<16>-
baseAmbientValueUniform<0.005>-
cameraSubmersionValueUniform<0>-
cameraWaterPlaneYValueUniform<0>-
faceShadesValueUniform<Vector4>-
farCoverValueUniform<Vector4>x, y: mask origin in chunk columns; z: blocks per chunk; w: texels per side.
farCoverMaskTextureNode<"vec4">The far layer's chunk-coverage mask and its placement, written by FarTerrain: chunk fragments read them to yield their outer half chunk to the far layer across a dithered band (see far-seam.ts).
farSeamValueUniform<0>The seam band's ramp scale; 0 keeps the loaded edge hard.
fogColorValueUniform<Color>-
fogFarValueUniform<200>-
fogHeightDensityValueUniform<0.005>-
fogHeightOriginValueUniform<80>-
fogNearValueUniform<100>-
fogVerticalBlendValueUniform<0>0..1 blend from horizontal to true 3D fog distance (caves).
lightIntensityAdjustmentValueUniform<0.8>-
minLightLevelValueUniform<0.04>-
pigmentTintsArrayUniform<Vector3, "vec3">The colour table: 16 linear RGB multipliers a face with a pigment mask takes by its voxel stage. Entry 0 is the untinted material.
sceneColorTextureNode<"vec4">What the water refracts: a copy of the frame drawn before it, or with order-independent transparency the scene target's own colour, read while the blended layers draw elsewhere.
sceneDepthTextureNode<"vec4">-
sceneDepthReadyValueUniform<0>-
sceneTextureSizeValueUniform<Vector2>-
showGreedyDebugValueUniform<0>-
skyDiscRadiiValueUniform<Vector2>-
skyFogBottomColorValueUniform<Color>-
skyFogDimensionValueUniform<2000>-
skyFogExponentValueUniform<0.6>-
skyFogExponent2ValueUniform<1.2>-
skyFogMiddleColorValueUniform<Color>-
skyFogOffsetValueUniform<0>-
skyFogStrengthValueUniform<1>-
skyFogTopColorValueUniform<Color>-
skyFogVoidOffsetValueUniform<1200>-
skyGlowColorValueUniform<Color>-
skyGlowSunDirectionValueUniform<Vector3>The sky's own light, the same values the sky dome draws with (Sky.glow), so every fogged surface glows toward the sun and moon exactly as the sky behind it does. Black adds nothing.
skyMoonDiscColorValueUniform<Color>-
skyMoonFaceValueUniform<Vector3>The moon's face: its phase as moonPhaseLit reads it in xy ((0, 1) is full), and in z how many texels across it is drawn (0: smooth).
skyMoonHaloColorValueUniform<Color>-
skySunDiscColorValueUniform<Color>-
skySunHaloColorValueUniform<Color>-
stageTintsArrayUniform<Vector3, "vec3">Biome tints by stage index (linear RGB multipliers).
sunlightIntensityValueUniform<1>-
surfaceCoatColorValueUniform<Color>-
surfaceWeatherValueUniform<Vector3>-
surfaceWeatherLineValueUniform<Vector4>-
surfaceWeatherMapTextureNode<"vec4">-
surfaceWeatherWindowValueUniform<Vector4>-
surfaceWindValueUniform<Vector4>-
timeValueUniform<0>-
underwaterAmbientValueUniform<Color>-
underwaterViewScaleValueUniform<1>The water's view extinction against its tuned clarity (sun-scaled).
waterDepthTextureNode<"vec4">The depth of the water near the panes in view, and how to read it (WaterDepthPass): which side of the water each pane fragment draws.
waterDepthClipValueUniform<Vector2>-
waterDepthStateValueUniform<0>-
waterDepthViewportValueUniform<Vector2>-
waterExitDepthTextureNode<"vec4">Behind each pixel, the nearest place the water near the panes ends (WaterDepthPass), and the frame's own depth as the water starts to draw: the two ends of the run of water a tank window shows.
waterExitReadyValueUniform<0>-
waterNormalMapTextureNode<"vec4">-
waterRefractionReadyValueUniform<0>-
waterRefractionStrengthValueUniform<0.08>-
windDirectionValueUniform<Vector2>-
windOffsetValueUniform<Vector2>-
windSpeedValueUniform<1>-

createCrustedFluidSurface​

▸ createCrustedFluidSurface(options?): CrustedFluidSurface

The crusted fluid surface: its lighting hook (the crust replaces the lit colour), its derivative preparation and its wave scale, over uniforms a game can tune live.

Parameters​

NameType
optionsCrustedFluidShaderOptions

Returns​

CrustedFluidSurface


createEntityShadowBody​

▸ createEntityShadowBody(selfBounds?): EntityShadowBody

Parameters​

NameType
selfBoundsVector4

Returns​

EntityShadowBody


createEntityShadowUniforms​

▸ createEntityShadowUniforms(make?): Object

A lighting block. make places its values: the world's shared block is written every frame as the sun moves, so it lives in the world group (one buffer, uploaded once a render); in each material's own group, every creature draw rewrote its buffer for the sun alone (~80 writes a frame in a crowd of 500). A never-written block (the studio's) keeps the default.

Parameters​

NameTypeDefault value
make<T>(value: T, type?: "int" | "uint") => ValueUniform<T>ownUniform

Returns​

Object

NameType
uCascadeSplit0ValueUniform<16>
uCascadeSplit1ValueUniform<48>
uCascadeSplit2ValueUniform<128>
uShadowBiasValueUniform<0.0005>
uShadowDepthPerBlockValueUniform<0>
uShadowMap0TextureNode<"vec4">
uShadowMap1TextureNode<"vec4">
uShadowMap2TextureNode<"vec4">
uShadowMatrix0ValueUniform<Matrix4>
uShadowMatrix1ValueUniform<Matrix4>
uShadowMatrix2ValueUniform<Matrix4>
uShadowNormalBiasValueUniform<0.01>
uShadowStrengthValueUniform<1>
uSunColorValueUniform<Color>
uSunDirectionValueUniform<Vector3>
uSunlightIntensityValueUniform<1>

createPerfTraceId​

▸ createPerfTraceId(): string

Returns​

string


createShaderLightingUniforms​

▸ createShaderLightingUniforms(): Object

The sun, the cascades and the water: the lighting half of the chunk shading's inputs (ChunkRenderer.shaderLightingUniforms).

Returns​

Object

NameTypeDescription
ambientColorValueUniform<Color>-
bedCausticScaleValueUniform<1>0..1 scale on the caustic net seen on submerged faces from below.
cascadeSplit0ValueUniform<16>-
cascadeSplit1ValueUniform<48>-
cascadeSplit2ValueUniform<128>-
celestialDirectionValueUniform<Vector3>The celestial disc above the horizon as the sky box actually draws it (getVisibleDiscDirection): the sun by day, the moon by night, never clamped or tilted. Specular reflections read this, so the sun on the water sits under the sun in the sky.
directSunlightValueUniform<1>The share of the sun (the moon by night) that reaches the world as a direct beam, 0..1: 1 under a clear sky, falling as cloud veils the disc. What only a beam draws (glints on water, caustics, the disc seen through the surface from below) scales by it; diffuse daylight (sunlightIntensity) does not. A host with weather lowers it.
shadowBiasValueUniform<0.00018>-
shadowDebugModeValueUniform<0>-
shadowDepthPerBlockValueUniform<0>How much shadow-map depth one block toward the sun spans (cascade 0), for an entity measuring its own body in the map.
shadowMap0TextureNode<"vec4">-
shadowMap1TextureNode<"vec4">-
shadowMap2TextureNode<"vec4">-
shadowMatrix0ValueUniform<Matrix4>-
shadowMatrix1ValueUniform<Matrix4>-
shadowMatrix2ValueUniform<Matrix4>-
shadowNormalBiasValueUniform<0.0015>-
shadowSideFaceBiasScaleValueUniform<1>-
shadowSlopeBiasMinValueUniform<0.00012>-
shadowSlopeBiasScaleValueUniform<0.0012>-
shadowStrengthValueUniform<1>-
shadowTopFaceBiasScaleValueUniform<1>-
skyMiddleColorValueUniform<Color>-
skyTopColorValueUniform<Color>-
sunColorValueUniform<Color>-
sunDirectionValueUniform<Vector3>The shading light: held above a minimum elevation, tilted off the sun's plane, and blended toward the moon through twilight, so terrain shading and shadows stay readable at every hour. Not where the sun is drawn.
sunlightIntensityValueUniform<1>The sun's intensity as the sky gives it (the chunk set's own copy keeps a floor of 0.05): what entity shadows fade with at night.
waterAbsorptionValueUniform<1>-
waterFresnelStrengthValueUniform<0.5>-
waterLevelValueUniform<86>-
waterStreakStrengthValueUniform<0.1>-
waterTintValueUniform<Color>-

createSkyGlowUniforms​

▸ createSkyGlowUniforms(): SkyGlowUniforms

Returns​

SkyGlowUniforms


createSurfaceWeatherUniforms​

▸ createSurfaceWeatherUniforms(): Object

The defaults: everything off. The host writes them; the chunk materials and the far layer read the same nodes.

  • surfaceWeather x: rain falling now, 0..1 (pocks on open ground, rings on open water); y, z: wetness and the far layer's coat gains, 0..1, each multiplying its channel of surfaceWeatherMap. All zero skips every term.
  • surfaceWeatherMap: RGBA8, linear filtered: r coat, g wetness, b unused, a the coat line (see surfaceWeatherLine).
  • surfaceWeatherWindow: (x0, z0, 1 / width, 1 / depth) in blocks: the map's uv is (xz - (x0, z0)) * (1 / width, 1 / depth).
  • surfaceWeatherLine: (offset, scale, halfBand, unused): the coat line sits at offset + a * scale; the coat fades in, and wetness, pocks and rings fade out, across line ± halfBand.
  • surfaceCoatColor: the far layer's coat colour (linear).
  • surfaceWind: (dirX, dirZ, strength 0..1, unused): walls facing into it get a little wetter.

Returns​

Object

NameType
surfaceCoatColorValueUniform<Color>
surfaceWeatherValueUniform<Vector3>
surfaceWeatherLineValueUniform<Vector4>
surfaceWeatherMapTextureNode<"vec4">
surfaceWeatherWindowValueUniform<Vector4>
surfaceWindValueUniform<Vector4>

createVoxelBoxBand​

▸ createVoxelBoxBand(«destructured»): VoxelBoxBand

One band's chunk, empty: fillVoxelBoxBand lays it out a few columns at a time, so a big box never fills in one go.

Parameters​

NameType
«destructured»Object
› firstRownumber
› rowsnumber
› sizeCoords3

Returns​

VoxelBoxBand


createVoxelGroundSampler​

▸ createVoxelGroundSampler(world, maxProbeDepth): GroundHeightSampler

Parameters​

NameType
worldWorld<any>
maxProbeDepthnumber

Returns​

GroundHeightSampler


cull​

▸ cull(array, options): Promise<MeshResultType>

Parameters​

NameType
arrayNdArray<number[] | TypedArray | GenericArray<number>>
optionsCullOptionsType

Returns​

Promise<MeshResultType>


dampPosition​

▸ dampPosition(current, target, factorAt60): void

Parameters​

NameType
currentVector3
targetVector3
factorAt60number

Returns​

void


decodeFarTerrainReply​

▸ decodeFarTerrainReply(payload): FarTileData | null

A reply payload (already parsed from JSON, or the JSON string) to a tile, or null when it is not one: every array must hold exactly size * size samples.

Parameters​

NameType
payloadunknown

Returns​

FarTileData | null


decodeHeldObject​

▸ decodeHeldObject(raw): SlotContent

Parameters​

NameType
rawnumber

Returns​

SlotContent


defineSkinnedFamily​

▸ defineSkinnedFamily<TVariant, TBone, TData>(definition): SkinnedFamily<TVariant, TBone, TData>

Declares a family of GPU-instanced, bone-animated entities in one place: its variants, named bones, a box body per variant, and its animation. The result builds the pool (geometry, painted atlas, skinning, lighting, hit flash, shadows) and the entity class that follows the server stream.

Type parameters​

NameType
TVariantextends string
TBoneextends string
TDataextends InstancedEntityData = InstancedEntityData

Parameters​

NameType
definitionSkinnedFamilyDefinition<TVariant, TBone, TData>

Returns​

SkinnedFamily<TVariant, TBone, TData>

Example

const critter = defineSkinnedFamily({
type: "critter",
variants: ["sand", "moss"],
bones: ["body", "head", "legL", "legR"],
parts: (variant) => {
const coat = variant === "sand" ? "#c8a46e" : "#5d7a3a";
return [
{ bone: "body", size: [0.5, 0.4, 0.7], at: [0, 0.45, 0], paint: coat },
{ bone: "head", size: [0.35, 0.35, 0.35], at: [0, 0.7, 0.45],
pivot: [0, 0.6, 0.3], paint: coat },
{ bone: "legL", size: [0.12, 0.25, 0.12], at: [-0.15, 0.125, 0],
pivot: [-0.15, 0.25, 0], paint: "#3b2b1a" },
{ bone: "legR", size: [0.12, 0.25, 0.12], at: [0.15, 0.125, 0],
pivot: [0.15, 0.25, 0], paint: "#3b2b1a" },
];
},
legSwing: 0.6,
animate: (pose) => {
const swing = Math.sin(pose.stride) * 0.6 * pose.swing;
pose.rotateBone("legL", swing);
pose.rotateBone("legR", -swing);
pose.rotateBone("head", Math.sin(pose.time * 1.5) * 0.05);
},
});

const roster = new InstancedEntityRoster();
world.add(roster);
critter.install({ entities, roster, world, lightAt: lightShined.lightAt });
// per frame: roster.update(deltaTime, renderer)

describeChunkRequestHistory​

▸ describeChunkRequestHistory(history, now): string

"asked 13x over 64s, last sent 1.2s ago": how long a chunk has been missing and whether its requests left this client at all. A request never sent is this client's outbound queue; one sent and never answered is the server's, or the inbound path's.

Parameters​

NameType
historyChunkRequestHistory
nownumber

Returns​

string


easeOutCubic​

▸ easeOutCubic(t): number

Parameters​

NameType
tnumber

Returns​

number


elapsedSeconds​

▸ elapsedSeconds(clock, timePerDay): number

Seconds since the clock began: day * timePerDay + time. Never wraps.

Parameters​

NameType
clockWorldClock
timePerDaynumber

Returns​

number


emptySlot​

▸ emptySlot(): SlotContent

Returns​

SlotContent


emptyTally​

▸ emptyTally(): SurfaceTally

Returns​

SurfaceTally


encodeHeldObject​

▸ encodeHeldObject(slot): number

Parameters​

NameType
slotSlotContent

Returns​

number


entityLightOriginalOf​

▸ entityLightOriginalOf(material): EntityLightOriginal | null

The colour and output nodes material had before the voxel light.

Parameters​

NameType
materialNodeMaterial

Returns​

EntityLightOriginal | null


entityShadow​

▸ entityShadow(u, body?): Object

The sun's shadow on an entity (a character's parts, a creature, the first-person arm), from the near cascade: PCSS (a blocker search, then a rotated Poisson filter as wide as the penumbra), faded out past the second split and floored at 0.6, so bodies keep their form in shade. u is the world's lighting (sharedEntityShadowUniforms), body the body's own inputs: where its shadow-map position is offset from its world one, its bounds and whether it shades itself.

Parameters​

NameType
uObject
u.uCascadeSplit0ValueUniform<16>
u.uCascadeSplit1ValueUniform<48>
u.uCascadeSplit2ValueUniform<128>
u.uShadowBiasValueUniform<0.0005>
u.uShadowDepthPerBlockValueUniform<0>
u.uShadowMap0TextureNode<"vec4">
u.uShadowMap1TextureNode<"vec4">
u.uShadowMap2TextureNode<"vec4">
u.uShadowMatrix0ValueUniform<Matrix4>
u.uShadowMatrix1ValueUniform<Matrix4>
u.uShadowMatrix2ValueUniform<Matrix4>
u.uShadowNormalBiasValueUniform<0.01>
u.uShadowStrengthValueUniform<1>
u.uSunColorValueUniform<Color>
u.uSunDirectionValueUniform<Vector3>
u.uSunlightIntensityValueUniform<1>
bodyEntityShadowBodyInputs

Returns​

Object

NameType
at(normal: Vec3Node, worldPosition: Vec3Node) => FloatNode
shadowNormal(worldNormal: Vec3Node) => Vec3Node
shadowPosition(worldPosition: Vec3Node) => Vec4Node
within(normal: Vec3Node, worldPosition: Vec3Node, bounds: Vec4Node) => FloatNode

everyFaceOf​

▸ everyFaceOf(block): { corners: { pos: [number, number, number] ; uv: number[] }[] ; dir: [number, number, number] ; emissive?: number ; independent: boolean ; isolated: boolean ; name: string ; pigmentMask?: number ; range: UV ; regionalTint?: boolean ; stageTintMask?: number ; textureGroup: string }[]

Every face a block can draw: its own, then its stage faces (Block.stageFaces), then its tufts (Block.tufts), all of which share its atlas.

Parameters​

NameType
blockPick<Block, "faces" | "stageFaces" | "tufts">

Returns​

{ corners: { pos: [number, number, number] ; uv: number[] }[] ; dir: [number, number, number] ; emissive?: number ; independent: boolean ; isolated: boolean ; name: string ; pigmentMask?: number ; range: UV ; regionalTint?: boolean ; stageTintMask?: number ; textureGroup: string }[]


exemptFromLightCones​

▸ exemptFromLightCones(target, reason): void

Exempt a material, or an object and everything under it, from auditLightCones, with the reason it should not catch a beam (the sky, a full-screen pass, an overlay, FX lit on the CPU). The reason stays in the code next to what it exempts, so every exemption is a decision someone can read.

Parameters​

NameType
targetObject3D<Object3DEventMap> | Material<MaterialEventMap>
reasonstring

Returns​

void


expandCoupledUpdates​

▸ expandCoupledUpdates(view, updates): BlockUpdate[]

Expand a batch of block updates so every coupled unit it touches changes whole — the client-side mirror of the server's update intake, so a local prediction lands on exactly the voxels the authoritative echo will.

For each update, in order:

  • a coupled block being written brings its unit along: the anchor materialises its parts into free voxels (or the write is dropped when one is occupied) and its rotation and stage flow to the partners; a non-anchor part written without its anchor is dropped;
  • a coupled block being replaced by a different id takes its remaining partners with it.

A voxel the batch already writes is never second-guessed: the batch's own word for it wins. The result is idempotent, so callers may expand once to inspect the outcome and hand the expanded list back to updateVoxels.

Parameters​

NameType
viewCoupledWorldView
updatesBlockUpdate[]

Returns​

BlockUpdate[]


faceTexelSize​

▸ faceTexelSize(face, dims, maxTexels, density): Object

Parameters​

NameType
facenumber
dimsPartBoxDims
maxTexelsnumber
densityTexelDensity

Returns​

Object

NameType
hnumber
wnumber

faceWorldSize​

▸ faceWorldSize(face, dims): Object

Parameters​

NameType
facenumber
dimsPartBoxDims

Returns​

Object

NameType
unumber
vnumber

facesAt​

▸ facesAt(block, stage): Block["faces"]

The faces a voxel of block at stage wears: its stage faces while the stage holds any of their bits, its own otherwise (the mesher's Block::faces_at).

Parameters​

NameType
blockPick<Block, "faces" | "stageFaces">
stagenumber

Returns​

Block["faces"]


familyBoneCount​

▸ familyBoneCount<TVariant>(config, variant): number

Type parameters​

NameType
TVariantextends string

Parameters​

NameType
configPick<SkinnedFamilyConfig<TVariant, Texture<unknown, TextureEventMap>>, "boneCount">
variantTVariant

Returns​

number


farSeam​

▸ farSeam(u): Object

The seam between the loaded chunks and the far layer (far-terrain-seam.ts): over the outer half chunk of the loaded area chunk fragments yield pixels to the far layer by an ordered dither, and the far layer draws exactly those. Both read this, so they agree on every pixel.

Parameters​

NameType
uPick<ChunkUniforms, "farCoverMask" | "farCover" | "farSeam">

Returns​

Object

NameType
chunkYields(worldXz: Vec2Node) => BoolNode
dither() => FloatNode
hard(texel: Vec2Node) => FloatNode
isInside(texel: Vec2Node) => BoolNode
texelAt(worldXz: Vec2Node) => Vec2Node
weight(texel: Vec2Node) => FloatNode

farTileId​

▸ farTileId(«destructured»): string

Parameters​

NameType
«destructured»FarTileKey

Returns​

string


farTileSpan​

▸ farTileSpan(descriptor, level): number

World blocks one tile of level spans along x and z.

Parameters​

NameType
descriptorFarTerrainDescriptor
levelnumber

Returns​

number


fillVoxelBoxBand​

▸ fillVoxelBoxBand(«destructured»): void

Lays out the band's chunk columns fromColumn up to toColumn (along x, the chunk's outermost axis).

Parameters​

NameType
«destructured»Omit<VoxelBoxBandOptions, "firstRow" | "rows"> & { band: VoxelBoxBand ; fromColumn: number ; toColumn: number }

Returns​

void


findSimilar​

▸ findSimilar(target, available, options?): string[]

Parameters​

NameType
targetstring
availablestring[]
optionsFindSimilarOptions

Returns​

string[]


findWaterBodySurface​

▸ findWaterBodySurface(isFluidAt, isSealedAt, vx, vy, vz, fromPocket?): number

The open surface of the water a roofed column belongs to. Under a shelf or an arch in open sea the column's own top is the rock's underside, and a waterline there cut the water beside it in two: everything above the rock lost its fog and its depth, a hard line across the view that jumped as the diver swam in and out from under the overhang.

Walks the connected fluid from the column's top voxel (vx, vy, vz), highest voxel first, so wherever the water rises it climbs straight to the top and a shelf costs only the walk to its edge. The first column top that is not sealed is the surface. A cave sealed all round keeps its highest roof the walk reaches, so a low roof never cuts its own higher dome out of the water either.

fromPocket starts from a column whose top is open to air trapped under a roof: an air bell in a sunken hall. That top is the fallback, and only a surface higher than it counts, so a diver under the bell sees the sea the bell sits in rather than the bubble's floor as the waterline.

Parameters​

NameTypeDefault value
isFluidAtFluidQueryundefined
isSealedAtFluidQueryundefined
vxnumberundefined
vynumberundefined
vznumberundefined
fromPocketbooleanfalse

Returns​

number


floodLight​

▸ floodLight(world, queue, color, min?, max?): void

Parameters​

NameType
worldVoxelLightVolume
queueLightNode[]
colorLightColor
min?Coords3
max?Coords3

Returns​

void


fluidWaveNode​

▸ fluidWaveNode(x, z, timeMs): FloatNode

The swell (blocks) at world x/z and shader clock timeMs, as a TSL node: what the chunk vertex stage adds to a resting fluid surface, and what anything drawn on the water (shore foam) rides to stay on it.

Parameters​

NameType
xFloatNode
zFloatNode
timeMsFloatNode

Returns​

FloatNode


fluidWaveOffset​

▸ fluidWaveOffset(x, z, timeMs): number

How far (blocks) the swell lifts a resting fluid surface at world x/z at shader clock timeMs (chunkRenderer.uniforms.time): what the vertex stage adds to the surface's rest height.

Parameters​

NameType
xnumber
znumber
timeMsnumber

Returns​

number


foldLightJobsBack​

▸ foldLightJobsBack(accumulated, jobs): LightOperations | null

Put built jobs back into an operation set — the inverse of buildLightJobs.

A memory-pressure shed drops a job's serialized chunk copies, which is the allocation that matters, but it must not drop the seeds the job carried: they describe voxel changes that are already applied and already meshed with their old light, and nothing else ever comes back for them. A pit cut into stone under pressure used to stay black until a reload, because the shed nulled the pending ops and the log counted them as zero. Boxes and clusters are recomputed when the seeds are built into jobs again, so only the seeds need to survive.

Parameters​

NameType
accumulatedLightOperations
jobsPick<LightJob, "color" | "lightOps">[]

Returns​

LightOperations | null


forkChunkMaterial​

▸ forkChunkMaterial(material): ChunkMaterial

A material of its own with the same program, inputs and per-material values, for a block or face that is about to diverge from the one it shared.

Parameters​

NameType
materialChunkMaterial

Returns​

ChunkMaterial


forkVoxelBoxMaterial​

▸ forkVoxelBoxMaterial(material, frame): ChunkMaterial

A voxel box's own copy of a chunk material: every live uniform and the atlas shared, so it draws with the program the chunks compiled, but its greedy faces read their texels through frame (VoxelBoxTexelFrame), so they ride the box. Its draws count as material's, so a face texture animated from that material's draws still advances.

Parameters​

NameType
materialChunkMaterial
frameObject
frame.valueMatrix4

Returns​

ChunkMaterial


formatSuggestion​

▸ formatSuggestion(suggestions, allAvailable, options?): string

Parameters​

NameType
suggestionsstring[]
allAvailablestring[]
optionsFormatSuggestionOptions

Returns​

string


frameNow​

▸ frameNow(): number

The time to step by: the frame's own time while one is being drawn, the wall clock otherwise. Same clock as performance.now().

Returns​

number


framePaceMs​

▸ framePaceMs(): number

The pace frames are really coming at: the mean gap between the last ones, in ms, or 0 before two frames have been seen. Equal to frameRefreshMs on a page that holds its display's refresh, longer on one that does not.

Returns​

number


frameRefreshMs​

▸ frameRefreshMs(): number

The display's refresh interval in ms as the frames show it, or 0 while it is not known: no host has called setFrameTime twice yet, or the page is not paced by a display.

Returns​

number


frameRoomMs​

▸ frameRoomMs(now?): number | null

How many ms of main-thread work still fit before the frame after the newest one is due, read at now (the wall clock). Work that can wait (a backlog drained a slice a frame) asks this for its slice, so a frame that began late or ran long gets a short one and the display's refresh is held whatever else is going on.

null when there is nothing to plan against: no host feeds the frame clock, the page is unpaced, or frames have stopped (a hidden tab). The caller then falls back to its own fixed allowance.

Parameters​

NameType
nownumber

Returns​

number | null


frameStep​

▸ frameStep(seconds, maxSeconds?): number

A step in seconds from a timer fed by frameNow, never negative and never longer than maxSeconds. A timer that last ticked on the wall clock (outside a frame) can sit a little after the next frame's own time.

Parameters​

NameTypeDefault value
secondsnumberundefined
maxSecondsnumberInfinity

Returns​

number


getDownwellingTransmittance​

▸ getDownwellingTransmittance(depth, out): Color

Parameters​

NameType
depthnumber
outColor

Returns​

Color


getEffectiveScatterStrength​

▸ getEffectiveScatterStrength(sunStrength): number

Parameters​

NameType
sunStrengthnumber

Returns​

number


getImageComp​

▸ getImageComp(item): ImageComp | undefined

Parameters​

NameType
itemItemDef

Returns​

ImageComp | undefined


getItemComponent​

▸ getItemComponent<T>(item, key): T | undefined

Type parameters​

Name
T

Parameters​

NameType
itemItemDef
keystring

Returns​

T | undefined


getLightColorMask​

▸ getLightColorMask(color): number

Parameters​

NameType
colorLightColor

Returns​

number


getMeshTransferStatus​

▸ getMeshTransferStatus(): Object

Returns​

Object

NameType
isCrossOriginIsolatedboolean
isSharedArrayBufferAvailableboolean
modeWorkerTransferMode
poolChunkSharedPoolStats
statsMeshWorkerTransferStats | Record<WorkerTransferStrategy, MeshWorkerTransferStats>
strategyWorkerTransferStrategy

getSlotData​

▸ getSlotData<T>(slot, key): T | undefined

Type parameters​

Name
T

Parameters​

NameType
slotSlotContent
keystring

Returns​

T | undefined


getSlotDurability​

▸ getSlotDurability(slot): number | undefined

Parameters​

NameType
slotSlotContent

Returns​

number | undefined


getSunDiscDirection​

▸ getSunDiscDirection(timeOfDay, target): Vector3

Direction from the viewer to the centre of the painted sun disc for a time of day (0 midnight, 0.25 sunrise, 0.5 noon, 0.75 sunset). The disc is the centre of the sky box's bottom face, and Sky.update spins the box about Z by one turn per day, so the sun points straight down at midnight, rises along +X, stands at the zenith at noon and sets along -X. The moon is the top face, diametrically opposite.

This is where the disc is drawn. The shading light (ShaderLightingUniforms.sunDirection) is deliberately not this: it is held above a minimum elevation, tilted off the sun's plane, and blended toward the moon through twilight so terrain shading and shadows stay readable. Anything that has to line up with the disc the player sees — a reflection on water — reads this instead.

Parameters​

NameType
timeOfDaynumber
targetVector3

Returns​

Vector3


getUnderwaterAmbientColor​

▸ getUnderwaterAmbientColor(depth, sunStrength, out): Color

Parameters​

NameType
depthnumber
sunStrengthnumber
outColor

Returns​

Color


getVisibleDiscDirection​

▸ getVisibleDiscDirection(timeOfDay, target): Vector3

The celestial disc above the horizon: the sun while it is up, the moon (its antipode) once it has set. The choice flips at the instant both sit on the horizon, and nothing shows it: a disc at zero elevation only mirrors into a ray that is itself horizontal.

Parameters​

NameType
timeOfDaynumber
targetVector3

Returns​

Vector3


glUvToTargetUv​

▸ glUvToTargetUv(uv): Vec2Node

A uv laid out the GL way on a render target (v up from the bottom row, as a viewport's y is), in the convention texture reads take.

Parameters​

NameType
uvVec2Node

Returns​

Vec2Node


groupLightJobs​

▸ groupLightJobs(jobs, options): LightJobGroup[]

Sort a batch's jobs into the groups that share a chunk snapshot: jobs whose chunk rectangles touch go to one worker together, and jobs with no chunk in common stay apart so they still run side by side.

Parameters​

NameType
jobsLightJob[]
optionsPick<VoxelLightVolumeOptions, "chunkSize" | "maxLightLevel">

Returns​

LightJobGroup[]


hasItemComponent​

▸ hasItemComponent(item, key): boolean

Parameters​

NameType
itemItemDef
keystring

Returns​

boolean


hasSlotData​

▸ hasSlotData(slot, key): boolean

Parameters​

NameType
slotSlotContent
keystring

Returns​

boolean


hitFlashMs​

▸ hitFlashMs(profile): number

Milliseconds from the blow until a profile's flash is gone.

Parameters​

NameType
profileHitFlashProfile

Returns​

number


holdHitFlash​

▸ holdHitFlash(color): number

The red a body keeps while it tips over dead: the hold, never the pop.

Parameters​

NameType
colorColor

Returns​

number


isChunkColumnPending​

▸ isChunkColumnPending(column, graceMs?): boolean

Whether a chunk column still owes the viewer its terrain: not loaded at all (not even asked for, asked for, or in flight), or loaded within the grace and not ready or with a mesh still being built. A loaded, ready column with no mesh owed is settled: what it draws, which may be nothing, is final until it changes, so the far layer may show where it is genuinely empty. So is one that has owed its mesh past the grace.

Parameters​

NameTypeDefault value
columnChunkColumnStateundefined
graceMsnumberCHUNK_PENDING_GRACE_MS

Returns​

boolean


isChunkMaterial​

▸ isChunkMaterial(material): material is ChunkMaterial

Parameters​

NameType
materialunknown

Returns​

material is ChunkMaterial


isClockDriftBeyond​

▸ isClockDriftBeyond(local, server, timePerDay, threshold): boolean

Whether the local clock has drifted from the server's by more than threshold seconds. Judged on the unwrapped clocks: around midnight the server and a client a few milliseconds apart sit on different days, and their times of day alone would read as a whole day of drift.

Parameters​

NameType
localWorldClock
serverWorldClock
timePerDaynumber
thresholdnumber

Returns​

boolean


isClosedCutoutCube​

▸ isClosedCutoutCube(block): boolean

Whether a cutout is a closed unit cube that meshes the faces between same-id neighbours to a depth (standaloneFaceDepth), like a leaf canopy whose inner layers show through its holes. Such a block draws single-sided: every plane between two of them carries two faces back to back, and drawn double-sided both would show from either side and fight over one depth. Single-sided, each side of the plane sees only the face turned toward it, and the voxel the camera stands in shows none of its own. The mesher lays an inward copy of every face such a block turns to empty space, so its surface still shows from inside (the mesher's is_cutout_mass; the two must agree).

Parameters​

NameType
blockBlock

Returns​

boolean


isCoupledPart​

▸ isCoupledPart(block): boolean

Whether block is a non-anchor part of a coupled unit — a door's top leaf, a tall flower's bloom. Such a block is never placed, picked, or dropped on its own; see resolveCoupledAnchor.

Parameters​

NameType
blockBlock

Returns​

boolean


isCoveredAt​

▸ isCoveredAt(mask, originCx, originCz, size, chunkSize, x, z): boolean

Whether the mask hides the far layer at world (x, z).

Parameters​

NameType
maskUint8Array<ArrayBufferLike>
originCxnumber
originCznumber
sizenumber
chunkSizenumber
xnumber
znumber

Returns​

boolean


isEntityMetadataFrozen​

▸ isEntityMetadataFrozen(metadata): boolean

Parameters​

NameType
metadataMutableMetadata

Returns​

boolean


isEyeInOpaqueVoxel​

▸ isEyeInOpaqueVoxel(position, reach, isOpaqueAt): boolean

Whether any voxel within reach of the eye (per axis) is opaque: the eight corners of that cube. Below one voxel of width the cube spans at most two voxels per axis, so its corners visit every voxel it touches. This is the test for "the near plane is in rock", where unmeshed interior faces let the camera see through what connectivity calls sealed.

Parameters​

NameType
positionObject
position.xnumber
position.ynumber
position.znumber
reachnumber
isOpaqueAt(vx: number, vy: number, vz: number) => boolean

Returns​

boolean


isLightConesCovered​

▸ isLightConesCovered(material): boolean

Marked by whatever shades it with the cones (shading/light-cones.ts).

Parameters​

NameType
materialMaterial<MaterialEventMap>

Returns​

boolean


isMainThreadSortedBlock​

▸ isMainThreadSortedBlock(block): boolean

Parameters​

NameType
blockTransparencyFlags

Returns​

boolean


isOwnTextureFace​

▸ isOwnTextureFace(face): boolean

Whether a face carries a whole texture of its own instead of a slot in the shared atlas. Independent faces own one per block face; isolated faces own one per voxel, plus the face-keyed default below for when there is no voxel to ask (a held block, a drop, an inventory thumbnail).

Parameters​

NameTypeDescription
faceObject-
face.corners{ pos: [number, number, number] ; uv: number[] }[]-
face.dir[number, number, number]-
face.emissive?numberEmissive output of this face; 0 shades normally. Declared server-side with the block and rendered full-bright by the chunk shader.
face.independentboolean-
face.isolatedboolean-
face.namestring-
face.pigmentMask?numberStage bits that pick this face's colour-table entry. 0 (or absent) means the face is never tinted from the table.
face.rangeUV-
face.regionalTint?booleanShade with the chunk's regional colour on the neutral palette, never reading the stage. Mirrors the server face's regional_tint.
face.stageTintMask?number-
face.textureGroupstring-

Returns​

boolean


isPerfLogging​

▸ isPerfLogging(): boolean

Returns​

boolean


isPlayInteractive​

▸ isPlayInteractive(): boolean

Returns​

boolean


isSamePeerSlotData​

▸ isSamePeerSlotData(a, b): boolean

Whether two peer data objects show the same thing (key order aside).

Parameters​

NameType
aRecord<string, unknown>
bRecord<string, unknown>

Returns​

boolean


isSelfIlluminated​

▸ isSelfIlluminated(material): boolean

Parameters​

NameType
materialMaterial<MaterialEventMap>

Returns​

boolean


isSharedOpaqueMaterialBlock​

▸ isSharedOpaqueMaterialBlock(block): boolean

Parameters​

NameType
blockBlock

Returns​

boolean


isWarmablePool​

▸ isWarmablePool(child): child is WarmablePool

Parameters​

NameType
childobject

Returns​

child is WarmablePool


isWithinIkRange​

▸ isWithinIkRange(position, range): boolean

Parameters​

NameType
positionVector3
rangenumber

Returns​

boolean


itemSlot​

▸ itemSlot(id, count, data?): SlotContent

Parameters​

NameType
idnumber
countnumber
dataRecord<string, unknown>

Returns​

SlotContent


itemSlotWithDurability​

▸ itemSlotWithDurability(id, count, durability): SlotContent

Parameters​

NameType
idnumber
countnumber
durabilitynumber

Returns​

SlotContent


lambertReachGain​

▸ lambertReachGain(distanceOverRange, averageNdotL?): number

What a CPU mirror multiplies one light by so that its fixed wrap, applied later at averageNdotL, comes out as the wrap at this distance.

Parameters​

NameTypeDefault value
distanceOverRangenumberundefined
averageNdotLnumber0.5

Returns​

number


lambertWrapAt​

▸ lambertWrapAt(distanceOverRange): number

The diffuse wrap at distance / range from a light (the shader's too).

Parameters​

NameType
distanceOverRangenumber

Returns​

number


lightConeShading​

▸ lightConeShading(u): Object

The light cones (flashlights, headlights) of one world: what they light on a surface, and the glow a beam scatters toward the eye through the air or water it crosses.

Parameters​

NameType
uObject
u.coneCountValueUniform<0>
u.conesArrayUniform<Vector4, "vec4">

Returns​

Object

NameType
applyScatter(color: Vec3Node, worldPosition: Vec3Node) => Vec3Node
entityLit(light: Vec3Node, worldPosition: Vec3Node) => Vec3Node
scatterFnNode<[Vector3 | Node<"vec3">, Vector3 | Node<"vec3">, number | Node<"float"> | Node<"uint">], VarNode<"vec3", ConstNode<"vec3", Vector3>>>
surfaceFnNode<[Vector3 | Node<"vec3">, Vector3 | Node<"vec3">], VarNode<"vec3", ConstNode<"vec3", Vector3>>>

linearizeShadowDepth​

▸ linearizeShadowDepth(depth01, near, far): number

Linear view depth stored at a face texel, back from hardware depth 0..1: the same for either clip convention once the projection was built for the renderer (perspectiveDepthToViewZ, the shader's).

Parameters​

NameType
depth01number
nearnumber
farnumber

Returns​

number


loadChunkMaterials​

▸ loadChunkMaterials(world): Promise<void>

Parameters​

NameType
worldChunkMaterialHost & { getBlockById: (id: number) => Block ; registry: Registry }

Returns​

Promise<void>


localLightFalloff​

▸ localLightFalloff(dist, range, coreDistSq?): number

Analytic falloff at dist for a light of range: a windowed inverse square with a core of tightKernelCoreRatio x range, 0 at and beyond the range.

Parameters​

NameTypeDescription
distnumber-
rangenumber-
coreDistSqnumberSquared distance for the inverse-square core (defaults to dist).

Returns​

number


localLightShading​

▸ localLightShading(u, world): Object

The clustered local lights (torches, lanterns, held lights) of one world.

Record layout (one row per selected light, six RGBA32F texels): t0 = [x, y, z, range] t1 = [ri, gi, b*i, flags] flags: 1 masked | 2 flicker | 4 shadowed | shape << 4 t2 = spot [dir.xyz, cosOuter] / capsule [end offset.xyz, 0] t3 = [flickerSpeed, flickerAmplitude, flickerPhase, spotInvCosDelta] (the flicker terms are the CPU's; shaders read flickerNow, one row a light: this frame's [intensity scale, origin offset xyz]) t4 = [shadow slot (-1 none), static face mask, dynamic face mask, near] t5 = [far, guard tanHalf, shadow fade weight, 0]

Grid slots (R32UI): data row + 1 in the low byte (0 ends the cell's list), the slot's fade weight in the high byte. Shadow lookup mirrors the camera construction in shadow-atlas.ts (face bases, guard FOV); depth compares run in linear light-space distance so bias is a world unit.

Parameters​

NameType
uLocalLightInputs
worldPick<ChunkUniforms, "cameraSubmersion" | "cameraWaterPlaneY" | "time">

Returns​

Object

NameType
clusteredCountValueUniform<0>
debugColor(pos: Vec3Node, base: Vec3Node, normal: Vec3Node, flood: Vec3Node, cluster: Vec3Node, remainder: FloatNode) => Vec3Node
isDebuggingNode<"bool">
roomFillFnNode<[Vector3 | Node<"vec3">, Vector3 | Node<"vec3">, number | Node<"float"> | Node<"uint">, Vector3 | Node<"vec3">], VarNode<"vec3", ConstNode<"vec3", Vector3>>>
specularFnNode<[Vector3 | Node<"vec3">, Vector3 | Node<"vec3">, Vector3 | Node<"vec3">, Vector3 | Node<"vec3">], VarNode<"vec3", ConstNode<"vec3", Vector3>>>
surface(pos: Vec3Node, normal: Vec3Node, flood: Vec3Node, slotLimit: number, useShadows: boolean, gate: BoolNode) => { floodRemainder: VarNode<"float", ConstNode<"float", number>> ; lightHue: VarNode<"vec3", ConstNode<"vec3", Vector3>> ; total: VarNode<"vec3", ConstNode<"vec3", Vector3>> }

logChatRendered​

▸ logChatRendered(chat): void

Parameters​

NameType
chatChatProtocol

Returns​

void


logChatWireSend​

▸ logChatWireSend(message, byteSize): void

Parameters​

NameType
messageMessageProtocol
byteSizenumber

Returns​

void


logIncomingMessage​

▸ logIncomingMessage(message): void

Parameters​

NameType
messageMessageProtocol

Returns​

void


logPerf​

▸ logPerf(event, fields?): void

Parameters​

NameType
eventstring
fieldsRecord<string, PerfField>

Returns​

void


loneCubeCorner​

▸ loneCubeCorner(dir, corner, cells): LoneCubeCorner

The occlusion (0..3) and packed light the mesher bakes into the corner of the cube at corner (each 0 or 1) on the face toward dir.

Parameters​

NameType
dirreadonly [number, number, number]
cornerreadonly [number, number, number]
cellsLoneCubeNeighborhood

Returns​

LoneCubeCorner


loneCubeQuadFlips​

▸ loneCubeQuadFlips(aos, lights): boolean

Whether a quad's four corners (in emission order) split along their 1-2 diagonal rather than 0-3 (the mesher's quad_flips).

Parameters​

NameType
aosreadonly number[]
lightsreadonly number[]

Returns​

boolean


luminance709​

▸ luminance709(color): FloatNode

Parameters​

NameType
colorVec3Node

Returns​

FloatNode


makeChunkMaterial​

▸ makeChunkMaterial(world, options?): ChunkMaterial

A chunk material of kind reading the world's shading inputs, with the unknown-texture checker until a texture is assigned.

Parameters​

NameType
worldChunkMaterialHost
optionsChunkMaterialOptions

Returns​

ChunkMaterial


makeChunkMaterialKey​

▸ makeChunkMaterialKey(world, id, faceName?, voxel?): string

Parameters​

NameType
worldObject
world.getBlockById(id: number) => Block
world.hasCustomBlockMaterial(id: number) => boolean
idnumber
faceName?string
voxel?Coords3

Returns​

string


makeChunkStandInGeometry​

▸ makeChunkStandInGeometry(options): BufferGeometry

A one-triangle geometry with the attributes a chunk mesh carries, in the formats the meshes carry them (World.makeChunkBufferGeometry): what a warmup draws a chunk material with. A pipeline is keyed by its vertex layout as much as by its material, so a stand-in with other attributes or other formats would build a pipeline no chunk ever draws with.

Parameters​

NameTypeDescription
optionsObject-
options.hasBiomeTint?booleanThe climate tint (every chunk with biome data).
options.isQuantizedbooleanFixed-point positions (four-wide, the sway profile fourth) and normalized uvs/normals: the shipped meshes.

Returns​

BufferGeometry


makeOwnFaceTexture​

▸ makeOwnFaceTexture(source): Texture

The texture an own-texture face should carry for source. Block art is pixel art, so a texture minted here samples the way the atlas does. Mint one per material rather than sharing: the sharing that matters — one GPU upload per image — already happens at the texture's source.

Parameters​

NameType
sourceColor | Texture<unknown, TextureEventMap> | HTMLImageElement

Returns​

Texture


makeSceneColorTexture​

▸ makeSceneColorTexture(width?, height?): FramebufferTexture

The frame a scene colour capture lands in: the frame drawn before the water (World.captureWaterRefraction). Linear filtered so the refracted floor bends smoothly between texels.

Parameters​

NameTypeDefault value
widthnumber1
heightnumber1

Returns​

FramebufferTexture


makeShadowFaceProjection​

▸ makeShadowFaceProjection(out, tanHalf, near, far, coordinateSystem?): Matrix4

Compute the perspective projection for a shadow face camera: aspect 1, tanHalf the half-FOV tangent (guard included), in the clip convention the renderer draws it with (renderer.coordinateSystem). A WebGL-style projection drawn by WebGPU stores clip depth -1..1 as if it ran 0..1: every occluder read back nearer than it stood, and walls round a torch shaded themselves.

Parameters​

NameTypeDefault value
outMatrix4undefined
tanHalfnumberundefined
nearnumberundefined
farnumberundefined
coordinateSystemCoordinateSystemWebGLCoordinateSystem

Returns​

Matrix4


makeSurfaceWeatherMap​

▸ makeSurfaceWeatherMap(data?, width?, height?): DataTexture

A 1x1 map holding nothing: no coat, no wetness.

Parameters​

NameTypeDefault value
dataUint8Array<ArrayBufferLike>undefined
widthnumber1
heightnumber1

Returns​

DataTexture


markInstanceChanged​

▸ markInstanceChanged(attribute, index): void

Marks instance index of attribute written: the next upload sends one span covering every instance marked since the last upload, in the buffer the attribute lives in (its own, or a packed one it shares).

Parameters​

NameType
attributeInstanceAttribute
indexnumber

Returns​

void


markLightConesCovered​

▸ markLightConesCovered(material): void

Whether a material takes the light cones per pixel. Set by everything that shades with them (lightConeShading in shading/light-cones.ts); auditLightCones reports any drawn, world-lit mesh without it, so a new material cannot quietly skip the beam the way a custom creature material once did.

Parameters​

NameType
materialMaterial<MaterialEventMap>

Returns​

void


markPlayInteractive​

▸ markPlayInteractive(): void

Returns​

void


markSelfIlluminated​

▸ markSelfIlluminated(material): void

Mark a material as its own light source, so the voxel-light effects leave it alone. A lamp lens, a screen, or a glowing sign must not be multiplied by the light around it: that would put the emitter out in exactly the dark it was lit for. Honored by LightShined and by the Arm's held-object lighting and shadow shaders.

Parameters​

NameType
materialMaterial<MaterialEventMap>

Returns​

void


maskedWindowDistance​

▸ maskedWindowDistance(dist, dx, dy, dz): number

Distance a masked light's falloff is windowed by: its flood ends on the L1 diamond of its range, so the window runs to the larger of the Euclidean and L1 distances and reaches zero exactly where the mask would otherwise cut. Mirrors localLightSurface.

Parameters​

NameType
distnumber
dxnumber
dynumber
dznumber

Returns​

number


materialShadowBody​

▸ materialShadowBody(): EntityShadowBodyInputs

The body of whichever material is drawn: its userData.shadowBody (setShadowBody), read before each draw.

Returns​

EntityShadowBodyInputs


materialTexture​

▸ materialTexture(kind, material, property): TextureNode<"vec4">

A texture the drawn material holds in property, of kind: built from the building material's texture and re-pointed before each draw at the drawn one's. Call it while the graph builds (inside a setup method).

Parameters​

NameType
kindTextureSlotKind
materialobject
propertystring

Returns​

TextureNode<"vec4">


materialValue​

▸ materialValue<T>(property, type): MaterialValueNodes[T]

A value the drawn material holds in property (a dotted path reaches into an object), read through materialReference: updated before each draw from the material being drawn, so every material of a family reads its own through one shared graph. Typed as the node it generates.

Type parameters​

NameType
Textends keyof MaterialValueNodes

Parameters​

NameType
propertystring
typeT

Returns​

MaterialValueNodes[T]


maxVoxelBoxSide​

▸ maxVoxelBoxSide(«destructured»): number

The widest box the world's vertex quantization can hold, in blocks.

Parameters​

NameType
«destructured»Object
› positionBiasnumber
› positionUnitsnumber

Returns​

number


meanLinearRgb​

▸ meanLinearRgb(pixels): [number, number, number] | null

The mean colour of sRGB RGBA8 pixels in linear RGB, weighted by alpha so a cutout's holes do not darken it; null when every pixel is transparent. Averaged in linear light, as the GPU's filtering of an sRGB texture does.

Parameters​

NameType
pixelsArrayLike<number>

Returns​

[number, number, number] | null


measureLegLength​

▸ measureLegLength(geometry): number | null

Parameters​

NameType
geometryBufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>

Returns​

number | null


measureMeshReach​

▸ measureMeshReach(geometry): number

Parameters​

NameType
geometryBufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>

Returns​

number


measureMeshTop​

▸ measureMeshTop(geometry): number | null

Parameters​

NameType
geometryBufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>

Returns​

number | null


measureWaterColumn​

▸ measureWaterColumn(isFluidAt, x, y, z, isSealedAt?): WaterColumnSample | null

The water column over a point. isSealedAt says whether a fluid voxel is still water sealed under a roof: the mesher fills such a voxel to its top and draws no surface (is_sealed_under_ceiling in the mesher), so its waterline is the roof rather than the resting height, and a diver pressed against a flooded cave roof stays under.

Parameters​

NameType
isFluidAtFluidQuery
xnumber
ynumber
znumber
isSealedAt?FluidQuery

Returns​

WaterColumnSample | null


mergeLightOperations​

▸ mergeLightOperations(existing, newOps): LightOperations

Parameters​

NameType
existingLightOperations
newOpsLightOperations

Returns​

LightOperations


mergeSingleColorResult​

▸ mergeSingleColorResult(chunk, lights, color, boundingBox, minY?, maxY?): void

Write one colour of a worker's light for chunk over the chunk's own, inside the job's box and between rows minY and maxY (both included): the rows the job wrote into, as the worker reports them. The rest of the worker's copy is the chunk as it stood when the copy was made.

Parameters​

NameTypeDefault value
chunkChunkundefined
lightsUint32Array<ArrayBufferLike>undefined
colorLightColorundefined
boundingBoxBoundingBoxundefined
minYnumber0
maxYnumberInfinity

Returns​

void


mergeTexelClasses​

▸ mergeTexelClasses(into, from): TexelClasses

Parameters​

NameType
intoTexelClasses
fromTexelClasses

Returns​

TexelClasses


moonPhaseLit​

▸ moonPhaseLit(across, mu, phase): FloatNode

How much of the moon's face is lit at a point on its disc: 0 in shadow, 1 in light. The disc is shaded as the sphere it stands for, so the terminator is the ellipse a real moon shows and a crescent has horns. across is the point's offset across the terminator in disc radii, and mu the cosine of its angle off the centre of the face (1 at the centre, 0 at the limb). phase is the light's direction in that frame, (across, toward the eye): (0, 1) a full moon, (0, -1) a new one, (1, 0) the positive half lit. A host that draws the moon shades it with this, and so does the fog that carries the moon, so the two never disagree.

Parameters​

NameType
acrossFloatNode
muFloatNode
phaseVec2Node

Returns​

FloatNode


moonTexelFace​

▸ moonTexelFace(q, phase): Object

One texel of a moon drawn in pixels, decided at the texel's centre q (in disc radii) and held across it: inside the disc or not, lit or in shadow, with no shades between. mu is the cosine of the centre's angle off the face. Texel k of a face n texels across has its centre at (k + 0.5) / (n / 2), counted from the middle of the face. As with moonPhaseLit, the host's moon and the fog's are both made of this, texel for texel.

Parameters​

NameType
qVec2Node
phaseVec2Node

Returns​

Object

NameType
insideFloatNode
litFloatNode
muFloatNode

nameTagFade​

▸ nameTagFade(distance, fadeStart, fadeEnd): number

How opaque a name tag is at distance from the camera: 1 up to fadeStart, 0 from fadeEnd on, and eased in between (smoothstep), so a tag neither pops out nor lingers as a faint smear at the edge.

Parameters​

NameType
distancenumber
fadeStartnumber
fadeEndnumber

Returns​

number


ndcToTargetUv​

▸ ndcToTargetUv(ndc): Vec2Node

Normalized device xy (-1..1, y up) to the uv a render target's texture is read at: WebGPU's v runs down from the top row, where NDC y = 1 lands. (Under the WebGL backend three flips render-target uvs back itself.)

Parameters​

NameType
ndcVec2Node

Returns​

Vec2Node


nearPlaneReach​

▸ nearPlaneReach(fovDegrees, aspect, near): number

Distance from the eye to the farthest corner of a perspective camera's near plane: how far into the scene the eye itself can clip.

Parameters​

NameType
fovDegreesnumber
aspectnumber
nearnumber

Returns​

number


noteLazyBake​

▸ noteLazyBake(pool, variant): void

Parameters​

NameType
poolstring
variantstring

Returns​

void


noteLazyWork​

▸ noteLazyWork(kind, label): void

Parameters​

NameType
kindstring
labelstring

Returns​

void


onPlayInteractive​

▸ onPlayInteractive(listener): () => void

Parameters​

NameType
listener() => void

Returns​

fn

▸ (): void

Returns​

void


orientPointFaceCamera​

▸ orientPointFaceCamera(camera, view): void

Orient camera for a point-light cube face using the shared basis table. The camera's matrices are written directly (no lookAt) so the orientation is bit-identical to what the shader reconstruction assumes.

Named-args view: hot callers keep a scratch object and mutate it in place.

Parameters​

NameType
cameraPerspectiveCamera
viewObject
view.facenumber
view.farnumber
view.light[number, number, number]
view.nearnumber
view.tanHalfnumber

Returns​

void


orientSpotCamera​

▸ orientSpotCamera(camera, view): void

Derive the spot-light shadow basis from its direction, with the same deterministic up-reference rule the shader uses: world +Y unless the axis is near-vertical, then world +Z.

Named-args view: hot callers keep a scratch object and mutate it in place.

Parameters​

NameType
cameraPerspectiveCamera
viewObject
view.direction[number, number, number]
view.farnumber
view.light[number, number, number]
view.nearnumber
view.tanHalfnumber

Returns​

void


ownUniform​

▸ ownUniform<T>(value, type?): ValueUniform<T>

A uniform owned by one material or object (per-draw group).

Type parameters​

NameType
Textends number | Vector3 | Matrix4 | Matrix3 | Vector2 | Color | Vector4

Parameters​

NameType
valueT
type?"int" | "uint"

Returns​

ValueUniform<T>


packLightSeeds​

▸ packLightSeeds(lightOps): Int32Array

A job's seeds as one list of integers, for the trip to a light worker: how many removals, floods and pending removals, then each removal's voxel and each node's voxel and level. A relight after a crater carries tens of thousands of seeds, and posting them as objects made the page clone every one on its main thread (tens of ms in a single frame); the list's buffer is handed over instead, and the worker rebuilds the nodes on its own time.

Parameters​

NameType
lightOpsLightSeeds

Returns​

Int32Array


packQuantizedPositions​

▸ packQuantizedPositions<T>(source, swayProfile?, out?): T

source's three-wide positions, four-wide with swayProfile fourth.

Type parameters​

NameType
Textends Uint16Array<ArrayBufferLike>

Parameters​

NameTypeDefault value
sourceArrayLike<number>undefined
swayProfilenumber0
outTundefined

Returns​

T


packVertexBuffers​

▸ packVertexBuffers(geometry): Map<string, InterleavedBufferAttribute>

WebGPU binds at most 8 vertex buffers to a pipeline (and three adds one for an instanced mesh's matrices), and every separate attribute is a buffer. A creature's geometry carries eight per-vertex attributes and four per-instance ones: as separate buffers it cannot be drawn at all.

This interleaves a geometry's float attributes into one buffer per rate: the per-vertex ones into one, the per-instance ones into another, each a Float32 array with the attributes side by side. The attributes keep their names and API (setX, needsUpdate reach the shared buffer), so code that holds them by name keeps working; code holding the old attribute objects must take the returned ones. Integer and normalized attributes become plain floats, which the shaders read them as anyway. Runs once, where a geometry is built, never per frame.

Parameters​

NameType
geometryBufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>

Returns​

Map<string, InterleavedBufferAttribute>


padByteVectors​

▸ padByteVectors<T>(source): T

source's three-component vectors, four-wide (the fourth zero).

Type parameters​

NameType
Textends Uint8Array<ArrayBufferLike> | Int8Array<ArrayBufferLike>

Parameters​

NameType
sourceT

Returns​

T


paintPartFacesAtDensity​

▸ paintPartFacesAtDensity(atlasCtx, cellSize, partIndex, dims, paintFace, density): void

Parameters​

NameType
atlasCtxCanvasRenderingContext2D
cellSizenumber
partIndexnumber
dimsPartBoxDims
paintFaceFacePainter
densityTexelDensity

Returns​

void


paintSkinnedPartsAtlas​

▸ paintSkinnedPartsAtlas(parts, density?): THREE.CanvasTexture

Paints a part list's atlas: one row per part, six face cells per row, every face at the same texels per block. Pair with atlasSurface(parts.length), the pool's default surface.

Parameters​

NameTypeDefault value
partsreadonly SkinnedPart[]undefined
densityTexelDensityDEFAULT_PART_TEXEL_DENSITY

Returns​

THREE.CanvasTexture


partAtlasCellSize​

▸ partAtlasCellSize(partDims, density): number

Parameters​

NameType
partDimsPartBoxDims[]
densityTexelDensity

Returns​

number


passUniform​

▸ passUniform<T>(value, type?): ValueUniform<T>

A uniform that holds for one render pass, in three's shared render group (beside the camera's): one buffer for every draw, uploaded once a render. A value changed mid-render must move the group on (renderGroup.needsUpdate = true) to reach the draws after it.

Type parameters​

NameType
Textends number | Vector3 | Matrix4 | Matrix3 | Vector2 | Color | Vector4

Parameters​

NameType
valueT
type?"int" | "uint"

Returns​

ValueUniform<T>


peekNextRosterEntry​

▸ peekNextRosterEntry<TType>(types, hasBabies, isWarm): { baby: boolean ; type: TType } | null

Type parameters​

NameType
TTypeextends string

Parameters​

NameType
typesreadonly TType[]
hasBabiesboolean
isWarm(type: TType, baby: boolean) => boolean

Returns​

{ baby: boolean ; type: TType } | null


peerSlotData​

▸ peerSlotData(slot, keys): Record<string, unknown>

The part of a slot's data other players may see: only keys, and only those it has, or null when there is nothing to show. A held object's id says what it is; this says which one (a colour, a variant, a size). Mirrors the server's SlotContent::peer_data.

Parameters​

NameType
slotSlotContent
keysreadonly string[]

Returns​

Record<string, unknown>


pendingChunksWithin​

▸ pendingChunksWithin(centerCx, centerCz, renderRadius, isPending): [number, number][]

The chunk columns inside the render radius that still owe their terrain (isChunkColumnPending): not loaded yet, or loaded with the mesh still being built. Right after arriving somewhere these are the holes the far layer would show through, and from inside a canyon that reads as seeing through the walls for a second; the coverage mask counts them as covered, so sky and fog show there instead until the chunk's own terrain lands, unless the far layer already draws that column away from the viewer. The disc is the one the chunk requests walk; isPending answers for one column (a column outside the world, or one loaded and meshed with nothing to draw, is not pending).

Parameters​

NameType
centerCxnumber
centerCznumber
renderRadiusnumber
isPending(cx: number, cz: number) => boolean

Returns​

[number, number][]


perspectiveDepthToViewZ​

▸ perspectiveDepthToViewZ(depth, near, far): FloatNode

Perspective depth (0..1, as stored) back to the distance along the view axis, for a camera with these clip planes. The same expression holds for WebGL's and WebGPU's projections: both store far (z - near) / (z (far - near)).

Parameters​

NameType
depthFloatNode
nearFloatNode
farFloatNode

Returns​

FloatNode


placeholderTexture​

▸ placeholderTexture(kind): Texture

A 1x1 stand-in of the right kind for a slot whose texture comes later (a shadow map before the first cascade, the light grid before the first scan). A binding's type is fixed when its shader is built, so a depth slot has to start with a depth texture, an integer slot with an integer one.

Parameters​

NameType
kindTextureSlotKind

Returns​

Texture


positionUnitsPerBlock​

▸ positionUnitsPerBlock(options): number

Parameters​

NameType
optionsSectionExtentOptions

Returns​

number


prepareTransparentMesh​

▸ prepareTransparentMesh(mesh): TransparentMeshData | null

Parameters​

NameType
meshMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>

Returns​

TransparentMeshData | null


projectPointLightFragment​

▸ projectPointLightFragment(lightX, lightY, lightZ, worldX, worldY, worldZ, tanHalf): { face: number ; u: number ; v: number ; w: number } | null

CPU mirror of the shader's face selection and UV/depth reconstruction, kept next to the camera builders so a unit test can assert that a world point projected through the camera lands on the same face UV and linear depth this function (and therefore the shader, shading/local-lights.ts) computes.

Returns null when the point projects outside the face's guarded frustum.

Parameters​

NameType
lightXnumber
lightYnumber
lightZnumber
worldXnumber
worldYnumber
worldZnumber
tanHalfnumber

Returns​

{ face: number ; u: number ; v: number ; w: number } | null


quantizeNormals​

▸ quantizeNormals(normals): Int8Array

Parameters​

NameType
normalsFloat32Array<ArrayBufferLike>

Returns​

Int8Array


quantizePositions​

▸ quantizePositions(positions, unitsPerBlock): Uint16Array

Parameters​

NameType
positionsnumber[] | Float32Array<ArrayBufferLike>
unitsPerBlocknumber

Returns​

Uint16Array


quantizeUvs​

▸ quantizeUvs(uvs): Uint16Array

Parameters​

NameType
uvsnumber[] | Float32Array<ArrayBufferLike>

Returns​

Uint16Array


readChromiumHeap​

▸ readChromiumHeap(): HeapSample

performance.memory, which is narrower and wider than its name: it is the page realm's heap plus its external memory (ArrayBuffers, canvases) against the page's own heap limit. It sees no worker at all, while every worker's heap shares the renderer's pointer-compression cage with the page's (the renderer dies when their sum reaches it, far below the limit reported here), and the external memory it counts lives outside that cage.

Returns​

HeapSample


readFarFaceLook​

▸ readFarFaceLook(block, blockId, side, stage, materialOf): FarFaceLook | null

What a block's upward (top) or sideways (side) face looks like from far away, for FarTerrainOptions.faceLook: the texels the chunks paint it with (read off the atlas its chunk material samples), their mean in linear RGB, and whether it takes the regional tint. Null while its texture is not painted yet. A block the registry lacks, or a face whose material is not an atlas, answers grey and says so: the far layer still draws. A game's world and the world viewer both read faces through it.

Parameters​

NameType
blockBlock
blockIdnumber
sideFarFaceSide
stagenumber
materialOf(block: Block, faceName: string) => { map?: unknown }

Returns​

FarFaceLook | null


readImagePixels​

▸ readImagePixels(image): Uint8ClampedArray | null

The RGBA8 pixels of an image a texture (or a keyframe) draws from, or null when they cannot be read on the CPU: a video, an image still loading.

Parameters​

NameType
imageunknown

Returns​

Uint8ClampedArray | null


readLazyWork​

▸ readLazyWork(): readonly LazyWorkEntry[]

Returns​

readonly LazyWorkEntry[]


readLazyWorkAfterInteractive​

▸ readLazyWorkAfterInteractive(): readonly LazyWorkEntry[]

Returns​

readonly LazyWorkEntry[]


releaseChunkMesh​

▸ releaseChunkMesh(mesh): void

Let a chunk mesh go for good: its geometry freed, it taken out of the scene, and the renderer told the mesh itself is gone.

three's WebGPU renderer keeps a render object (bindings, pipeline state, node uniforms, a listener on the material) for every mesh it has drawn, in a set it only empties when the mesh, its material or its lights fire dispose. Disposing the geometry alone leaves the render object, and through it the mesh and its geometry, alive for as long as the page. Chunk materials are the world's shared block materials and must not be disposed (see Chunk.dispose), so the mesh's own dispose event is what frees it. Without it every chunk mesh ever built stayed in memory: walking leaked about 10 MB a minute, a long teleport tour 75 MB a lap.

Parameters​

NameType
meshMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>

Returns​

void


releaseObject​

▸ releaseObject(root): void

Tell the renderer an object, and everything under it, is gone for good.

three's WebGPU renderer keeps a render object (bindings, pipeline state, node uniforms, a listener on the material) for every drawable it has drawn, in a set it only empties when the object, its material or its lights fire dispose. Taking an object out of the scene or disposing its geometry leaves all of that, and through it the object itself, alive. Where the material is shared (a cached block material, a held-item copy, a pooled effect material) nobody disposes it, so dropping the object must fire the object's own event. This does only that: it frees nothing the object shares, and an object drawn again later simply gets a fresh render object.

Parameters​

NameType
rootObject3D<Object3DEventMap>

Returns​

void


relightLoneCube​

▸ relightLoneCube(box, cells): number

Relights every quad of a one-voxel box of a full opaque cube (its lowest corner at the box's origin) as the mesher lights that cube in the cell cells describes: the light and occlusion bits of each vertex, the water-contact bit, the split of each quad and the light twist that rides it. Everything else each vertex carries (tint, greedy and stack bits) stays as the box was baked. Returns how many quads it relit.

Parameters​

NameType
boxObject3D<Object3DEventMap>
cellsLoneCubeNeighborhood

Returns​

number


relightVoxelBox​

▸ relightVoxelBox(box, cellsAt): number

Relights a box of full opaque cubes moving as one (a layer of blocks falling, say) the way relightLoneCube relights one: each quad corner is lit as the cube it is a corner of, in the cell cellsAt describes for that cube's offset in the box. The neighborhood holds the box's other cubes as opaque, so a face between two of them stays dark and a corner beside one occludes. A greedy quad spanning several cubes is lit at its corners and blends between them, as any merged face does.

Parameters​

NameType
boxObject3D<Object3DEventMap>
cellsAt(cell: readonly [number, number, number]) => LoneCubeNeighborhood

Returns​

number


remapCanvasBoxUVs​

▸ remapCanvasBoxUVs(source, target, index, groups, layout): void

Point each BoxGeometry group's UVs at its face's rect in the atlas, so a fragment samples the same face texel it did from the face's own texture (both upload flipped: the canvas top is v = 1). source is the geometry's original per-face UV array; target receives the atlas UVs.

Parameters​

NameType
sourceArrayLike<number>
targetObject
indexArrayLike<number>
groupsreadonly { count: number ; materialIndex?: number ; start: number }[]
layoutCanvasBoxAtlasLayout

Returns​

void


removeLight​

▸ removeLight(world, voxel, color): void

Parameters​

NameType
worldVoxelLightVolume
voxelCoords3
colorLightColor

Returns​

void


removeLightsBatch​

▸ removeLightsBatch(world, voxels, color): void

Batch remove light from multiple voxels that previously emitted the same light color. This drastically improves performance when many contiguous light sources are removed at once.

Parameters​

NameType
worldVoxelLightVolume
voxelsCoords3[]
colorLightColor

Returns​

void


requestWorkerAnimationFrame​

▸ requestWorkerAnimationFrame(callback): number

Parameters​

NameType
callback() => void

Returns​

number


resetFrameClock​

▸ resetFrameClock(): void

Forgets every frame seen. For tests.

Returns​

void


resetIkCameraPosition​

▸ resetIkCameraPosition(): void

A world left: no camera until the next world's first frame.

Returns​

void


resetLazyWorkLedger​

▸ resetLazyWorkLedger(): void

Returns​

void


resolveAtlasFiltering​

▸ resolveAtlasFiltering(mode): Object

The filter/mip/anisotropy settings for a mode, pulled out of AtlasTexture.applyFiltering so the mapping is testable without a canvas or a GL context.

Parameters​

NameType
modeAtlasFilteringMode

Returns​

Object

NameType
anisotropynumber
generateMipmapsboolean
magFiltertypeof NearestFilter
minFiltertypeof NearestFilter | typeof NearestMipmapNearestFilter

resolveCoupledAnchor​

▸ resolveCoupledAnchor(view, block): Block

The anchor of the coupled unit block belongs to — the part a player holds, places, and is paid in drops. A block that is not coupled, or is the anchor itself, resolves to itself, so item and pick paths can call this for every block.

Parameters​

NameType
viewPick<CoupledWorldView, "getBlockById">
blockBlock

Returns​

Block


restoreEntityLight​

▸ restoreEntityLight(material): void

Undo applyEntityLight: the material's own nodes back.

Parameters​

NameType
materialNodeMaterial

Returns​

void


rotateCoupledOffset​

▸ rotateCoupledOffset(offset, rotation): Coords3 | null

Local-frame offsets use the geometry transform, without its pivot shift. Reject non-lattice rotations instead of rounding a unit into other cells.

Parameters​

NameType
offsetCoords3
rotationBlockRotation

Returns​

Coords3 | null


runMeshTransferBenchmark​

▸ runMeshTransferBenchmark(dispatch, getChunk, options): Promise<MeshTransferBenchmarkResult>

Parameters​

NameType
dispatchMeshTransferDispatch
getChunk(cx: number, cz: number) => Chunk
optionsMeshTransferBenchmarkOptions

Returns​

Promise<MeshTransferBenchmarkResult>


sampleChassisGround​

▸ sampleChassisGround(sampleGround, centerX, centerZ, probeStartY, maxGroundY, cosYaw, sinYaw, halfWidth, halfDepth): number | null

Parameters​

NameType
sampleGroundGroundHeightSampler
centerXnumber
centerZnumber
probeStartYnumber
maxGroundYnumber
cosYawnumber
sinYawnumber
halfWidthnumber
halfDepthnumber

Returns​

number | null


sampleFlicker​

▸ sampleFlicker(speed, amplitude, phase, seconds, out): void

One flickering light at seconds: writes [intensity scale, dx, dy, dz] into out (the scale multiplies the light, the offset moves its origin for shading only; shadow maps keep the real origin).

Parameters​

NameType
speednumber
amplitudenumber
phasenumber
secondsnumber
outnumber[] | Float32Array<ArrayBufferLike>

Returns​

void


sampleHitFlash​

▸ sampleHitFlash(elapsedMs, color, isCalm?, profile?): number

The flash elapsedMs after a hit: writes its colour into color and returns how far to mix toward it (0 once it is over, or before any hit). isCalm (reduced motion) drops the white pop and opens on the red.

Parameters​

NameTypeDefault value
elapsedMsnumberundefined
colorColorundefined
isCalmbooleanfalse
profileHitFlashProfileHIT_FLASH

Returns​

number


sampleHitRecoil​

▸ sampleHitRecoil(elapsedMs): number

0..1 of the recoil lean elapsedMs after a hit (a half sine).

Parameters​

NameType
elapsedMsnumber

Returns​

number


scaleGaitProfile​

▸ scaleGaitProfile(profile, size): GaitProfile

Parameters​

NameType
profileGaitProfile
sizenumber

Returns​

GaitProfile


screenFaceNormal​

▸ screenFaceNormal(worldPosition): Vec3Node

The flat face's normal at a fragment, from how its world position moves across the screen, turned toward the camera. The raw cross product's sign follows the screen's y (up under WebGL, down under WebGPU), so it is oriented by the view instead. Take it in uniform control flow: it is a derivative.

Parameters​

NameType
worldPositionVec3Node

Returns​

Vec3Node


setDefaultSkinnedTextureSource​

▸ setDefaultSkinnedTextureSource(source): void

Parameters​

NameType
sourceSkinnedTextureSource

Returns​

void


setFluidMaterialSides​

▸ setFluidMaterialSides(materials, isCameraUnderwater, isWater): void

Turns each fluid chunk material to the side the camera sees it from: the back while the camera is under water, so the water's surface shows from below, the front otherwise. Only a fluid that counts as water turns. Lava seen from under water is still the top of a lava pool, and drawn by its back it vanished, leaving the floor under it.

Parameters​

NameType
materialsIterable<Material<MaterialEventMap>, any, any>
isCameraUnderwaterboolean
isWater(blockId: number) => boolean

Returns​

void


setFrameTime​

▸ setFrameTime(timestamp): void

Say which refresh the frame now being drawn is for: the timestamp the browser passed to the animation-frame callback. null once it is drawn.

Parameters​

NameType
timestampnumber

Returns​

void


setHiddenTabTicker​

▸ setHiddenTabTicker(ticker): void

Parameters​

NameType
tickerHiddenTabTicker

Returns​

void


setIkCameraPosition​

▸ setIkCameraPosition(position): void

Parameters​

NameType
positionVector3

Returns​

void


setLoadPhaseDrainScheduling​

▸ setLoadPhaseDrainScheduling(mode, priority?): void

Parameters​

NameTypeDefault value
modeLoadPhaseDrainSchedulingundefined
priorityLoadPhaseTaskPriority"background"

Returns​

void


setOwnFaceTexture​

▸ setOwnFaceTexture(material, texture): void

Point an own-texture face's material at texture.

Parameters​

NameType
materialChunkMaterial
textureTexture<unknown, TextureEventMap>

Returns​

void


setPerfWorld​

▸ setPerfWorld(world): void

Parameters​

NameType
worldstring

Returns​

void


setSectionBounds​

▸ setSectionBounds(geometry): void

Gives a section's geometry its bounds from one pass over its position array. A batch copies a geometry's own bounds into its slot; without them it takes them from the slot's vertices through the index, twice (box, then sphere) and through three's attribute accessors: ~0.3 ms a section, twice a frame while flying into new land. The sphere is the box's, a little larger than the tightest, which culls and sorts alike.

Parameters​

NameType
geometryBufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>

Returns​

void


setShadowBody​

▸ setShadowBody(material, body): void

Has material shade as part of body. A material that reads materialShadowBody must hold one; a clone holds a copy of the record, frozen, until it is pointed at its body again.

Parameters​

NameType
materialMaterial<MaterialEventMap>
bodyEntityShadowBody

Returns​

void


setSharedEntityFogUniforms​

▸ setSharedEntityFogUniforms(fog): void

The world whose atmosphere entity materials made from now on read.

Parameters​

NameType
fogEntityFogUniforms

Returns​

void


setSlotData​

▸ setSlotData<T>(slot, key, value): SlotContent

Type parameters​

Name
T

Parameters​

NameType
slotSlotContent
keystring
valueT

Returns​

SlotContent


setWorkerInterval​

▸ setWorkerInterval(func, interval): () => void

Parameters​

NameType
func() => void
intervalnumber

Returns​

fn

▸ (): void

Returns​

void


setupTransparentSorting​

▸ setupTransparentSorting(object): void

Parameters​

NameType
objectObject3D<Object3DEventMap>

Returns​

void


shadowBoundsToWorld​

▸ shadowBoundsToWorld(toWorld, sphere, margin?): Vec4Node

A body's bounding sphere (sphere: centre and radius in its own space) carried to the world by toWorld, the radius scaled by the matrix's largest axis and widened by margin: the bounds within caps the self-shadow bias at. A radius of 0 (no bounds yet) stays 0.

Parameters​

NameTypeDefault value
toWorldMat4Nodeundefined
sphereVec4Nodeundefined
marginnumber | FloatNode0

Returns​

Vec4Node


shadowDepthPerBlock​

▸ shadowDepthPerBlock(shadowMatrix, lightDirection, clipToStored): number

How far the depth stored in a shadow map moves per block along the light: the map is an orthographic projection, so this is one number per cascade, the depth component of the light direction carried through its matrix, in stored units: WebGPU stores clip depth as is (clipToStored 1), WebGL maps its -1..1 to 0..1 (0.5).

Parameters​

NameType
shadowMatrixMatrix4
lightDirectionVector3
clipToStorednumber

Returns​

number


shadowedBodyColor​

▸ shadowedBodyColor(u, options?): Vec4Node

A body part's colour under the sun's shadow: base (by default the material's colour times its map, three's own colour node) times the entity shadow at the fragment, from the geometry's own normal carried to the world. For a basic material's colorNode, so the world's fog lands over the shadowed colour. "within" caps the slope bias at the body's own bounds; "at" is the plain slope bias.

Parameters​

NameType
uObject
u.uCascadeSplit0ValueUniform<16>
u.uCascadeSplit1ValueUniform<48>
u.uCascadeSplit2ValueUniform<128>
u.uShadowBiasValueUniform<0.0005>
u.uShadowDepthPerBlockValueUniform<0>
u.uShadowMap0TextureNode<"vec4">
u.uShadowMap1TextureNode<"vec4">
u.uShadowMap2TextureNode<"vec4">
u.uShadowMatrix0ValueUniform<Matrix4>
u.uShadowMatrix1ValueUniform<Matrix4>
u.uShadowMatrix2ValueUniform<Matrix4>
u.uShadowNormalBiasValueUniform<0.01>
u.uShadowStrengthValueUniform<1>
u.uSunColorValueUniform<Color>
u.uSunDirectionValueUniform<Vector3>
u.uSunlightIntensityValueUniform<1>
optionsObject
options.base?Vec4Node
options.bias?"at" | "within"
options.body?EntityShadowBodyInputs

Returns​

Vec4Node


shadowedBodyColorNode​

▸ shadowedBodyColorNode(): Vec4Node

The colour node of a body part drawn with a basic material: its colour and map under the world's sun, bounded by the body it belongs to (the material's setShadowBody). One node, so every such part of every body shares one graph.

Returns​

Vec4Node


shareBuffers​

▸ shareBuffers(source): BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>

A geometry drawing source's buffers under a draw range of its own, with the bounds the culling reads. Never dispose it on its own while source lives: disposing a geometry frees its attributes' buffers, and these are source's.

Parameters​

NameType
sourceBufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>

Returns​

BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>


sharedCutoutBlending​

▸ sharedCutoutBlending(isClosedCube): Object

How a shared cutout bucket draws its texels. A closed cutout cube (a leaf canopy, isClosedCutoutCube) draws in the opaque pass: a texel stands, at full alpha, once it clears half coverage, or it is cut. Blended, a far or grazing leaf face sampled a mip whose holes averaged its alpha down to a half, and that half-alpha film read as plastic wrap over the canopy, the sky pale through every side face. A tile's own texels are all 0 or 255, so up close the cut is the tile's; at a distance the half-coverage test keeps about as many texels as the tile has, so the canopy keeps its gaps. The other cutouts (plants, light-attenuating panes) keep blending at SEE_THROUGH_ALPHA_TEST.

Parameters​

NameType
isClosedCubeboolean

Returns​

Object

NameType
alphaTestnumber
transparentboolean

sharedCutoutMaterialKeyFor​

▸ sharedCutoutMaterialKeyFor(block): string | null

The shared bucket a depth-writing cutout block collapses into, or null for blocks that keep a per-id material. Plants live apart from leaves so the plant-radius culling can hide a section's plants without taking its canopy down, and because the two halves disagree on shadow casting (skipShadow is a material property). Standalone cutouts that neither sway nor attenuate light — doors, decor — stay per-id: folding them in would silently change their shadow behavior.

Parameters​

NameType
blockBlock

Returns​

string | null


sharedEntityFog​

▸ sharedEntityFog(): EntityFogUniforms | null

The live world's atmosphere, or null before any world set it.

Returns​

EntityFogUniforms | null


sharedFaceCustomizationError​

▸ sharedFaceCustomizationError(blockName, faceName, material, materials): Error | null

Why a face-level shader customization must not go ahead, or null when it may. A face that is neither independent nor isolated draws with its block's material, and for a block in a shared bucket that is the bucket's: a shader set there replaces the shader of every block in the bucket. Per stage faces of one cross-plant block once rewrote the shared plant material that way, so every plant swayed with that one block's profile and the per-block sway table went unread.

Parameters​

NameType
blockNamestring
faceNamestring
materialMaterial<MaterialEventMap>
materialsReadonlyMap<string, Material<MaterialEventMap>>

Returns​

Error | null


sharedLightCones​

▸ sharedLightCones(): LightConeUniforms

The page's light cones (the shared entity block's), for a material outside the instanced pools that shades with them. Before any world has set them, a cone-less stand-in, so a warmup builds the same program.

Returns​

LightConeUniforms


shortestYawDelta​

▸ shortestYawDelta(fromY, toY): number

Parameters​

NameType
fromYnumber
toYnumber

Returns​

number


simplexNoise3​

▸ simplexNoise3(vx, vy, vz): number

The chunk shader's 3D simplex noise (simplexNoise3Node), on the CPU.

Parameters​

NameType
vxnumber
vynumber
vznumber

Returns​

number


simplexNoise3Node​

▸ simplexNoise3Node(...args): FloatNode

3D simplex noise (Ashima / Ian McEwan), -1..1. The chunk shaders' swell, sway and water streaks all read it, and simplexNoise3 in fluid-waves.ts is its CPU twin (floats ride the swell the player sees), so the two must agree to the bit pattern of the math: change neither alone.

Parameters​

NameType
...args[Vector3 | Node<"vec3">]

Returns​

FloatNode


skyFog​

▸ skyFog(u): Object

The sky's fog over one world's uniforms: its glow, gradient and haze.

Parameters​

NameType
uSkyFogInputs

Returns​

Object

NameType
apply(color: Vec3Node, worldPosition: Vec3Node, reveal: FloatNode, isEmission: boolean, flatDistance?: FloatNode, isSolid: boolean) => Vec3Node
discs(ray: Vec3Node) => Vec3Node
dome(ray: Vec3Node) => Vec3Node
fogFactor(worldPosition: Vec3Node, flatDistance?: FloatNode) => FloatNode
fogTint(ray: Vec3Node, withGlow: boolean) => Vec3Node
glow(ray: Vec3Node) => Vec3Node
haze(color: Vec3Node, ray: Vec3Node, factor: FloatNode, isSolid: boolean) => Vec3Node
underwater(color: Vec3Node, worldPosition: Vec3Node, isEmission: boolean) => Vec3Node

skyGlow​

▸ skyGlow(u): Object

The sky's own light along a unit ray. The sky dome draws it and every fogged surface tints toward it, so a ridge hazed into a sunset glows exactly like the sky behind it.

Parameters​

NameType
uSkyGlowInputs

Returns​

Object

NameType
discs(ray: Vec3Node) => Vec3Node
glow(ray: Vec3Node) => Vec3Node

skyGlowInputsOf​

▸ skyGlowInputsOf(glow, directSunlight): SkyGlowInputs

The glow as skyGlow reads it, veiled by directSunlight.

Parameters​

NameType
glowSkyGlowUniforms
directSunlightFloatNode

Returns​

SkyGlowInputs


slewShaderClock​

▸ slewShaderClock(current, target, step): number

One frame of the slew: current advanced by step and pulled toward target by at most SHADER_CLOCK_SLEW_RATE * step, or set to target when it is unset or too far off to slew.

Parameters​

NameType
currentnumber
targetnumber
stepnumber

Returns​

number


snapLengthToTexels​

▸ snapLengthToTexels(length, texelsPerUnit): number

Rounds a length up to whole texels, never below one: a mesh scaled through this grows in visible steps of the grid rather than smoothly, and a sliver never rounds away to nothing.

Parameters​

NameType
lengthnumber
texelsPerUnitnumber

Returns​

number


snapToTexel​

▸ snapToTexel(p, texelsPerUnit): number

snapToTexelNode, for one axis.

Parameters​

NameType
pnumber
texelsPerUnitnumber

Returns​

number


snapToTexelNode​

▸ snapToTexelNode<T>(p, texelsPerUnit): T

The centre of the texel p falls in, on a grid of texelsPerUnit texels per world unit (16 is the block grain). Any float vector.

Type parameters​

NameType
Textends FloatNode | Vec2Node | Vec3Node

Parameters​

NameType
pT
texelsPerUnitnumber | FloatNode

Returns​

T


solveFabrik​

▸ solveFabrik(chain, base, target, options): void

Parameters​

NameType
chainIkChain
baseVector3
targetVector3
optionsFabrikSolveOptions

Returns​

void


solveTwoBoneIk​

▸ solveTwoBoneIk(root, target, pole, limb, outMid, outEnd): void

Parameters​

NameType
rootVector3
targetVector3
poleVector3
limbTwoBoneIkLimb
outMidVector3
outEndVector3

Returns​

void


sortTransparentMesh​

▸ sortTransparentMesh(mesh, data, camera): void

Parameters​

NameType
meshMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>
dataTransparentMeshData
cameraCamera

Returns​

void


sortUnpainted​

▸ sortUnpainted(surfaces): UnpaintedSurface[]

Parameters​

NameType
surfacesUnpaintedSurface[]

Returns​

UnpaintedSurface[]


splitVoxelBoxGeometry​

▸ splitVoxelBoxGeometry(«destructured»): GeometryProtocol[]

geometry cut into pieces of at most maxTriangles triangles, each with only the vertices its own triangles use, so building any one piece on the main thread is a bounded unit of work. Pieces start on even triangles, so a quad the mesher wrote as two triangles stays in one piece.

Parameters​

NameType
«destructured»Object
› geometryGeometryProtocol
› maxTrianglesnumber

Returns​

GeometryProtocol[]


stampChatPerf​

▸ stampChatPerf(chat): void

Parameters​

NameType
chatChatProtocol

Returns​

void


stepTime​

▸ stepTime(t, framesPerSecond): number

stepTimeNode's twin.

Parameters​

NameType
tnumber
framesPerSecondnumber

Returns​

number


stepTimeNode​

▸ stepTimeNode(t, framesPerSecond): FloatNode

A clock that holds each frame, for flip-book animation.

Parameters​

NameType
tFloatNode
framesPerSecondnumber | FloatNode

Returns​

FloatNode


strideGaitParamsForLeg​

▸ strideGaitParamsForLeg(legLength, maxLegSwing): StrideGaitParams

Parameters​

NameType
legLengthnumber
maxLegSwingnumber

Returns​

StrideGaitParams


strideGaitParamsForScale​

▸ strideGaitParamsForScale(bodyScale): StrideGaitParams

Parameters​

NameType
bodyScalenumber

Returns​

StrideGaitParams


strideGaitParamsForWalker​

▸ strideGaitParamsForWalker(legLength, maxLegSwing): StrideGaitParams

Parameters​

NameType
legLengthnumber
maxLegSwingnumber

Returns​

StrideGaitParams


styleLightConeScatter​

▸ styleLightConeScatter(scatter, style): number

One cone's scattered term under style (the shader's lightConeScatterStyled, per channel peak), for tests and tooling.

Parameters​

NameType
scatternumber
styleObject
style.xnumber
style.ynumber
style.znumber

Returns​

number


sunShadow​

▸ sunShadow(u): (__namedParameters: { ndotl: FloatNode ; normal: Vec3Node ; options: SunShadowOptions ; sunExposure: FloatNode ; viewDepth: FloatNode ; worldPosition: Vec3Node }) => FloatNode

The sun's cascaded shadow over one world's uniforms. visibility is 1 where the sun reaches the fragment and 0 under a caster, faded by shadowStrength, with the cascades blended over the last tenth of each split and the far one fading out to lit.

Parameters​

NameTypeDescription
uObject-
u.ambientColorValueUniform<Color>-
u.bedCausticScaleValueUniform<1>0..1 scale on the caustic net seen on submerged faces from below.
u.cascadeSplit0ValueUniform<16>-
u.cascadeSplit1ValueUniform<48>-
u.cascadeSplit2ValueUniform<128>-
u.celestialDirectionValueUniform<Vector3>The celestial disc above the horizon as the sky box actually draws it (getVisibleDiscDirection): the sun by day, the moon by night, never clamped or tilted. Specular reflections read this, so the sun on the water sits under the sun in the sky.
u.directSunlightValueUniform<1>The share of the sun (the moon by night) that reaches the world as a direct beam, 0..1: 1 under a clear sky, falling as cloud veils the disc. What only a beam draws (glints on water, caustics, the disc seen through the surface from below) scales by it; diffuse daylight (sunlightIntensity) does not. A host with weather lowers it.
u.shadowBiasValueUniform<0.00018>-
u.shadowDebugModeValueUniform<0>-
u.shadowDepthPerBlockValueUniform<0>How much shadow-map depth one block toward the sun spans (cascade 0), for an entity measuring its own body in the map.
u.shadowMap0TextureNode<"vec4">-
u.shadowMap1TextureNode<"vec4">-
u.shadowMap2TextureNode<"vec4">-
u.shadowMatrix0ValueUniform<Matrix4>-
u.shadowMatrix1ValueUniform<Matrix4>-
u.shadowMatrix2ValueUniform<Matrix4>-
u.shadowNormalBiasValueUniform<0.0015>-
u.shadowSideFaceBiasScaleValueUniform<1>-
u.shadowSlopeBiasMinValueUniform<0.00012>-
u.shadowSlopeBiasScaleValueUniform<0.0012>-
u.shadowStrengthValueUniform<1>-
u.shadowTopFaceBiasScaleValueUniform<1>-
u.skyMiddleColorValueUniform<Color>-
u.skyTopColorValueUniform<Color>-
u.sunColorValueUniform<Color>-
u.sunDirectionValueUniform<Vector3>The shading light: held above a minimum elevation, tilted off the sun's plane, and blended toward the moon through twilight, so terrain shading and shadows stay readable at every hour. Not where the sun is drawn.
u.sunlightIntensityValueUniform<1>The sun's intensity as the sky gives it (the chunk set's own copy keeps a floor of 0.05): what entity shadows fade with at night.
u.waterAbsorptionValueUniform<1>-
u.waterFresnelStrengthValueUniform<0.5>-
u.waterLevelValueUniform<86>-
u.waterStreakStrengthValueUniform<0.1>-
u.waterTintValueUniform<Color>-

Returns​

fn

▸ («destructured»): FloatNode

Parameters​
NameTypeDescription
«destructured»Object-
› ndotlFloatNodeThe shading light's incidence (a cross plant passes its fixed 0.5).
› normalVec3Node-
› optionsSunShadowOptions-
› sunExposureFloatNodeThe voxel's sunlight, 0..1: an unlit cave takes the shadow outright.
› viewDepthFloatNode-
› worldPositionVec3Node-
Returns​

FloatNode


surfaceCoatDensity​

▸ surfaceCoatDensity(coat, drift): number

surfaceCoatDensity.

Parameters​

NameType
coatnumber
driftnumber

Returns​

number


surfaceCoatDrift​

▸ surfaceCoatDrift(x, z): number

surfaceCoatDrift.

Parameters​

NameType
xnumber
znumber

Returns​

number


surfaceCoatMean​

▸ surfaceCoatMean(coat): number

surfaceCoatMean.

Parameters​

NameType
coatnumber

Returns​

number


surfacePocksShowing​

▸ surfacePocksShowing(cellX, cellZ, seconds, chance): boolean

Splashes showing at once per square block at a time, with the share of slots that splash.

Parameters​

NameType
cellXnumber
cellZnumber
secondsnumber
chancenumber

Returns​

boolean


surfaceWeather​

▸ surfaceWeather(u): Object

The surface-weather shading of one world, over its uniforms: wet ground, rain pocks and rings near the player, the coat on the far layer.

Parameters​

NameType
u{ surfaceCoatColor: ValueUniform<Color> ; surfaceWeather: ValueUniform<Vector3> ; surfaceWeatherLine: ValueUniform<Vector4> ; surfaceWeatherMap: TextureNode<"vec4"> ; surfaceWeatherWindow: ValueUniform<Vector4> ; surfaceWind: ValueUniform<Vector4> } & Pick<ChunkUniforms, "skyFogTopColor" | "skyFogMiddleColor" | "skyFogOffset" | "skyFogExponent" | "skyFogDimension">

Returns​

Object

NameTypeDescription
above(xz: Vec2Node, y: FloatNode, lineCode: FloatNode) => Node<"float">1 above the coat line (snow country), 0 below it, across a jittered band.
faceWet(normal: Vec3Node) => FloatNodeHow much of the rain a face takes: tops all of it, walls some, more into the wind.
farAlbedo(albedo: Vec3Node, p: Vec3Node, normal: Vec3Node, footprint: FloatNode) => Vec3NodeThe far layer's ground under the weather: the wet ground the chunks draw and the snow laid near the player as blocks, averaged at the footprint it is seen at (no texels, no pocks, no rings), so the two meet without a seam.
isActiveNode<"bool">Whether any weather term is live: all zero skips every one.
pock(texel: Vec2Node, seconds: FloatNode, chance: FloatNode) => FloatNodeA drop's pixel splash at a 1/16 texel: a dot, then a plus, then a faint ring.
pockMeannumber-
ringsFnNode<[Vector2 | Node<"vec2">, number | Node<"float"> | Node<"uint">, number | Node<"float"> | Node<"uint">], VarNode<"vec3", ConstNode<"vec3", Vector3>>>-
sample(xz: Vec2Node) => Vec4Node-
skyAlong(dir: Vec3Node) => Vec3NodeThe sky dome's ramp along dir, for what a wet crest mirrors.
wetAlbedo(albedo: Vec3Node, wet: FloatNode) => Vec3NodeWet ground: darker and a little more saturated, never glossy.

surfaceWeatherHash2​

▸ surfaceWeatherHash2(x, y): number

surfaceWeatherHash(vec2).

Parameters​

NameType
xnumber
ynumber

Returns​

number


surfaceWeatherHash3​

▸ surfaceWeatherHash3(x, y, z): number

surfaceWeatherHash(vec3).

Parameters​

NameType
xnumber
ynumber
znumber

Returns​

number


surfaceWeatherNoise​

▸ surfaceWeatherNoise(x, y): number

surfaceWeatherNoise.

Parameters​

NameType
xnumber
ynumber

Returns​

number


surfaceWeatherPock​

▸ surfaceWeatherPock(texelX, texelZ, seconds, chance): number

surfaceWeatherPock: the brightness a raindrop puts on a texel at a time (0 when none), with the share of slots that splash.

Parameters​

NameType
texelXnumber
texelZnumber
secondsnumber
chancenumber

Returns​

number


tallyState​

▸ tallyState(tally, state): void

Parameters​

NameType
tallySurfaceTally
stateSurfaceState

Returns​

void


targetUvToNdc​

▸ targetUvToNdc(uv): Vec2Node

A render target's texture uv (v down from the top row) back to normalized device xy (-1..1, y up): the inverse of ndcToTargetUv.

Parameters​

NameType
uvVec2Node

Returns​

Vec2Node


texelPlanOf​

▸ texelPlanOf(material, classes, canCut): TexelPlan

Parameters​

NameType
materialPick<Material<MaterialEventMap>, "depthWrite">
classesTexelClasses
canCutboolean

Returns​

TexelPlan


texelsForBlocks​

▸ texelsForBlocks(blocks, density): number

Parameters​

NameType
blocksnumber
densityTexelDensity

Returns​

number


textureSlot​

▸ textureSlot(kind, initial?): TextureNode<"vec4">

A texture input whose texture can be swapped at runtime (node.value = texture), starting from initial or a placeholder of kind.

Parameters​

NameType
kindTextureSlotKind
initial?Texture<unknown, TextureEventMap>

Returns​

TextureNode<"vec4">


textureTexelClasses​

▸ textureTexelClasses(texture, cuts): TexelClasses

classifyTexels over a whole texture, cached per texture version.

Parameters​

NameType
textureTexture<unknown, TextureEventMap>
cutsTexelAlphaCuts

Returns​

TexelClasses


transparentChunkRenderOrder​

▸ transparentChunkRenderOrder(isFluid, depthWrite): number

The render order of a see-through chunk mesh.

Parameters​

NameType
isFluidboolean
depthWriteboolean

Returns​

number


transparentEffectRenderOrder​

▸ transparentEffectRenderOrder(isInCameraMedium): number

Where a see-through effect draws: anything transparent that writes no depth and has no band of its own (particles, sprites, foam, weather). It draws after the cutouts, whose depth hides it behind a canopy instead of the canopy painting over it in front of one, and on the side of the water its medium puts it. In the camera's medium it stands in front of any water it overlaps, so it draws after the water, just before the panes in front of the water (which cover it as a tinted layer); in the other medium it is seen through the surface and draws before the water, just after the panes seen through it, where the refraction copy holds it.

Parameters​

NameType
isInCameraMediumboolean

Returns​

number


undersideSceneShare​

▸ undersideSceneShare(cosIncidence): number

The share of the scene above in the underside's colour at cosIncidence (mirrors the Snell window in shading/water-surface.ts): the window's Fresnel transmission over the dry world showing through the rest of the surface.

Parameters​

NameType
cosIncidencenumber

Returns​

number


undersideTransmission​

▸ undersideTransmission(cosIncidence): number

The share of light the surface passes from above to a ray meeting it from below at cosIncidence to its normal (mirrors the Snell-window underside): none beyond the critical angle, where the surface reflects everything, and Schlick's Fresnel on the air-side angle inside it.

Parameters​

NameType
cosIncidencenumber

Returns​

number


underwaterFog​

▸ underwaterFog(u): (color: Vec3Node, worldPosition: Vec3Node, isEmission: boolean) => Vec3Node

Per-channel (Beer-Lambert) fog along the camera's underwater view path, clamped at the waterline plane so geometry above the surface only takes the submerged segment. Emission loses light along the ray but gains no ambient water light. Mixed in by the camera's submersion, so dry it is the colour unchanged.

Parameters​

NameType
uUnderwaterFogInputs

Returns​

fn

▸ (color, worldPosition, isEmission?): Vec3Node

Parameters​
NameTypeDefault value
colorVec3Nodeundefined
worldPositionVec3Nodeundefined
isEmissionbooleanfalse
Returns​

Vec3Node


underwaterInScatterScale​

▸ underwaterInScatterScale(dirY): number

The underwater in-scatter's brightness, against the scatter colour, for a ray whose unit direction has vertical component dirY (mirrors the fog fragment and the sky dome's reflection band).

Parameters​

NameType
dirYnumber

Returns​

number


uniformArray​

▸ uniformArray<TNodeType>(values, nodeType?): UniformArrayNode<TNodeType>

A uniform array of world-wide data (light cones, the clustered lights' air members, the biome and pigment tables, the sway table), in the world's group: written once a render. In TSL's default group, the object's, three writes the whole array again for every draw that reads it, unchanged or not: ~600 writes a frame over a large world's chunk draws. Its values must hold still within a render, as every world uniform's do.

Type parameters​

Name
TNodeType

Parameters​

NameType
valuesunknown[]
nodeType?TNodeType

Returns​

UniformArrayNode<TNodeType>


unpackLightSeeds​

▸ unpackLightSeeds(packed): LightSeeds

The seeds packLightSeeds packed, as a job holds them.

Parameters​

NameType
packedInt32Array<ArrayBufferLike>

Returns​

LightSeeds


unplacedShadowBody​

▸ unplacedShadowBody(): EntityShadowBodyInputs

A body shaded where it is drawn, with no bounds of its own (or bounds a shader passes in itself, as an instanced creature does).

Returns​

EntityShadowBodyInputs


updateEntityShadowUniforms​

▸ updateEntityShadowUniforms(target, source): void

Parameters​

NameTypeDescription
targetObject-
target.uCascadeSplit0ValueUniform<16>-
target.uCascadeSplit1ValueUniform<48>-
target.uCascadeSplit2ValueUniform<128>-
target.uShadowBiasValueUniform<0.0005>-
target.uShadowDepthPerBlockValueUniform<0>-
target.uShadowMap0TextureNode<"vec4">-
target.uShadowMap1TextureNode<"vec4">-
target.uShadowMap2TextureNode<"vec4">-
target.uShadowMatrix0ValueUniform<Matrix4>-
target.uShadowMatrix1ValueUniform<Matrix4>-
target.uShadowMatrix2ValueUniform<Matrix4>-
target.uShadowNormalBiasValueUniform<0.01>-
target.uShadowStrengthValueUniform<1>-
target.uSunColorValueUniform<Color>-
target.uSunDirectionValueUniform<Vector3>-
target.uSunlightIntensityValueUniform<1>-
sourceObject-
source.ambientColorValueUniform<Color>-
source.bedCausticScaleValueUniform<1>0..1 scale on the caustic net seen on submerged faces from below.
source.cascadeSplit0ValueUniform<16>-
source.cascadeSplit1ValueUniform<48>-
source.cascadeSplit2ValueUniform<128>-
source.celestialDirectionValueUniform<Vector3>The celestial disc above the horizon as the sky box actually draws it (getVisibleDiscDirection): the sun by day, the moon by night, never clamped or tilted. Specular reflections read this, so the sun on the water sits under the sun in the sky.
source.directSunlightValueUniform<1>The share of the sun (the moon by night) that reaches the world as a direct beam, 0..1: 1 under a clear sky, falling as cloud veils the disc. What only a beam draws (glints on water, caustics, the disc seen through the surface from below) scales by it; diffuse daylight (sunlightIntensity) does not. A host with weather lowers it.
source.shadowBiasValueUniform<0.00018>-
source.shadowDebugModeValueUniform<0>-
source.shadowDepthPerBlockValueUniform<0>How much shadow-map depth one block toward the sun spans (cascade 0), for an entity measuring its own body in the map.
source.shadowMap0TextureNode<"vec4">-
source.shadowMap1TextureNode<"vec4">-
source.shadowMap2TextureNode<"vec4">-
source.shadowMatrix0ValueUniform<Matrix4>-
source.shadowMatrix1ValueUniform<Matrix4>-
source.shadowMatrix2ValueUniform<Matrix4>-
source.shadowNormalBiasValueUniform<0.0015>-
source.shadowSideFaceBiasScaleValueUniform<1>-
source.shadowSlopeBiasMinValueUniform<0.00012>-
source.shadowSlopeBiasScaleValueUniform<0.0012>-
source.shadowStrengthValueUniform<1>-
source.shadowTopFaceBiasScaleValueUniform<1>-
source.skyMiddleColorValueUniform<Color>-
source.skyTopColorValueUniform<Color>-
source.sunColorValueUniform<Color>-
source.sunDirectionValueUniform<Vector3>The shading light: held above a minimum elevation, tilted off the sun's plane, and blended toward the moon through twilight, so terrain shading and shadows stay readable at every hour. Not where the sun is drawn.
source.sunlightIntensityValueUniform<1>The sun's intensity as the sky gives it (the chunk set's own copy keeps a floor of 0.05): what entity shadows fade with at night.
source.waterAbsorptionValueUniform<1>-
source.waterFresnelStrengthValueUniform<0.5>-
source.waterLevelValueUniform<86>-
source.waterStreakStrengthValueUniform<0.1>-
source.waterTintValueUniform<Color>-

Returns​

void


updateGait​

▸ updateGait(state, profile, homes, velocity, deltaSeconds, sampleGround, reach, ascentRise?): void

Parameters​

NameTypeDefault value
stateGaitStateundefined
profileGaitProfileundefined
homesreadonly Vector3[]undefined
velocityVector3undefined
deltaSecondsnumberundefined
sampleGroundGroundHeightSamplerundefined
reachGaitReachInputundefined
ascentRisenumber0

Returns​

void


vertexColorSurface​

▸ vertexColorSurface(partCount): EntitySurfaceOptions

Parameters​

NameType
partCountnumber

Returns​

EntitySurfaceOptions


voxelBoxBand​

▸ voxelBoxBand(options): VoxelBoxBand

Lays out one band of a box for the mesher.

Parameters​

NameType
optionsVoxelBoxBandOptions

Returns​

VoxelBoxBand


voxelBoxBandRows​

▸ voxelBoxBandRows(«destructured»): { firstRow: number ; rows: number }[]

The bands a box of rows rows meshes in, bandHeight rows each.

Parameters​

NameType
«destructured»Object
› bandHeightnumber
› rowsnumber

Returns​

{ firstRow: number ; rows: number }[]


voxelBoxTexelFrame​

▸ voxelBoxTexelFrame(origin, groupWorld, out): Matrix4

Where a voxel box's greedy faces take their texels from: the matrix that takes a world position of the box, drawn under groupWorld, back to where its voxel was meshed (its origin plus the box-local point). The chunk shader rebuilds a greedy quad's texels from the position and normal it shades (greedyFaceUv), so a box that moves or turns, a felled tree coming down, would otherwise slide its textures across itself and flip them as a face turns past 45 degrees. Read through this frame they ride the box at the density they had standing. Identity while the box stands where it was meshed.

Parameters​

NameType
originCoords3
groupWorldMatrix4
outMatrix4

Returns​

Matrix4


walkerCadenceCeilingHz​

▸ walkerCadenceCeilingHz(legLength): number

Parameters​

NameType
legLengthnumber

Returns​

number


walkerFullSwingSpeed​

▸ walkerFullSwingSpeed(legLength): number

Parameters​

NameType
legLengthnumber

Returns​

number


warmNextRosterEntry​

▸ warmNextRosterEntry<TType>(types, hasBabies, isWarm, bake): boolean

Type parameters​

NameType
TTypeextends string

Parameters​

NameType
typesreadonly TType[]
hasBabiesboolean
isWarm(type: TType, baby: boolean) => boolean
bake(type: TType, baby: boolean) => void

Returns​

boolean


warmableRosterCount​

▸ warmableRosterCount<TType>(types, hasBabies): number

Type parameters​

NameType
TTypeextends string

Parameters​

NameType
typesreadonly TType[]
hasBabiesboolean

Returns​

number


waterCausticWeb​

▸ waterCausticWeb(...args): Node<"float">

A tileable caustic web (after Dave Hoskins' water caustic): bright where an iterated warp's focus lines meet, repeating every three blocks. Shared by the seabed caustics, the surface underside and the client's light shafts, so all show one pattern on one clock. Returns 0..1.

Parameters​

NameType
...args[Vector2 | Node<"vec2">, number | Node<"float"> | Node<"uint">]

Returns​

Node<"float">


weatherHash2​

▸ weatherHash2(...args): Node<"float">

surfaceWeatherHash2 on the CPU: one value per unit cell of p.

Parameters​

NameType
...args[Vector2 | Node<"vec2">]

Returns​

Node<"float">


weatherHash3​

▸ weatherHash3(...args): Node<"float">

surfaceWeatherHash3 on the CPU.

Parameters​

NameType
...args[Vector3 | Node<"vec3">]

Returns​

Node<"float">


weatherNoise​

▸ weatherNoise(...args): Node<"float">

Value noise on the integer lattice (surfaceWeatherNoise).

Parameters​

NameType
...args[Vector2 | Node<"vec2">]

Returns​

Node<"float">


windAt​

▸ windAt(seconds, speed, direction, offset): void

The wind at a moment of the shader clock: its heading, and the distance the sway noise has scrolled. The scroll is the integral of the heading, which has a closed form here, so it is a function of the clock alone and every client scrolls to the same place without accumulating anything. seconds is the unwrapped clock, so the wrap never jolts the wind.

Parameters​

NameType
secondsnumber
speednumber
directionObject
direction.set(x: number, y: number) => unknown
offsetObject
offset.set(x: number, y: number) => unknown

Returns​

void


withBranchRadius​

▸ withBranchRadius(shape, stage, radius): number

stage with its radius bits set to radius, every other bit kept.

Parameters​

NameType
shapeBranchShape
stagenumber
radiusnumber

Returns​

number


worldFogNode​

▸ worldFogNode(u): JoinNode<"vec4">

The world's fog as a scene fog node (Scene.fogNode): every node material in the world that leaves fog on (the default) takes the same sky fog and camera water the chunks wear, after its own shading. Additive materials only fade, adding no fog colour. Materials that apply the fog themselves (chunks, entity pools, the sky) turn fog off.

Parameters​

NameType
uSkyFogInputs

Returns​

JoinNode<"vec4">


worldUniform​

▸ worldUniform<T>(value, type?): ValueUniform<T>

A world-wide uniform. The node is the value's home: node.value is what the CPU writes, exactly as the { value } records it replaces.

Type parameters​

NameType
Textends number | Vector3 | Matrix4 | Matrix3 | Vector2 | Color | Vector4

Parameters​

NameType
valueT
type?"int" | "uint"

Returns​

ValueUniform<T>


wrapShaderSeconds​

▸ wrapShaderSeconds(seconds): number

A clock reading wrapped into [0, SHADER_CLOCK_WRAP_SECONDS).

Parameters​

NameType
secondsnumber

Returns​

number


writeBiomeTint​

▸ writeBiomeTint(target, offset, positions, lights, corners, size, positionUnits?, positionBias?): void

The biome colour of each vertex of one geometry, three bytes a vertex, written into target from offset (a merge writes many geometries into one array). Vertices without the opt-in sign bit, and colour-table faces, are written zero: they keep their stage palette.

Parameters​

NameTypeDefault value
targetUint8Array<ArrayBufferLike>undefined
offsetnumberundefined
positionsFloat32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>undefined
lightsInt32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>undefined
cornersUint8Array<ArrayBufferLike>undefined
sizenumberundefined
positionUnitsnumber1
positionBiasnumber0

Returns​

void


writeChainBones​

▸ writeChainBones(binding, joints, writeBone): void

Parameters​

NameType
bindingChainBinding
jointsreadonly Vector3[]
writeBoneBoneMatrixWriter

Returns​

void


writeInstanceColor​

▸ writeInstanceColor(attribute, index, r, g, b): void

Parameters​

NameType
attributeInstanceAttribute
indexnumber
rnumber
gnumber
bnumber

Returns​

void


writeInstanceMatrix​

▸ writeInstanceMatrix(mesh, index, matrix): void

Parameters​

NameType
meshInstancedMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>
indexnumber
matrixMatrix4

Returns​

void