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.updateShadowUniforms, 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,
}

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.


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-
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


BlockLightTuningFlags​

Ƭ BlockLightTuningFlags: Object

Type declaration​

NameTypeDescription
adaptation?booleanLamplight white balance on (its default amount) or off.
analyticHue?boolean-
bilinear?booleanBilinear voxel light across each quad (false: per triangle).
curve?boolean-
diamond?boolean-
hueRamp?booleanA channel's hue share fades in over its first level (false: snaps on).
kernel?boolean-
proxyEnergy?boolean-
tightKernel?booleanThe tight kernel core (false: the step-7 0.3-range core).
toneMap?boolean-

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.


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"


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.
underwaterFog?booleanWhether this canvas box tints toward the ambient water color while the camera is submerged, matching the underwater look of instanced entities. 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.
idleArmSwing?numberThe speed at which the arms swing when the character is idle. Defaults to 0.06.
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.
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

ChunkMeshEventData​

Ƭ ChunkMeshEventData: Object

Type declaration​

NameType
chunkChunk
coordsCoords2
levelnumber
meshesMesh[]

ChunkMeshUpdateEventData​

Ƭ ChunkMeshUpdateEventData: ChunkMeshEventData & { reason: ChunkUpdateReason }


ChunkRegionArenasOptions​

Ƭ ChunkRegionArenasOptions: Object

Tunables for the per-region BatchedMesh arenas that batch every shared-opaque chunk section into one multi-draw call per region.

Type declaration​

NameTypeDescription
growthFactornumberFactor a full arena's capacity is multiplied by when it grows. Growth re-uploads the region's buffers, so it should be rare: geometric growth bounds the number of growth events logarithmically.
indexPerVertexRationumberIndex capacity per vertex of capacity. Quad geometry uses six indices for every four vertices, hence the 1.5 default.
initialVertexCapacitynumberVertex capacity a region arena is created with. Arenas grow geometrically from here, so this is a floor, not a limit.
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

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" }


ChunkUpdateEventData​

Ƭ ChunkUpdateEventData: ChunkEventData & { reason: ChunkUpdateReason }


ChunkUpdateReason​

Ƭ ChunkUpdateReason: "voxel" | "light"


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.
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].
endFadeFarRationumber-
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.
sunTintnumberExtra brightness given to faces pointing at the sun, as a fraction. Defaults to 0.12.
thresholdnumberThe threshold at which noise values are considered to be "cloudy" and should generate a new cloud block. Defaults to 0.05.
uCameraSubmersion?ShaderUniform<number>-
uCameraWaterPlaneY?ShaderUniform<number>-
uCloudEndFadeFar?ShaderUniform<number>-
uCloudEndFadeNear?ShaderUniform<number>-
uCloudFogDistanceScale?ShaderUniform<number>-
uDirectSunlight?ShaderUniform<number>The share of the sun reaching the world as a beam; 1 when absent.
uFogColor?ShaderUniform<Color>An object that is used as the uniform for the clouds fog color shader.
uFogFar?ShaderUniform<number>An object that is used as the uniform for the clouds fog far shader.
uFogHeightDensity?ShaderUniform<number>-
uFogHeightOrigin?ShaderUniform<number>-
uFogNear?ShaderUniform<number>An object that is used as the uniform for the clouds fog near shader.
uSkyFogBottomColor?ShaderUniform<Color>-
uSkyFogDimension?ShaderUniform<number>-
uSkyFogExponent?ShaderUniform<number>-
uSkyFogExponent2?ShaderUniform<number>-
uSkyFogMiddleColor?ShaderUniform<Color>-
uSkyFogOffset?ShaderUniform<number>-
uSkyFogStrength?ShaderUniform<number>-
uSkyFogTopColor?ShaderUniform<Color>-
uSkyFogVoidOffset?ShaderUniform<number>-
uSunColor?ShaderUniform<Color>-
uSunDirection?ShaderUniform<Vector3>-
uSunlightIntensity?ShaderUniform<number>-
uUnderwaterAmbient?ShaderUniform<Color>-
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.

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

CrustedFluidShader​

Ƭ CrustedFluidShader: Object

Type declaration​

NameType
fragmentShaderstring
uniforms{ uCrustBands: Uniform<Vector4> ; uCrustFaceShades: Uniform<Vector4> ; uCrustFarAnisotropy: Uniform<number> ; uCrustFlow: Uniform<Vector4> ; uCrustLife: Uniform<Vector4> ; uCrustLight: Uniform<Vector4> ; uCrustPalette: Uniform<Color[]> ; uCrustShape: Uniform<Vector4> ; uCrustWave: Uniform<Vector2> ; uCrustZone: Uniform<Vector4> }
uniforms.uCrustBandsUniform<Vector4>
uniforms.uCrustFaceShadesUniform<Vector4>
uniforms.uCrustFarAnisotropyUniform<number>
uniforms.uCrustFlowUniform<Vector4>
uniforms.uCrustLifeUniform<Vector4>
uniforms.uCrustLightUniform<Vector4>
uniforms.uCrustPaletteUniform<Color[]>
uniforms.uCrustShapeUniform<Vector4>
uniforms.uCrustWaveUniform<Vector2>
uniforms.uCrustZoneUniform<Vector4>
vertexShaderstring

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 result plugs into World.customizeMaterialShaders for the fluid block.

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-

CullOptionsType​

Ƭ CullOptionsType: Object

Type declaration​

NameType
dimensionsCoords3
maxCoords3
minCoords3
realMaxCoords3
realMinCoords3

CustomChunkShaderMaterial​

Ƭ CustomChunkShaderMaterial: ShaderMaterial & { map: Texture }

Custom shader material for chunks, simply a ShaderMaterial from ThreeJS with a map texture. Keep in mind that if you want to change its map, you also have to change its uniforms.map.


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
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.

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.
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.

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
rigidBody?EntityRigidBodyMetadata

EntityRigidBodyMetadata​

Ƭ EntityRigidBodyMetadata: Object

Type declaration​

NameType
fluidRationumber
isInFluidboolean

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"


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.
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.
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 keeps the edge hard.
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: Object

Uniforms the far layer shares with the chunk shader, by reference.

Type declaration​

NameTypeDescription
ambientColorShaderUniform<Color>-
baseAmbientShaderUniform<number>-
cameraSubmersionShaderUniform<number>-
cameraWaterPlaneYShaderUniform<number>-
directSunlight?ShaderUniform<number>The share of the sun reaching the world as a beam (the weather's).
faceShadesShaderUniform<{ w: number ; x: number ; y: number ; z: number }>-
farCoverShaderUniform<Vector4>-
farCoverMaskShaderUniform<Texture | null>The chunk shader's side of the seam, written here: the coverage mask, its placement (originCx, originCz, chunkSize, texels) and the seam band's ramp scale (0 while the layer is off).
farSeamShaderUniform<number>-
fogColorShaderUniform<Color>-
fogFarShaderUniform<number>-
fogHeightDensityShaderUniform<number>-
fogHeightOriginShaderUniform<number>-
fogNearShaderUniform<number>-
fogVerticalBlendShaderUniform<number>-
minLightLevelShaderUniform<number>-
skyFogBottomColorShaderUniform<Color>-
skyFogDimensionShaderUniform<number>-
skyFogExponentShaderUniform<number>-
skyFogExponent2ShaderUniform<number>-
skyFogMiddleColorShaderUniform<Color>-
skyFogOffsetShaderUniform<number>-
skyFogStrengthShaderUniform<number>-
skyFogTopColorShaderUniform<Color>-
skyFogVoidOffsetShaderUniform<number>-
skyMiddleColor?ShaderUniform<Color>-
skyTopColor?ShaderUniform<Color>The sky the chunk water mirrors and how strongly it does, so the far sea mirrors the same sky; without them it mirrors none.
sunColorShaderUniform<Color>-
sunDirectionShaderUniform<Vector3>-
sunlightIntensityShaderUniform<number>-
underwaterAmbientShaderUniform<Color>-
underwaterViewScaleShaderUniform<number>-
waterFresnelStrength?ShaderUniform<number>-

FarTerrainStats​

Ƭ FarTerrainStats: Object

Counters a harness can read to prove the budget.

Type declaration​

NameTypeDescription
buildsInFlightnumberBuilds handed to the worker and not back yet.
bytesReceivednumber-
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.
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) in the scene; each is one draw call when in view.
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

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

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


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.

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[]-
pendingDispatchLightJob[]Jobs of this batch that have not been handed to a worker yet. Dispatch serializes every chunk the job's bounding box covers, so jobs wait here as cheap descriptors instead of as multi-megabyte copies.
resultsLightBatchResult[]-
startSequenceIdnumber-
totalJobsnumber-

LightBatchResult​

Ƭ LightBatchResult: Object

Type declaration​

NameType
borderNeighborsLightWorkerBorderNeighbor[]
boundingBoxBoundingBox
colorLightColor
modifiedChunksLightWorkerModifiedChunk[]

LightColor​

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

Sunlight or the color of torch light.


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.

LightConeUniformBinding​

Ƭ LightConeUniformBinding: LightConeUniforms[keyof LightConeUniforms]


LightConeUniforms​

Ƭ LightConeUniforms: Object

Type declaration​

NameTypeDescription
coneColors{ value: Color[] }-
coneColors.valueColor[]-
coneCount{ value: number }-
coneCount.valuenumber-
coneDirections{ value: Vector3[] }-
coneDirections.valueVector3[]-
coneOrigins{ value: Vector4[] }-
coneOrigins.valueVector4[]-
coneScatterStyle{ value: Vector3 }The shared LIGHT_CONE_SCATTER_STYLE object, not a copy.
coneScatterStyle.valueVector3-
coneShapes{ value: Vector4[] }-
coneShapes.valueVector4[]-

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
startSequenceIdnumber

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.
useProxyChangeDetectionbooleanNotice children added under a shined object by wrapping every children array and mesh material in its subtree in a Proxy, the old path, kept only to A/B measure its cost. A Proxy puts a slow path in every scene-graph walk over those nodes (matrix updates, culling, traversals) and in every material read three makes per draw, and a sibling removal re-wrapped the shifted children in nested Proxies. The default listens for three's childadded events instead. 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
appliedDeltas{ lastSequenceId: number }-
appliedDeltas.lastSequenceIdnumber-
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[]-

LocalLightAirlightOptions​

Ƭ LocalLightAirlightOptions: Object

Type declaration​

NameTypeDescription
bandsnumberFlat brightness bands the air glow is cut into, each constant over a 1/16-block texel of the surface behind it (voxel-native: crisp steps, no soft gradient). 0 draws the smooth legacy haze, sky included.
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.

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.


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
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.

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 wrapped with the encoder.
drawnAfterstring[]Blended materials that cannot accumulate and draw over the composite.
lateAdoptedstring[]Materials wrapped after they had compiled: each one compiled again on a frame mid-play, the hitch a warmup is for.
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 / (ε + (d / nearDistance)³ + (d / farDistance)⁶), clamped to [min, max]. A layer twice as far as another weighs an eighth of it out to farDistance, past which the weight falls off faster; 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 }


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.WebGLRenderer) => void

Type declaration​

▸ (deltaTime, renderer): void

Parameters​
NameType
deltaTimenumber
rendererTHREE.WebGLRenderer
Returns​

void


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

ShadowInvalidationCause​

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


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

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

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"

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.

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: WebGLRenderer) => void }


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.
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.

VoxelDelta​

Ƭ VoxelDelta: Object

Type declaration​

NameTypeDescription
coords[number, number, number]-
newRawnumberThe whole packed word after the change: id, rotation, stage and waterlogging. The per-field values above describe what changed; this is what a copy of the chunk must hold afterwards.
newRotation?BlockRotation-
newStage?number-
newVoxelnumber-
oldRotation?BlockRotation-
oldStage?number-
oldVoxelnumber-
sequenceIdnumber-
timestampnumber-

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​

NameType
depthnumber
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.
chunkUniformsOverwritePartial<ChunkRenderer["uniforms"]>The uniforms to overwrite the default chunk material uniforms. 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.
deltaRetentionTimenumberHow long to retain delta history in milliseconds. Defaults to 5000ms.
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 8.
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.
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-
maxMeshesPerUpdatenumber-
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.
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.
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 render the world into a render target with a depth texture, and to call World.prepareTransparency before each frame; a render 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.
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.

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-
voxelDeltaChunksnumber-
voxelDeltaTotalnumber-
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).


AIRLIGHT_UNIFORMS_GLSL​

• Const AIRLIGHT_UNIFORMS_GLSL: "\n#define AIRLIGHT_SLOTS 12\nuniform int uAirCount;\nuniform vec4 uAirPos[AIRLIGHT_SLOTS];\nuniform vec4 uAirColor[AIRLIGHT_SLOTS];\n"

GLSL declarations of the set, shared by its consumers.


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_TRANSFER​

• Const BLOCK_LIGHT_TRANSFER: Readonly<{ adaptation: 0.13 = 0.13; ceilingWeight: 0.6 = 0.6; dominanceKnee: 0.06 = 0.06; gain: 1.6 = 1.6; hueLevels: 12 = 12; kernelCoreRatio: 0.3 = 0.3; kernelGain: 2 = 2.0; legacyDominanceKnee: 0.01 = 0.01; legacyGain: 1.2 = 1.2; mountFar: 2.5 = 2.5; mountNear: 0.5 = 0.5; ratio: 0.84 = 0.84; 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.

Every change sits behind a runtime switch in BLOCK_LIGHT_TUNING, shared as uniforms by the chunk materials and read by the CPU mirrors, so the old and new models can be A/B'd in one session without a recompile.


BLOCK_LIGHT_TRANSFER_GLSL​

• Const BLOCK_LIGHT_TRANSFER_GLSL: string

GLSL twins of the TS functions above; declared before the local lights.


BLOCK_LIGHT_TRANSFER_UNIFORMS_GLSL​

• Const BLOCK_LIGHT_TRANSFER_UNIFORMS_GLSL: "\nuniform float uBlockLightCurve;\nuniform float uBlockLightToneMap;\nuniform float uBlockLightKernel;\nuniform float uBlockLightDiamond;\nuniform float uBlockLightGain;\nuniform float uBlockLightDominanceKnee;\nuniform float uBlockLightKernelCore;\nuniform float uBlockLightKernelGain;\nuniform float uBlockLightAdaptation;\nuniform float uBlockLightCeilingWeight;\nuniform float uBlockLightWarmFloor;\nuniform float uBlockLightHueLevels;\nuniform float uBlockLightMountFade;\nuniform float uBlockLightHueRamp;\nuniform float uBlockLightBilinear;\n"

Uniform declarations for the chunk fragment (bound in chunk-materials).


BLOCK_LIGHT_TUNING​

• Const BLOCK_LIGHT_TUNING: Object

Runtime switches, 1 = the new model. Plain { value } objects so the chunk materials bind them as uniforms directly; derived values (gain, dominanceKnee) follow the switches through setBlockLightTuning.

Type declaration​

NameTypeDescription
adaptation{ value: number }Lamplight white balance, 0 (off) to 1 (block light fully grey).
adaptation.valuenumber-
analyticHue{ value: number = 1 }Step 6 mirror: default analytic colours follow the flood's per-level decay, so a coloured light is the same hue in both models. Read at profile-resolve time; LocalLights.rebuildProfiles applies a change.
analyticHue.valuenumber-
bilinear{ value: number = 1 }1: the voxel light blends bilinearly across each quad (quad-light.ts); 0: per triangle (legacy), which creased along the quad diagonal and cut a light's reach into triangles.
bilinear.valuenumber-
ceilingWeight{ value: number }Share of flood light a down-facing face keeps (1 = legacy).
ceilingWeight.valuenumber-
curve{ value: number = 1 }Step 6: geometric per-level curve, gain, dominance knee, chroma tint.
curve.valuenumber-
diamond{ value: number = 1 }Step 1: masked lights reach zero on their flood's L1 diamond instead of being cut there by the mask.
diamond.valuenumber-
dominanceKnee{ value: number }Derived: dominance knee for the active curve.
dominanceKnee.valuenumber-
gain{ value: number }Derived: torch-light gain for the active curve.
gain.valuenumber-
hueLevels{ value: number }Flood hue: levels for a channel gap to reach 0 (0 = per-channel).
hueLevels.valuenumber-
hueRamp{ value: number = 1 }1: a channel below the peak fades its hue share in over its first flood level, so a coloured light's weaker channels thin out where its flood ends; 0: the share snaps on at any trace of the channel (legacy). Identical at every whole level and for the peak channel; between a lit corner and a dark one the legacy snap drew the patch's edge as a hard line.
hueRamp.valuenumber-
kernel{ value: number = 1 }Step 7: windowed inverse-square analytic kernel.
kernel.valuenumber-
kernelCore{ value: number }Analytic kernel core, as a fraction of a light's range, and its gain (the tight kernel by default; BLOCK_LIGHT_TRANSFER.kernelCoreRatio and .kernelGain are the step-7 shape it replaced).
kernelCore.valuenumber-
kernelGain{ value: number }-
kernelGain.valuenumber-
mountFade{ value: number = 1 }1: a light lights the ceiling it hangs under evenly (0 = legacy).
mountFade.valuenumber-
proxyEnergy{ value: number = 1 }Step 2: an aggregated proxy spreads its members' energy over its wider range instead of peaking where no emitter is. Read when proxies build.
proxyEnergy.valuenumber-
toneMap{ value: number = 1 }Step 6: hue-preserving tone map for block-lit fragments.
toneMap.valuenumber-
warmFloor{ value: number = 1 }1: the darkness floor takes the lamp's warm tint as the lamp dominates a fragment, so a pool of lamp light fades out warm instead of through a pink rim; 0: the legacy cool floor everywhere.
warmFloor.valuenumber-

BLOCK_LIGHT_WARM_TINT​

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

Warm tint for flood light; saturated emitters keep their own hue.


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.


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 (the block after #include <envmap_fragment> in shaders.ts: no shadow, no occlusion, no block light), as the literals both shaders carry. The chunk shader is the source of truth; far-terrain.test.ts reads it and fails when either side changes alone.

Type declaration​

NameTypeDescription
brightTexture{ from: "0.75" = "0.75"; to: "0.95" = "0.95" }smoothstep(0.75, 0.95, texLuma): how bright a texture counts as.
brightTexture.from"0.75"-
brightTexture.to"0.95"-
brightTextureSun"0.7"mix(1.0, 0.7, isBrightTex): the sun a bright texture keeps.
daylightBalance"0.92, 0.95, 1.05"vec3 coolTint = vec3(0.92, 0.95, 1.05): daylight white balance.
groundAmbient"0.4"uAmbientColor * 0.4: the sky ambient a face looking down gets.
starlight"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.0): the wrapped sun.
sunWrap.bias"0.15"-
sunWrap.scale"0.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.a"2.51"-
toneMap.b"0.03"-
toneMap.c"2.43"-
toneMap.d"0.59"-
toneMap.e"0.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_RENDER_QUALITY​

• Const CHUNK_RENDER_QUALITY: Object

Type declaration​

NameType
highResolutionLocalLightsPerCellnumber
highResolutionPixelThresholdnumber

CHUNK_TEXTURE_SAMPLE_GLSL​

• Const CHUNK_TEXTURE_SAMPLE_GLSL: "vec4 sampledDiffuseColor = textureGrad(map, finalUv, finalUvDx, finalUvDy);"

The chunk fragment shader's atlas sample. A consumer injecting code ahead of it (a frame strip remapping finalUv) anchors on this exact line, so import it rather than copying it: the two cannot drift apart.


CHUNK_WATER_FRESNEL​

• Const CHUNK_WATER_FRESNEL: Object

The chunk water's Fresnel on a top face (fresnelBase and fresnelMax in shaders.ts, at topWaterFace 1), as the literals both shaders carry; far-terrain.test.ts fails when either side changes alone.

Type declaration​

NameType
basestring
maxstring

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>


DEFAULT_BLOCK_MAX_STACK​

• Const DEFAULT_BLOCK_MAX_STACK: 64


DEFAULT_METHOD_CONFIRM_TIMEOUT_MS​

• Const DEFAULT_METHOD_CONFIRM_TIMEOUT_MS: 5000


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_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_BOUNDS_VERTEX_FUNCTIONS​

• Const ENTITY_SHADOW_BOUNDS_VERTEX_FUNCTIONS: "\nvec4 entityShadowBoundsToWorld(mat4 toWorld, vec4 localSphere) {\n vec3 center = (toWorld * vec4(localSphere.xyz, 1.0)).xyz;\n float axisScale = sqrt(max(\n dot(toWorld[0].xyz, toWorld[0].xyz),\n max(dot(toWorld[1].xyz, toWorld[1].xyz), dot(toWorld[2].xyz, toWorld[2].xyz))\n ));\n return vec4(center, localSphere.w * axisScale);\n}\n"

Vertex-stage GLSL for self bounds that ride a transform instead of a uniform: entityShadowBoundsToWorld(toWorld, localSphere) carries a sphere (centre, radius) through toWorld, scaling the radius by its largest axis. An instanced pool passes its instance matrix and the drawn geometry's own sphere, so every instance is bounded by its own body; the fragment stage hands the result to getEntityShadowWithin.


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_FRAGMENT_PARS​

• Const ENTITY_SHADOW_FRAGMENT_PARS: "\nuniform sampler2D uShadowMap0;\nuniform sampler2D uShadowMap1;\nuniform sampler2D uShadowMap2;\nuniform float uCascadeSplit0;\nuniform float uCascadeSplit1;\nuniform float uCascadeSplit2;\nuniform float uShadowBias;\nuniform float uShadowNormalBias;\nuniform float uShadowStrength;\nuniform float uSunlightIntensity;\nuniform vec3 uSunDirection;\nuniform vec3 uSunColor;\nuniform float uMinOccluderDepth;\nuniform vec4 uShadowSelfBounds;\nuniform float uShadowIgnoresSelf;\nuniform float uShadowDepthPerBlock;\n\nvarying vec4 vShadowCoord0;\nvarying vec4 vShadowCoord1;\nvarying vec4 vShadowCoord2;\nvarying float vViewDepth;\n\n\nconst vec2 SHADOW_POISSON_DISK[8] = vec2[8](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(0.97484398, 0.75648379),\n vec2(0.44323325, -0.97511554)\n);\n\n\n\nfloat shadowMapEdgeFade(vec3 coord) {\n float fadeWidth = 0.08;\n float fx = smoothstep(0.0, fadeWidth, coord.x) * smoothstep(0.0, fadeWidth, 1.0 - coord.x);\n float fy = smoothstep(0.0, fadeWidth, coord.y) * smoothstep(0.0, fadeWidth, 1.0 - coord.y);\n return fx * fy;\n}\n\nfloat sampleShadowMapFast(sampler2D shadowMap, vec4 shadowCoord, float bias) {\n vec3 coord = shadowCoord.xyz / shadowCoord.w;\n coord = coord * 0.5 + 0.5;\n\n if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0 || coord.z < 0.0 || coord.z > 1.0) {\n return 1.0;\n }\n\n vec2 texelSize = vec2(1.0) / vec2(textureSize(shadowMap, 0));\n\n float shadow = (coord.z - bias > texture(shadowMap, coord.xy).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(-1.0, -1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(1.0, -1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(-1.0, 1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(1.0, 1.0)).r) ? 0.0 : 1.0;\n\n shadow /= 5.0;\n return mix(1.0, shadow, shadowMapEdgeFade(coord));\n}\n\nfloat sampleShadowMapPCSS(sampler2D shadowMap, vec4 shadowCoord, float bias) {\n vec3 coord = shadowCoord.xyz / shadowCoord.w;\n coord = coord * 0.5 + 0.5;\n\n if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0 || coord.z < 0.0 || coord.z > 1.0) {\n return 1.0;\n }\n\n vec2 texelSize = vec2(1.0) / vec2(textureSize(shadowMap, 0));\n\n float blockerSum = 0.0;\n float blockerCount = 0.0;\n float searchRadius = 3.0;\n for (int i = 0; i < 4; i++) {\n vec2 offset = SHADOW_POISSON_DISK[i * 2] * texelSize * searchRadius;\n float sampleDepth = texture(shadowMap, coord.xy + offset).r;\n float blockerDiff = coord.z - sampleDepth;\n if (blockerDiff > bias && blockerDiff >= uMinOccluderDepth) {\n blockerSum += sampleDepth;\n blockerCount += 1.0;\n }\n }\n\n if (blockerCount < 0.5) {\n return 1.0;\n }\n\n float avgBlockerDepth = blockerSum / blockerCount;\n float penumbraSize = (coord.z - avgBlockerDepth) / avgBlockerDepth;\n float filterRadius = clamp(penumbraSize * 2.0, 1.0, 3.0);\n\n float spatialNoise = fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453);\n float angle = spatialNoise * 6.283185;\n float s = sin(angle);\n float c = cos(angle);\n mat2 rotation = mat2(c, -s, s, c);\n\n float centerDepth = texture(shadowMap, coord.xy).r;\n float centerDiff = coord.z - centerDepth;\n float shadow = (centerDiff > bias && centerDiff >= uMinOccluderDepth) ? 0.0 : 1.0;\n for (int i = 0; i < 8; i++) {\n vec2 offset = rotation * SHADOW_POISSON_DISK[i] * texelSize * filterRadius;\n float depth = texture(shadowMap, coord.xy + offset).r;\n float depthDiff = coord.z - depth;\n shadow += (depthDiff > bias && depthDiff >= uMinOccluderDepth) ? 0.0 : 1.0;\n }\n\n shadow /= 9.0;\n return mix(1.0, shadow, shadowMapEdgeFade(coord));\n}\n\n\nfloat entityShadowWithBias(float bias) {\n float effectiveStrength = uShadowStrength * uSunlightIntensity;\n \n if (effectiveStrength < 0.01) {\n return 1.0;\n }\n\n float rawShadow = sampleShadowMapPCSS(uShadowMap0, vShadowCoord0, bias);\n\n float maxEntityDist = uCascadeSplit1;\n if (vViewDepth > maxEntityDist) {\n return 1.0;\n }\n float fadeStart = maxEntityDist * 0.7;\n if (vViewDepth > fadeStart) {\n float t = (vViewDepth - fadeStart) / (maxEntityDist - fadeStart);\n rawShadow = mix(rawShadow, 1.0, t);\n }\n\n float shadow = mix(1.0, rawShadow, effectiveStrength * 0.65);\n return max(shadow, 0.6);\n}\n\nfloat getEntityShadow(vec3 worldNormal) {\n float cosTheta = clamp(dot(worldNormal, uSunDirection), 0.0, 1.0);\n return entityShadowWithBias(uShadowBias + uShadowNormalBias * (1.0 - cosTheta));\n}\n\n// Shadow-map depth from worldPosition, toward the sun, to where the ray\n// leaves selfBounds, the body's own bounding sphere in world space (centre,\n// radius). Unbounded for radius 0, or for a point outside the sphere\n// (bounds that do not describe this surface).\nfloat entityShadowSelfDepthWithin(vec3 worldPosition, vec4 selfBounds) {\n float radius = selfBounds.w;\n vec3 offset = worldPosition - selfBounds.xyz;\n float inside = dot(offset, offset) - radius * radius;\n if (radius <= 0.0 || inside > 0.0) {\n return 1e9;\n }\n float along = dot(offset, uSunDirection);\n float exitDistance = -along + sqrt(along * along - inside);\n return exitDistance * uShadowDepthPerBlock;\n}\n\nfloat entityShadowSelfDepth(vec3 worldPosition) {\n return entityShadowSelfDepthWithin(worldPosition, uShadowSelfBounds);\n}\n\n// getEntityShadow for a body that knows its own bounds: the slope-scaled\n// bias that keeps a sun-averted face out of its own body's shadow never\n// reaches past those bounds, so whatever lies beyond them (a deck, a\n// canopy, another body) still shades every face. For bounds that differ per\n// draw or per instance (see ENTITY_SHADOW_BOUNDS_VERTEX_FUNCTIONS).\n// With uShadowIgnoresSelf, nothing inside the bounds shades any face.\nfloat getEntityShadowWithin(\n vec3 worldNormal,\n vec3 worldPosition,\n vec4 selfBounds\n) {\n float cosTheta = clamp(dot(worldNormal, uSunDirection), 0.0, 1.0);\n float slopeBias = uShadowNormalBias * (1.0 - cosTheta);\n float selfDepth = entityShadowSelfDepthWithin(worldPosition, selfBounds);\n float selfBias = uShadowIgnoresSelf > 0.5\n ? (selfDepth < 1e8 ? selfDepth : 0.0)\n : min(slopeBias, selfDepth);\n return entityShadowWithBias(uShadowBias + selfBias);\n}\n\n// getEntityShadowWithin, bounded by uShadowSelfBounds.\nfloat getEntityShadowAt(vec3 worldNormal, vec3 worldPosition) {\n return getEntityShadowWithin(worldNormal, worldPosition, uShadowSelfBounds);\n}\n"


ENTITY_SHADOW_VERTEX_MAIN​

• Const ENTITY_SHADOW_VERTEX_MAIN: "\nvec4 shadowWorldPos = vec4(\n (uShadowWorldMatrix * vec4(worldPosition.xyz, 1.0)).xyz + uWorldOffset,\n 1.0\n);\nvShadowCoord0 = uShadowMatrix0 * shadowWorldPos;\nvShadowCoord1 = uShadowMatrix1 * shadowWorldPos;\nvShadowCoord2 = uShadowMatrix2 * shadowWorldPos;\nvec4 viewPos = viewMatrix * vec4(worldPosition.xyz, 1.0);\nvViewDepth = -viewPos.z;\n"


ENTITY_SHADOW_VERTEX_PARS​

• Const ENTITY_SHADOW_VERTEX_PARS: "\nuniform mat4 uShadowMatrix0;\nuniform mat4 uShadowMatrix1;\nuniform mat4 uShadowMatrix2;\nuniform vec3 uWorldOffset;\nuniform mat4 uShadowWorldMatrix;\n\nvarying vec4 vShadowCoord0;\nvarying vec4 vShadowCoord1;\nvarying vec4 vShadowCoord2;\nvarying float vViewDepth;\n"


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 (shaders.ts) is generated from this table, 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.


INVALID_LIGHT_HANDLE​

• Const INVALID_LIGHT_HANDLE: LightHandle = 0


INVALID_LOCAL_LIGHT_HANDLE​

• Const INVALID_LOCAL_LIGHT_HANDLE: number = INVALID_LIGHT_HANDLE


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: 4 = 4; 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_CONES_FUNCTIONS​

• Const LIGHT_CONES_FUNCTIONS: string

Shared per-cone response: quadratic angular falloff between the inner and outer cone, squared-quadratic distance falloff to zero at range, and Beer-Lambert extinction from the cone origin scaled by the origin's submersion so underwater beams die out physically while dry beams carry.

uConeOrigins[i] = (origin.xyz, submersion); uConeShapes[i] = (cosOuter, 1/(cosInner-cosOuter), range, scatterStrength).


LIGHT_CONES_SCATTER_FRAGMENT​

• Const LIGHT_CONES_SCATTER_FRAGMENT: "\nif (uConeCount > 0) {\n vec3 lcViewRay = vWorldPosition.xyz - cameraPosition;\n float lcViewDist = max(length(lcViewRay), 1e-4);\n gl_FragColor.rgb += lightConeScatter(cameraPosition, lcViewRay / lcViewDist, lcViewDist);\n}\n"

Adds the in-scattered beam glow after fog. Expects vWorldPosition, cameraPosition, and gl_FragColor in scope. Scatter strength is the game's per-cone knob: this is how a beam is seen in air — real spotlights are invisible between lens and surface unless the air itself scatters some light toward the eye (dust, haze), which this term estimates. Submersion additionally applies water extinction along the path, so underwater beams glow stronger and die short; the scatter style's ceiling keeps that glow from whiting out.


LIGHT_CONES_UNIFORM_DECLARATIONS​

• Const LIGHT_CONES_UNIFORM_DECLARATIONS: string


LIGHT_CONE_SCATTER_STYLE​

• Const LIGHT_CONE_SCATTER_STYLE: Object

Live A/B switch for the scattered beam's look, shared by every material that binds any LightCones.uniformBindings (one object, so a flip reaches chunks and entity materials alike on the next draw): (texelsPerBlock, bands, ceiling). Any component at 0 turns that step off; .set(0, 0, 0) is the original smooth, uncapped beam.

Type declaration​

NameType
valueVector3

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.


LOCAL_LIGHTS_DEBUG_FUNCTIONS​

• Const LOCAL_LIGHTS_DEBUG_FUNCTIONS: "\n\nfloat localShadowDebugProbe(int llRec, vec3 llPos, vec3 llNormal) {\n vec4 llT4 = texelFetch(uLightData, ivec2(4, llRec), 0);\n int llSlot = int(floor(llT4.x + 0.5));\n if (llSlot < 0) return 1.0;\n vec4 llT5 = texelFetch(uLightData, ivec2(5, llRec), 0);\n vec3 llLightPos = texelFetch(uLightData, ivec2(0, llRec), 0).xyz;\n // Same slope-scaled normal offset as the real sampler, or grazing floors\n // stripe with acne in the debug view.\n vec3 llToL = normalize(llLightPos - llPos);\n float llNdl = clamp(dot(llNormal, llToL), 0.0, 1.0);\n float llSlope = clamp(sqrt(1.0 - llNdl * llNdl) / max(llNdl, 0.05), 0.0, 8.0);\n float llTexelWorld =\n (2.0 * llT5.y * max(length(llPos - llLightPos), llT4.w)) / uLocalShadowParams.y;\n vec3 llRel = llPos\n + llNormal * (uLocalShadowParams.w * llTexelWorld * (1.0 + llSlope))\n - llLightPos;\n vec3 llA = abs(llRel);\n int llFace;\n float llW;\n vec2 llUv;\n if (llA.x >= llA.y && llA.x >= llA.z) {\n llFace = llRel.x > 0.0 ? 0 : 1;\n llW = llA.x;\n llUv = vec2(llRel.x > 0.0 ? llRel.z : -llRel.z, llRel.y);\n } else if (llA.y >= llA.z) {\n llFace = llRel.y > 0.0 ? 2 : 3;\n llW = llA.y;\n llUv = vec2(llRel.y > 0.0 ? llRel.x : -llRel.x, llRel.z);\n } else {\n llFace = llRel.z > 0.0 ? 4 : 5;\n llW = llA.z;\n llUv = vec2(llRel.z > 0.0 ? -llRel.x : llRel.x, llRel.y);\n }\n if (llW <= llT4.w) return 1.0;\n if ((int(llT4.y + 0.5) & (1 << llFace)) == 0) return 1.0;\n vec2 llFaceUv = clamp((llUv / (llW * llT5.y)) * 0.5 + 0.5, 0.02, 0.98);\n float llPerRow = floor(uLocalShadowParams.x / uLocalShadowParams.y + 0.5);\n int llCell = llSlot * 12 + llFace;\n vec2 llBaseUv = (vec2(\n mod(float(llCell), llPerRow), floor(float(llCell) / llPerRow)\n ) + llFaceUv) * uLocalShadowParams.y / uLocalShadowParams.x;\n float llZn = texture(uLocalShadowAtlas, llBaseUv).r * 2.0 - 1.0;\n float llStored = (2.0 * llT5.x * llT4.w)\n / (llT5.x + llT4.w - llZn * (llT5.x - llT4.w));\n float llBias = uLocalShadowParams.z + llTexelWorld * (0.75 + llSlope);\n return (llW - llBias > llStored) ? 0.0 : 1.0;\n}\n\n\nvec3 localLightDebugColor(\n vec3 llPos, vec3 llBase, vec3 llNormal, vec3 llFlood, vec3 llCluster, float llRemainder\n) {\n if (uLocalLightDebugMode < 0.5) return llBase;\n if (uLocalLightDebugMode > 5.5) {\n // Mode 6: flood-ownership remainder — white where the legacy flood term\n // still renders, black where the analytic layer owns the fragment.\n return vec3(llRemainder);\n }\n int llCell = localLightCell(llPos);\n if (uLocalLightDebugMode < 1.5) {\n // Cell occupancy heatmap: black 0, green 1-2, yellow 3-5, red 6+.\n if (llCell < 0) return llBase * 0.2;\n int llCount = 0;\n float llCountWeight;\n for (int s = 0; s < 8; s++) {\n if (localLightSlot(llCell, s, llCountWeight) == 0) break;\n llCount++;\n }\n vec3 llRamp = llCount == 0\n ? vec3(0.05)\n : llCount <= 2\n ? vec3(0.1, 0.8, 0.2)\n : llCount <= 5\n ? vec3(0.9, 0.8, 0.1)\n : vec3(0.9, 0.15, 0.1);\n return mix(llBase, llRamp, 0.75);\n }\n if (uLocalLightDebugMode < 2.5) {\n // Isolated clustered contribution (the main pass already computed it).\n return llCluster;\n }\n if (uLocalLightDebugMode < 3.5) {\n // Flood leak mask the masked lights multiply by.\n return vec3(smoothstep(0.0, uLocalMaskKnee, max(max(llFlood.r, llFlood.g), llFlood.b)));\n }\n // Modes 4 and 5 share one walk over the cell's shadowed lights, probing\n // each one's cached static map once.\n if (llCell < 0) return uLocalLightDebugMode < 4.5 ? llBase * 0.2 : vec3(1.0);\n vec3 llTint = llBase * 0.15;\n float llVisAll = 1.0;\n float llDebugWeight;\n for (int s = 0; s < 8; s++) {\n int llRec = localLightSlot(llCell, s, llDebugWeight);\n if (llRec == 0) break;\n llRec -= 1;\n vec4 llT1d = texelFetch(uLightData, ivec2(1, llRec), 0);\n int llFlagsD = int(llT1d.w + 0.5);\n if ((llFlagsD & 4) == 0) continue;\n vec4 llT0d = texelFetch(uLightData, ivec2(0, llRec), 0);\n vec3 llToLd = llT0d.xyz - llPos;\n if (dot(llToLd, llToLd) >= llT0d.w * llT0d.w) continue;\n float llVisD = localShadowDebugProbe(llRec, llPos, llNormal);\n llVisAll *= llVisD;\n vec4 llT4d = texelFetch(uLightData, ivec2(4, llRec), 0);\n int llSlotD = int(floor(llT4d.x + 0.5));\n vec3 llSlotColor = llSlotD == 0 ? vec3(1.0, 0.3, 0.2)\n : llSlotD == 1 ? vec3(0.2, 1.0, 0.3)\n : llSlotD == 2 ? vec3(0.25, 0.4, 1.0)\n : vec3(1.0, 0.9, 0.2);\n llTint += llSlotColor * (0.2 + 0.8 * llVisD) * 0.6;\n }\n return uLocalLightDebugMode < 4.5 ? llTint : vec3(llVisAll);\n}\n"


LOCAL_LIGHTS_FUNCTIONS​

• Const LOCAL_LIGHTS_FUNCTIONS: string

The clustered local light response. localLightCell resolves a world position to its grid cell (or -1 outside the window); the surface and specular functions walk the cell's fixed slot list, breaking at the first empty slot, so an empty world costs one integer compare per fragment.

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 (a static shadow holder carries masked and shadowed: the diffuse ladder prefers its atlas, while the fluid specular pass occludes by the mask so the atlas sampler stays inlined exactly once) t2 = spot [dir.xyz, cosOuter] / capsule [end offset.xyz, 0] t3 = [flickerSpeed, flickerAmplitude, flickerPhase, spotInvCosDelta] t4 = [shadow slot (-1 none), static face mask, dynamic face mask, near] t5 = [far, guard tanHalf, shadow fade weight, 0]

Grid slots (R16UI): data row + 1 in the low byte (0 ends the cell's list), the slot's fade weight in the high byte — a light fading into or out of a cell scales both its light and its flood claim by it.

Shadow lookup mirrors the camera construction in shadow-atlas.ts (face bases, guard FOV, GL perspective depth); change neither side alone. Depth compares run in linear light-space distance so bias is a world unit, not a resolution- and range-dependent NDC fudge.


LOCAL_LIGHTS_UNIFORM_DECLARATIONS​

• Const LOCAL_LIGHTS_UNIFORM_DECLARATIONS: "\nuniform highp usampler2D uLightGrid;\nuniform sampler2D uLightData;\nuniform vec3 uLightGridOrigin;\nuniform vec3 uLightGridDims;\nuniform float uLightGridCellSize;\n// The window origin's cell mod the dims: its storage cell, per axis.\nuniform vec3 uLightGridStorageOffset;\n// Window centre (xyz, moves every frame) and rim fade width in blocks (w).\nuniform vec4 uLightGridCenter;\n// Half extent the window covers around its centre on every frame.\nuniform vec3 uLightGridHalf;\n// 1: temporally stable layer; 0: the legacy frame (A/B captures).\nuniform float uLocalLightStable;\nuniform int uClusteredLightCount;\nuniform float uLocalMaskKnee;\nuniform float uLocalSpecularStrength;\n// 0..1: how strongly analytic claims suppress the baked flood term.\nuniform float uLocalOwnership;\nuniform float uLocalLightDebugMode;\nuniform sampler2D uLocalShadowAtlas;\n// [atlas px, cell px, linear depth bias (blocks), normal bias (texels)]\nuniform vec4 uLocalShadowParams;\n// [pcf radius (texels), shadow strength, unused, unused]\nuniform vec4 uLocalShadowParams2;\n\n#define AIRLIGHT_SLOTS 12\nuniform int uAirCount;\nuniform vec4 uAirPos[AIRLIGHT_SLOTS];\nuniform vec4 uAirColor[AIRLIGHT_SLOTS];\n\nuniform float uRoomFillStrength;\nuniform float uRoomFillRangeScale;\nuniform float uRoomFillCoreScale;\n// 1: fill only where the fragment's own flood reaches (walls stop it); 0:\n// unmasked, reaching past the flood and through walls.\nuniform float uRoomFillFloodMask;\n"


MAX_CLUSTERED_LIGHTS​

• Const MAX_CLUSTERED_LIGHTS: 255

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


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.


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.


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.


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.


QUAD_LIGHT_VERTEX_GLSL​

• Const QUAD_LIGHT_VERTEX_GLSL: string

Vertex-stage GLSL: decodes the lightTwist attribute into the two varyings the fragment stage multiplies. vLightTwist is in the same 0..1 units as vLight.


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.


SHADER_LIGHTING_CHUNK_SHADERS​

• Const SHADER_LIGHTING_CHUNK_SHADERS: Object

Type declaration​

NameType
fragmentstring
vertexstring

SHADER_LIGHTING_CROSS_CHUNK_SHADERS​

• Const SHADER_LIGHTING_CROSS_CHUNK_SHADERS: Object

Type declaration​

NameType
fragmentstring
vertexstring

SHADER_LIGHTING_FLUID_CHUNK_SHADERS​

• Const SHADER_LIGHTING_FLUID_CHUNK_SHADERS: Object

Type declaration​

NameType
fragmentstring
vertexstring

SHADER_LIGHTING_SEE_THROUGH_CHUNK_SHADERS​

• Const SHADER_LIGHTING_SEE_THROUGH_CHUNK_SHADERS: Object

Type declaration​

NameType
fragmentstring
vertexstring

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][]


SHADOW_POISSON_DISK​

• Const SHADOW_POISSON_DISK: "\nconst vec2 SHADOW_POISSON_DISK[8] = vec2[8](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(0.97484398, 0.75648379),\n vec2(0.44323325, -0.97511554)\n);\n"


SHADOW_SAMPLE_FUNCTIONS​

• Const SHADOW_SAMPLE_FUNCTIONS: "\nfloat shadowMapEdgeFade(vec3 coord) {\n float fadeWidth = 0.08;\n float fx = smoothstep(0.0, fadeWidth, coord.x) * smoothstep(0.0, fadeWidth, 1.0 - coord.x);\n float fy = smoothstep(0.0, fadeWidth, coord.y) * smoothstep(0.0, fadeWidth, 1.0 - coord.y);\n return fx * fy;\n}\n\nfloat sampleShadowMapFast(sampler2D shadowMap, vec4 shadowCoord, float bias) {\n vec3 coord = shadowCoord.xyz / shadowCoord.w;\n coord = coord * 0.5 + 0.5;\n\n if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0 || coord.z < 0.0 || coord.z > 1.0) {\n return 1.0;\n }\n\n vec2 texelSize = vec2(1.0) / vec2(textureSize(shadowMap, 0));\n\n float shadow = (coord.z - bias > texture(shadowMap, coord.xy).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(-1.0, -1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(1.0, -1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(-1.0, 1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(1.0, 1.0)).r) ? 0.0 : 1.0;\n\n shadow /= 5.0;\n return mix(1.0, shadow, shadowMapEdgeFade(coord));\n}\n\nfloat sampleShadowMapPCSS(sampler2D shadowMap, vec4 shadowCoord, float bias) {\n vec3 coord = shadowCoord.xyz / shadowCoord.w;\n coord = coord * 0.5 + 0.5;\n\n if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0 || coord.z < 0.0 || coord.z > 1.0) {\n return 1.0;\n }\n\n vec2 texelSize = vec2(1.0) / vec2(textureSize(shadowMap, 0));\n\n float blockerSum = 0.0;\n float blockerCount = 0.0;\n float searchRadius = 3.0;\n for (int i = 0; i < 4; i++) {\n vec2 offset = SHADOW_POISSON_DISK[i * 2] * texelSize * searchRadius;\n float sampleDepth = texture(shadowMap, coord.xy + offset).r;\n float blockerDiff = coord.z - sampleDepth;\n if (blockerDiff > bias && blockerDiff >= uMinOccluderDepth) {\n blockerSum += sampleDepth;\n blockerCount += 1.0;\n }\n }\n\n if (blockerCount < 0.5) {\n return 1.0;\n }\n\n float avgBlockerDepth = blockerSum / blockerCount;\n float penumbraSize = (coord.z - avgBlockerDepth) / avgBlockerDepth;\n float filterRadius = clamp(penumbraSize * 2.0, 1.0, 3.0);\n\n float spatialNoise = fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453);\n float angle = spatialNoise * 6.283185;\n float s = sin(angle);\n float c = cos(angle);\n mat2 rotation = mat2(c, -s, s, c);\n\n float centerDepth = texture(shadowMap, coord.xy).r;\n float centerDiff = coord.z - centerDepth;\n float shadow = (centerDiff > bias && centerDiff >= uMinOccluderDepth) ? 0.0 : 1.0;\n for (int i = 0; i < 8; i++) {\n vec2 offset = rotation * SHADOW_POISSON_DISK[i] * texelSize * filterRadius;\n float depth = texture(shadowMap, coord.xy + offset).r;\n float depthDiff = coord.z - depth;\n shadow += (depthDiff > bias && depthDiff >= uMinOccluderDepth) ? 0.0 : 1.0;\n }\n\n shadow /= 9.0;\n return mix(1.0, shadow, shadowMapEdgeFade(coord));\n}\n"


SHARED_CHUNK_MATERIAL_KEYS​

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

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"


SKY_FOG_COMMON_UNIFORM_DECLARATIONS​

• Const SKY_FOG_COMMON_UNIFORM_DECLARATIONS: "\nuniform vec3 uFogColor;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform float uFogHeightOrigin;\nuniform float uFogHeightDensity;\nuniform vec3 uSkyFogTopColor;\nuniform vec3 uSkyFogMiddleColor;\nuniform vec3 uSkyFogBottomColor;\nuniform float uSkyFogOffset;\nuniform float uSkyFogVoidOffset;\nuniform float uSkyFogExponent;\nuniform float uSkyFogExponent2;\nuniform float uSkyFogDimension;\nuniform float uSkyFogStrength;\nuniform float uChunkReveal;\n// 0 outdoors (fog by horizontal distance), rising to 1 under deep cover so a\n// tall cave ceiling hazes with its true distance like the walls do.\nuniform float uFogVerticalBlend;\n// The share of the sun reaching the world as a beam (directSunlight in\n// chunk-renderer.ts): glints, caustics, the sun's glitter through a water\n// surface and the sun's halo in the haze scale by it; diffuse daylight does\n// not.\nuniform float uDirectSunlight;\n\nuniform float uCameraSubmersion;\nuniform float uCameraWaterPlaneY;\nuniform vec3 uUnderwaterAmbient;\nuniform float uUnderwaterViewScale;\n\n"

Sky-fog uniforms minus the sun trio, for shaders whose lighting chunk already declares uSunDirection, uSunColor, and uSunlightIntensity (e.g. entity materials composing this alongside their shadow chunk).


SKY_FOG_FRAGMENT​

• Const SKY_FOG_FRAGMENT: string


SKY_FOG_SUN_UNIFORM_DECLARATIONS​

• Const SKY_FOG_SUN_UNIFORM_DECLARATIONS: "\nuniform vec3 uSunDirection;\nuniform vec3 uSunColor;\nuniform float uSunlightIntensity;\n"


SKY_FOG_UNIFORM_DECLARATIONS​

• Const SKY_FOG_UNIFORM_DECLARATIONS: "\n\nuniform vec3 uFogColor;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform float uFogHeightOrigin;\nuniform float uFogHeightDensity;\nuniform vec3 uSkyFogTopColor;\nuniform vec3 uSkyFogMiddleColor;\nuniform vec3 uSkyFogBottomColor;\nuniform float uSkyFogOffset;\nuniform float uSkyFogVoidOffset;\nuniform float uSkyFogExponent;\nuniform float uSkyFogExponent2;\nuniform float uSkyFogDimension;\nuniform float uSkyFogStrength;\nuniform float uChunkReveal;\n// 0 outdoors (fog by horizontal distance), rising to 1 under deep cover so a\n// tall cave ceiling hazes with its true distance like the walls do.\nuniform float uFogVerticalBlend;\n// The share of the sun reaching the world as a beam (directSunlight in\n// chunk-renderer.ts): glints, caustics, the sun's glitter through a water\n// surface and the sun's halo in the haze scale by it; diffuse daylight does\n// not.\nuniform float uDirectSunlight;\n\nuniform float uCameraSubmersion;\nuniform float uCameraWaterPlaneY;\nuniform vec3 uUnderwaterAmbient;\nuniform float uUnderwaterViewScale;\n\n\n\nuniform vec3 uSunDirection;\nuniform vec3 uSunColor;\nuniform float uSunlightIntensity;\n\n"


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.


TORCH_GAIN​

• Const TORCH_GAIN: 1.2

Legacy vec3 torchLight = smoothTorch * 1.2; the live gain follows BLOCK_LIGHT_TUNING (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


UNDERSIDE_CRITICAL_COS​

• Const UNDERSIDE_CRITICAL_COS: number

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


UNDERWATER_FOG_FRAGMENT​

• Const UNDERWATER_FOG_FRAGMENT: string


UNDERWATER_FOG_UNIFORM_DECLARATIONS​

• Const UNDERWATER_FOG_UNIFORM_DECLARATIONS: "\nuniform float uCameraSubmersion;\nuniform float uCameraWaterPlaneY;\nuniform vec3 uUnderwaterAmbient;\nuniform float uUnderwaterViewScale;\n"


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.


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_NATIVE_CHUNK_NAME​

• Const VOXEL_NATIVE_CHUNK_NAME: "voxel_native"

The include name installVoxelNativeShaderChunk registers.


VOXEL_NATIVE_GLSL​

• Const VOXEL_NATIVE_GLSL: "\nfloat snapToTexel(float p, float texelsPerUnit) {\n return (floor(p * texelsPerUnit) + 0.5) / texelsPerUnit;\n}\nvec2 snapToTexel(vec2 p, float texelsPerUnit) {\n return (floor(p * texelsPerUnit) + 0.5) / texelsPerUnit;\n}\nvec3 snapToTexel(vec3 p, float texelsPerUnit) {\n return (floor(p * texelsPerUnit) + 0.5) / texelsPerUnit;\n}\nfloat band(float x, float steps) {\n float levels = max(steps, 1.0);\n float level = min(floor(clamp(x, 0.0, 1.0) * levels), levels - 1.0);\n return level / max(levels - 1.0, 1.0);\n}\nfloat stepTime(float t, float framesPerSecond) {\n return floor(t * framesPerSecond) / framesPerSecond;\n}\n"

  • snapToTexel(p, texelsPerUnit): the centre of the texel p falls in, on a grid of texelsPerUnit texels per world unit (16 is the block grain). Overloaded for float, vec2 and vec3.
  • band(x, steps): x clamped to 0..1 and quantised to steps flat levels, 0 and 1 included (steps 2 is a hard threshold at one half).
  • stepTime(t, framesPerSecond): a clock that holds each frame, for flip-book animation instead of continuous motion.

VOXEL_NEIGHBORS​

• Const VOXEL_NEIGHBORS: number[][]


WATER_CAUSTIC_WEB_GLSL​

• Const WATER_CAUSTIC_WEB_GLSL: "\nfloat waterCausticWeb(vec2 cwPos, float cwSeconds) {\n vec2 cwP = mod(cwPos * (6.28318 / 3.0), 6.28318) - 250.0;\n vec2 cwI = cwP;\n float cwSum = 1.0;\n for (int cwN = 0; cwN < 4; cwN++) {\n float cwT = cwSeconds * 0.45 * (1.0 - 3.5 / float(cwN + 1));\n cwI = cwP + vec2(\n cos(cwT - cwI.x) + sin(cwT + cwI.y),\n sin(cwT - cwI.y) + cos(cwT + cwI.x)\n );\n cwSum += 1.0 / length(vec2(\n cwP.x / (sin(cwI.x + cwT) / 0.005),\n cwP.y / (cos(cwI.y + cwT) / 0.005)\n ));\n }\n cwSum = 1.17 - pow(cwSum / 4.0, 1.4);\n return clamp(pow(abs(cwSum), 8.0), 0.0, 1.0);\n}\n"

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 three show one pattern on one clock. Returns 0..1.


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 (uWaterDepthSide, see WaterDepthPass): nothing, keep only what lies behind the nearest water face, or only what lies in front of it. A material without the uniform reads 0, so 0 is the side that changes nothing.


WATER_DEPTH_UNKNOWN​

• Const WATER_DEPTH_UNKNOWN: 0

What the water's depth holds for a render (uWaterDepthState): 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_DOWNWELLING_EXTINCTION_GLSL​

• Const WATER_DOWNWELLING_EXTINCTION_GLSL: string


WATER_OPTICS​

• Const WATER_OPTICS: Readonly<{ aboveSurfaceScatterDepthScale: 0.3 = 0.3; airSideFaceAlphaScale: 0.42 = 0.42; airSideFaceGlossScale: 0 = 0.0; airSideFaceTintMix: 0.85 = 0.85; baseWaveFadeEndBlocks: 256 = 256; baseWaveFadeStartBlocks: 144 = 144; bedCausticDepthFalloff: 0.08 = 0.08; bedCausticStrength: 2.4 = 2.4; 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; 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; 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_SURFACE_NORMAL_LAYERS_GLSL​

• Const WATER_SURFACE_NORMAL_LAYERS_GLSL: string


WATER_SURFACE_SCATTER_COLOR​

• Const WATER_SURFACE_SCATTER_COLOR: Color


WATER_SURFACE_SCATTER_GLSL​

• Const WATER_SURFACE_SCATTER_GLSL: string


WATER_VIEW_EXTINCTION​

• Const WATER_VIEW_EXTINCTION: WaterChannelCoefficients


WATER_VIEW_EXTINCTION_GLSL​

• Const WATER_VIEW_EXTINCTION_GLSL: string


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

Type declaration​

NameType
sway(options: Partial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }>) => { fragmentShader: string = baseShaders.fragment; vertexShader: string }
swayCross(options: Partial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }>) => { fragmentShader: string = baseShaders.fragment; vertexShader: string }

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


defaultHeadOptions​

• Const defaultHeadOptions: HeadOptions


defaultLegsOptions​

• Const defaultLegsOptions: LegOptions


defaultLocalLightsOptions​

• Const defaultLocalLightsOptions: LocalLightsOptions


defaultMemoryPressureOptions​

• Const defaultMemoryPressureOptions: MemoryPressureOptions


defaultOrderIndependentTransparencyOptions​

• Const defaultOrderIndependentTransparencyOptions: OrderIndependentTransparencyOptions


defaultWorldClientOptions​

• Const defaultWorldClientOptions: WorldClientOptions


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.


transparentSortStats​

• Const transparentSortStats: TransparentSortStats

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


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 (step 6 mirror): each channel below the brightest keeps ratio per level of difference, the flood's own per-level decay, so the analytic hue at a light's core equals the flood's hue there. Legacy: channels over max.

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


applyQuantizedPositionDefine​

▸ applyQuantizedPositionDefine(material, unitsPerBlock): void

Chunk geometry that is not main-thread sorted arrives with fixed-point positions whose dequantization lives in the mesh matrix. The shader still needs the scale for displacement math (sway, waves) that reads the raw position attribute before any matrix applies; without the define the shader's fallback of 1.0 treats positions as block-space floats.

Parameters​

NameType
materialShaderMaterial
unitsPerBlocknumber

Returns​

void


band​

▸ band(x, steps): number

VOXEL_NATIVE_GLSL's band.

Parameters​

NameType
xnumber
stepsnumber

Returns​

number


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 written in a shader dialect the encoder can wrap.

Parameters​

NameType
materialMaterial

Returns​

BlendedKind | null


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]


blockLightCurve​

▸ blockLightCurve(level): number

The active curve, per BLOCK_LIGHT_TUNING.curve.

Parameters​

NameType
levelnumber

Returns​

number


blockLightCurveRGB​

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

The active 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; channels at 0 stay 0). Writes out.

Parameters​

NameType
rnumber
gnumber
bnumber
out[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


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) 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: legacy always applies the full warm tint; the new model fades it 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, startSequenceId, batchId, options, allocateJobId): LightJob[]

Parameters​

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

Returns​

LightJob[]


canCutSolidTexels​

▸ canCutSolidTexels(material): boolean

Whether a material's fragment stage has three's alpha test to cut solid texels after: every built-in material does, a shader material only if its source includes the chunk.

Parameters​

NameType
materialMaterial

Returns​

boolean


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

classifyTexels​

▸ classifyTexels(pixels, cuts): TexelClasses

Parameters​

NameType
pixelsArrayLike<number>
cutsTexelAlphaCuts

Returns​

TexelClasses


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


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


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


createCrustedFluidShader​

▸ createCrustedFluidShader(options?, base?): CrustedFluidShader

Parameters​

NameTypeDefault value
optionsCrustedFluidShaderOptions{}
baseObjectSHADER_LIGHTING_SEE_THROUGH_CHUNK_SHADERS
base.fragmentstringundefined
base.vertexstringundefined

Returns​

CrustedFluidShader


createEntityShadowUniforms​

▸ createEntityShadowUniforms(): EntityShadowUniforms

Returns​

EntityShadowUniforms


createPerfTraceId​

▸ createPerfTraceId(): string

Returns​

string


createSkyAtmosphereFragment​

▸ createSkyAtmosphereFragment(depthExpression?, revealExpression?, isEmission?): string

Parameters​

NameTypeDefault valueDescription
depthExpressionstring"sqrt(dot(fogDiff, fogDiff))"GLSL for the fog distance of this fragment.
revealExpressionstring"uChunkReveal"GLSL in [0, 1] for how much of the surface shows through its own fog color: 0 draws the fragment as pure fog tint (the sky-dome gradient it would vanish into), 1 applies fog normally. Chunk shaders multiply the material uniform by a per-section varying so the terrain fade-in can address one section at a time.
isEmissionbooleanfalseAdditive effects attenuate without adding sky color.

Returns​

string


createSkyFogFragment​

▸ createSkyFogFragment(depthExpression?, revealExpression?, isEmission?): string

Parameters​

NameTypeDefault value
depthExpression?stringundefined
revealExpression?stringundefined
isEmissionbooleanfalse

Returns​

string


createSwayShader​

▸ createSwayShader(baseShaders, options?): Object

Parameters​

NameType
baseShadersObject
baseShaders.fragmentstring
baseShaders.vertexstring
optionsPartial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }>

Returns​

Object

NameType
fragmentShaderstring
vertexShaderstring

createSwayTableShader​

▸ createSwayTableShader(baseShaders, profileCapacity): Object

Table-driven variant of createSwayShader for the shared cutout buckets: instead of compiling one material per species with its sway constants baked into the source, every quad carries a swayProfile attribute indexing a vec4-pair uniform table (params: speed, amplitude, scale, yScale; flags: rooted, cross shading). Profile 0 is reserved as "no sway" so geometry without a registered profile — and geometry whose material never binds the attribute, which WebGL defaults to 0 — stays still.

Cross-quad plants historically used a separate fragment (fixed sun incidence, no face shade); that difference rides the profile's cross flag through the vCrossShading varying so one program serves both shapes.

Parameters​

NameType
baseShadersObject
baseShaders.fragmentstring
baseShaders.vertexstring
profileCapacitynumber

Returns​

Object

NameType
fragmentShaderstring
vertexShaderstring

createUnderwaterFogFragment​

▸ createUnderwaterFogFragment(isEmission?): string

Emission loses light along the ray but does not add ambient water light.

Parameters​

NameTypeDefault value
isEmissionbooleanfalse

Returns​

string


createUnderwaterFogUniforms​

▸ createUnderwaterFogUniforms(): UnderwaterFogUniforms

Returns​

UnderwaterFogUniforms


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


cull​

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

Parameters​

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

Returns​

Promise<MeshResultType>


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


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


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), which share its atlas.

Parameters​

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

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 }[]


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"]


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[]


floodLight​

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

Parameters​

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

Returns​

void


fluidWaveOctavesGlsl​

▸ fluidWaveOctavesGlsl(x, z, waveTime): string

GLSL declaring each octave of the swell (in blocks) at world x/z and wave time waveTime (fluidWaveTimeGlsl) as wave1, wave2, ... over snoise; fluidWaveSumGlsl adds them up. Shader patches anchor on the sum's text.

Parameters​

NameType
xstring
zstring
waveTimestring

Returns​

string


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


fluidWaveSumGlsl​

▸ fluidWaveSumGlsl(): string

GLSL summing the octaves fluidWaveOctavesGlsl declares.

Returns​

string


fluidWaveTimeGlsl​

▸ fluidWaveTimeGlsl(timeMs): string

GLSL for the wave time at shader clock timeMs (ms).

Parameters​

NameType
timeMsstring

Returns​

string


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): CustomChunkShaderMaterial

Detach a customized block without cloning the world's live uniforms/atlas. clone() never sees the uniforms: three deep-copies them, and a render target's texture (the shadow maps, the scene colour the water refracts under order-independent transparency) cannot be copied, so every fork would warn, only to throw the copies away.

Parameters​

NameType
materialCustomChunkShaderMaterial

Returns​

CustomChunkShaderMaterial


forkVoxelBoxMaterial​

▸ forkVoxelBoxMaterial(material, frame): CustomChunkShaderMaterial

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
materialCustomChunkShaderMaterial
frameObject
frame.valueMatrix4

Returns​

CustomChunkShaderMaterial


formatSuggestion​

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

Parameters​

NameType
suggestionsstring[]
allAvailablestring[]
optionsFormatSuggestionOptions

Returns​

string


geometricBlockLightCurve​

▸ geometricBlockLightCurve(level): number

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

Parameters​

NameType
levelnumber

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


hasItemComponent​

▸ hasItemComponent(item, key): boolean

Parameters​

NameType
itemItemDef
keystring

Returns​

boolean


hasSlotData​

▸ hasSlotData(slot, key): boolean

Parameters​

NameType
slotSlotContent
keystring

Returns​

boolean


installVoxelNativeShaderChunk​

▸ installVoxelNativeShaderChunk(chunks): void

Registers VOXEL_NATIVE_GLSL as #include <voxel_native> in the given chunk table (three's ShaderChunk). Idempotent.

Parameters​

NameType
chunksShaderChunkTable

Returns​

void


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


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


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


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

Returns​

boolean


isSharedOpaqueMaterialBlock​

▸ isSharedOpaqueMaterialBlock(block): boolean

Parameters​

NameType
blockBlock

Returns​

boolean


isWarmablePool​

▸ isWarmablePool(child): child is WarmablePool

Parameters​

NameType
childobject

Returns​

child is WarmablePool


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


legacyBlockLightCurve​

▸ legacyBlockLightCurve(level): number

Legacy x * x * (3 - 2x).

Parameters​

NameType
levelnumber

Returns​

number


linearizeShadowDepth​

▸ linearizeShadowDepth(depth01, near, far): number

Linear view depth stored at a face texel, back from hardware depth 0..1.

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: the legacy (1 - n^2)^2 window, or the windowed inverse square, per the kernel switch. 0 at and beyond the range either way.

Parameters​

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

Returns​

number


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


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


makeChunkShaderMaterial​

▸ makeChunkShaderMaterial(world, fragmentShader?, vertexShader?, uniforms?): CustomChunkShaderMaterial

Parameters​

NameType
worldChunkMaterialHost
fragmentShader?string
vertexShader?string
uniformsRecord<string, Uniform<any>>

Returns​

CustomChunkShaderMaterial


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> | HTMLImageElement

Returns​

Texture


makeSceneColorTexture​

▸ makeSceneColorTexture(width?, height?, isSRGB?): FramebufferTexture

Parameters​

NameTypeDefault value
widthnumber1
heightnumber1
isSRGBbooleanfalse

Returns​

FramebufferTexture


makeShadowFaceProjection​

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

Compute the perspective projection for a shadow face camera. Standard GL frustum, aspect 1; tanHalf is the half-FOV tangent (guard included).

Parameters​

NameType
outMatrix4
tanHalfnumber
nearnumber
farnumber

Returns​

Matrix4


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

Returns​

void


maskedWindowDistance​

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

Distance a masked light's falloff is windowed by (step 1): 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


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


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): void

Parameters​

NameType
chunkChunk
lightsUint32Array<ArrayBufferLike>
colorLightColor
boundingBoxBoundingBox

Returns​

void


mergeTexelClasses​

▸ mergeTexelClasses(into, from): TexelClasses

Parameters​

NameType
intoTexelClasses
fromTexelClasses

Returns​

TexelClasses


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


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


orderIndependentFragment​

▸ orderIndependentFragment(source, kind): string

The accumulation encoder around a material's fragment stage. The source's main is renamed by the preprocessor, not by editing its text, so a hook that later finds void main() { still edits the material's own body. The new main first drops what the pass does not keep (the far or near side of the separating surface's nearest face), before any of the material's own work. It then runs the body and (while the accumulation is open) turns its colour into the weighted sums: premultiplied colour times the weight into the first target (its alpha keeps the product of transmittances through the blend state), alpha times the weight into the second.

Parameters​

NameType
sourcestring
kindBlendedKind

Returns​

string


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


paintPartFacesAtDensity​

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

Parameters​

NameType
atlasCtxCanvasRenderingContext2D
cellSizenumber
partIndexnumber
dimsPartBoxDims
paintFaceFacePainter
densityTexelDensity

Returns​

void


partAtlasCellSize​

▸ partAtlasCellSize(partDims, density): number

Parameters​

NameType
partDimsPartBoxDims[]
densityTexelDensity

Returns​

number


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][]


positionUnitsPerBlock​

▸ positionUnitsPerBlock(options): number

Parameters​

NameType
optionsSectionExtentOptions

Returns​

number


prepareTransparentMesh​

▸ prepareTransparentMesh(mesh): TransparentMeshData | null

Parameters​

NameType
meshMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], 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 GLSL) 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


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[]


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


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


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>


setBlockLightTuning​

▸ setBlockLightTuning(flags): void

Parameters​

NameType
flagsBlockLightTuningFlags

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, any, any>
isCameraUnderwaterboolean
isWater(blockId: number) => boolean

Returns​

void


setHiddenTabTicker​

▸ setHiddenTabTicker(ticker): void

Parameters​

NameType
tickerHiddenTabTicker

Returns​

void


setOwnFaceTexture​

▸ setOwnFaceTexture(material, texture): void

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

Parameters​

NameType
materialCustomChunkShaderMaterial
textureTexture<unknown>

Returns​

void


setPerfWorld​

▸ setPerfWorld(world): void

Parameters​

NameType
worldstring

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


shadowDepthPerBlock​

▸ shadowDepthPerBlock(shadowMatrix, lightDirection): 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.

Parameters​

NameType
shadowMatrixMatrix4
lightDirectionVector3

Returns​

number


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


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
materialsReadonlyMap<string, Material>

Returns​

Error | null


simplexNoise3​

▸ simplexNoise3(vx, vy, vz): number

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

Parameters​

NameType
vxnumber
vynumber
vznumber

Returns​

number


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

VOXEL_NATIVE_GLSL's snapToTexel, for one axis.

Parameters​

NameType
pnumber
texelsPerUnitnumber

Returns​

number


sortTransparentMesh​

▸ sortTransparentMesh(mesh, data, camera): void

Parameters​

NameType
meshMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], 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

VOXEL_NATIVE_GLSL's stepTime.

Parameters​

NameType
tnumber
framesPerSecondnumber

Returns​

number


stripLocalLightsFromFragment​

▸ stripLocalLightsFromFragment(fragment): string

Compile the local-lights layer entirely out of a composed chunk fragment: the uniform/function/debug sources vanish, the ownership block becomes the legacy flood expressions, and the guarded cluster blend, room fill, fluid specular add, and debug tail disappear. The result is the "local lights never existed" program the render-diff harness compares against the shipped program at the off tier — byte-identical output is the contract (see scripts/render-off-parity.mjs).

Parameters​

NameType
fragmentstring

Returns​

string


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


tallyState​

▸ tallyState(tally, state): void

Parameters​

NameType
tallySurfaceTally
stateSurfaceState

Returns​

void


texelPlanOf​

▸ texelPlanOf(material, classes, canCut): TexelPlan

Parameters​

NameType
materialPick<Material, "depthWrite">
classesTexelClasses
canCutboolean

Returns​

TexelPlan


texelsForBlocks​

▸ texelsForBlocks(blocks, density): number

Parameters​

NameType
blocksnumber
densityTexelDensity

Returns​

number


textureTexelClasses​

▸ textureTexelClasses(texture, cuts): TexelClasses

classifyTexels over a whole texture, cached per texture version.

Parameters​

NameType
textureTexture<unknown>
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 GLSL): 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


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


updateEntityShadowUniforms​

▸ updateEntityShadowUniforms(target, source): void

Parameters​

NameType
targetEntityShadowUniforms
sourceShaderLightingUniforms

Returns​

void


updateUnderwaterFogUniforms​

▸ updateUnderwaterFogUniforms(target, source): void

Parameters​

NameType
targetUnderwaterFogUniforms
sourceUnderwaterFogSource

Returns​

void


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


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


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


wrapShaderSeconds​

▸ wrapShaderSeconds(seconds): number

A clock reading wrapped into [0, SHADER_CLOCK_WRAP_SECONDS).

Parameters​

NameType
secondsnumber

Returns​

number


writeInstanceColor​

▸ writeInstanceColor(attribute, index, r, g, b): void

Parameters​

NameType
attributeBufferAttribute
indexnumber
rnumber
gnumber
bnumber

Returns​

void


writeInstanceMatrix​

▸ writeInstanceMatrix(mesh, index, matrix): void

Parameters​

NameType
meshInstancedMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], InstancedMeshEventMap>
indexnumber
matrixMatrix4

Returns​

void