merge master into ws/3d3 (ws/roblox, ws/voxel, ...)

This commit is contained in:
4DBug committed 2026-10-31 15:20:28 -05:00
commit 98b04367c6
68 files changed
+13623 -31

No files matched your search

+1 -1
View File
@@ -104,4 +104,4 @@ decoders (CELT, VP8, H.264, MPEG-1) outgrow the defaults and fall back to the in
## Also exported
`F.Err` (codes `TRUNCATED`, `CORRUPT`, `CHECKSUM`, `UNSUPPORTED`, `LIMIT`, `ARG`, `IO`, `UNKNOWN_FORMAT`), `F.Types`
(the standard types and their constructors), `F.Bytes` (`core/Bytes` Reader / Writer), `F.null`, `F.version`.
(the standard types and their constructors), `F.Bytes` (`core/Bytes` Reader / Writer), `F.Rbx` (the Roblox instance tree of `rbxm` / `rbxmx`: `codecs/model/Rbx`), `F.null`, `F.version`.
+12
View File
@@ -43,10 +43,16 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
| model | iqm | .iqm | yes | yes | materials: true, skins: true, animation: true, vertexColors: true | `tests/model/iqm.luau` |
| model | ldraw | .ldr .mpd .dat | yes | - | materials: true, lines: true, instancing: true | `tests/model/ldraw.luau` |
| model | lwo | .lwo .lxo | yes | - | materials: true, polygons: true, vertexColors: true, morphTargets: true | `tests/model/lwo.luau` |
| model | mca | .mca .mcr | yes | - | voxels: true, blocks: true | `tests/model/mca.luau` |
| model | ms3d | .ms3d | yes | yes | materials: true, skins: true, animation: true | `tests/model/ms3d.luau` |
| model | obj | .obj | yes | yes | materials: true, polygons: true, vertexColors: true | `tests/model/obj.luau` |
| model | off | .off | yes | yes | polygons: true, points: true, colors: true, binary: false | `tests/model/off.luau` |
| model | ply | .ply | yes | yes | ascii: true, binary: true, polygons: true, points: true, colors: true | `tests/model/ply.luau` |
| model | qb | .qb | yes | yes | voxels: true, truecolor: true | `tests/model/qb.luau` |
| model | rbxm | .rbxm .rbxl | yes | yes | tree: true, compression: "none", "lz4", "zstd" | `tests/model/rbxm.luau` |
| model | rbxmx | .rbxmx .rbxlx | yes | yes | tree: true | `tests/model/rbxmx.luau` |
| model | robloxmesh | .mesh | yes | yes | skinning: true, lods: true, versions: "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" | `tests/model/robloxmesh.luau` |
| model | schematic | .schem .schematic .litematic | yes | yes | voxels: true, blocks: true, variants: "schem", "schematic", "litematic" | `tests/model/schematic.luau` |
| model | stl | .stl | yes | yes | ascii: true, binary: true, colors: true, indexed: false | `tests/model/stl.luau` |
| model | usda | .usda .usd .usdz | yes | yes | materials: true, animation: true, cameras: true, lights: true, polygons: true, vertexColors: true, usdz: "read", usdc: false | `tests/model/usda.luau` |
| model | vox | .vox | yes | yes | voxels: true, sceneGraph: true, materials: true | `tests/model/vox.luau` |
@@ -70,7 +76,9 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
| data | ini | .ini .cfg .conf .inf .desktop | yes | yes | ordered: true | `tests/data/ini.luau` |
| data | json | .json .jsonl .ndjson .geojson | yes | yes | ordered: true, streaming: true | `tests/data/json.luau` |
| data | msgpack | .msgpack .mpk | yes | yes | binary: true, ordered: true | `tests/data/msgpack.luau` |
| data | nbt | .nbt .dat .mcstructure .dat_old | yes | yes | binary: true, ordered: true, typed: true | `tests/data/nbt.luau` |
| data | plist | .plist | yes | yes | binary: "read", ordered: true | `tests/data/plist.luau` |
| data | snbt | .snbt | yes | yes | ordered: true, typed: true | `tests/data/snbt.luau` |
| data | toml | .toml | yes | yes | ordered: true, dates: true | `tests/data/toml.luau` |
| data | xml | .xml .xsd .xsl .xslt .rss .atom .xhtml | yes | yes | namespaces: true, streaming: true | `tests/data/xml.luau` |
| data | yaml | .yaml .yml | yes | yes | ordered: true, multiDocument: true, anchors: true | `tests/data/yaml.luau` |
@@ -111,6 +119,7 @@ Codecs (layer 3, shared by formats; not loadable on their own), by domain:
- codecs/compress/Brotli: Brotli (RFC 7932) decompression. A codec (layer 3): archive/br and font/woff2 build on it. Written
- codecs/compress/Bzip2: bzip2 decompressor (BWT + MTF + Huffman, the .bz2 stream format of bzip2 0.9.5 / 1.0.x). A codec
- codecs/compress/Deflate: DEFLATE (RFC 1951) decoder and compressor, with the zlib (RFC 1950) and gzip (RFC 1952) wrappers.
- codecs/compress/Lz4: the LZ4 block format (lz4 doc/lz4_Block_format.md): decode and a greedy hash-chain-free encoder
- codecs/compress/Lzma: LZMA and LZMA2 decoders, the .lzma ("LZMA alone") wrapper and the .xz container. A codec (layer 3):
- codecs/compress/Lzw: LZW decoder and encoder in the two variants file formats use. A codec (layer 1): image/gif and
- codecs/compress/PackBits: the Apple PackBits run-length code (TIFF compression 32773, PSD / PSB RLE channels, IFF
@@ -135,10 +144,13 @@ Codecs (layer 3, shared by formats; not loadable on their own), by domain:
- codecs/model/Draco: Google Draco geometry decompression (.drc; glTF KHR_draco_mesh_compression; Roblox mesh v6 / v7).
- codecs/model/Mat4: 4x4 matrix and quaternion helpers for the model formats: column-major flat arrays of 16
- codecs/model/MeshFlatten: a Scene to one world-space mesh, for the writers of mesh-only formats (STL, PLY, OFF). Walks
- codecs/model/Minecraft: what Minecraft's voxel formats share (model/schematic, model/mca). New code.
- codecs/model/Rbx: the Roblox instance tree every Roblox file format maps to (model/rbxm binary rbxm / rbxl,
- codecs/model/Rig: the Scene mapping shared by game model formats (MD2 / MD3 / MDL / MD5 / SMD / ...), so each
- codecs/model/Sampler: evaluates Scene animation channels at any time (STEP, LINEAR with quaternion slerp for
- **text**
- codecs/text/Json: JSON (RFC 8259 / ECMA-404) parse and serialize, the engine data/json, glTF, TMJ, ... use. New code.
- codecs/text/Nbt: Minecraft's Named Binary Tag format and its text form SNBT, the engine data/nbt, data/snbt,
- codecs/text/Text: text decoding helpers for the text formats: a UTF-8 BOM is stripped, text that is not valid UTF-8 is
- codecs/text/Url: RFC 3986 reference resolution (section 5.2), the classification of a playlist / manifest location (URL,
- codecs/text/Xml: XML 1.0 parse (DOM and pull events) and serialize, the engine data/xml, SVG, DAE, 3MF, TMX, plist, ...
+2 -2
View File
@@ -25,11 +25,11 @@ src/Formats/
vector layered subtitle music playlist
containers/ containers (layer 4) Chunks, Riff, IsoBmff, Ebml, Ogg, Zip, Tar, ...
codecs/<domain>/<Name> codecs (layer 3) generic algorithms, by domain:
compress/ Deflate Lzma Zstd Brotli Bzip2 Lzw entropy/ Huffman RangeCoder
compress/ Deflate Lzma Zstd Brotli Bzip2 Lzw Lz4 entropy/ Huffman RangeCoder
image/ Jpeg Dct Vp8 Vp8L Pixels Yuv Quantize Raster Blend
audio/ Opus Vorbis Flac Mpa Aac Alac Mdct Pcm Stream Resample VorbisComment Tracker SoundFont
video/ H264 Mpeg1 Video (the video codec registry) text/ Json Xml Text Url
font/ TrueType Cff model/ Mat4 MeshFlatten
font/ TrueType Cff model/ Mat4 MeshFlatten Rbx
host/ host (layer 2) runtime adapters; only the api uses them
Types.luau types (layer 1) standard types + constructors
core/ core (layer 0) Bytes, Bits, Err, Crc32, Adler32, Base64, Md5,
+2
View File
@@ -14,10 +14,12 @@ and the host notes. Each standard type has its own page:
| [Music](music.md) | `Module`, `Midi` | MOD, S3M, XM, IT, MIDI, SoundFont 2 |
| [Video](video.md) | `VideoDecoder`, `Demuxer`, `Track`, `Packet` | MP4 / MOV, MKV / WebM, AVI, MPEG-TS / PS, Y4M, H.264 |
| [3D scenes](scene.md) | `Scene`, `Voxels` | glTF / GLB, OBJ, STL, PLY, FBX, Collada, 3MF, USDA, OFF, VOX |
| [Roblox](roblox.md) | `RbxTree` (`F.Rbx`), `Scene` | rbxm / rbxl, rbxmx / rbxlx, Roblox .mesh |
| [CAD](cad.md) | `Cad` (STEP) | STEP (B-rep through a plug-in) |
| [Fonts](font.md) | `Font` | TTF / OTF, WOFF, WOFF2, BMFont |
| [Archives](archive.md) | `Archive` | zip, tar, gzip, 7z, xz, zstd, Brotli, bzip2 |
| [Data](data.md) | plain values, `XmlNode`, `Date` | JSON, XML, YAML, TOML, CSV, INI, MessagePack, CBOR, plist |
| [Minecraft and voxels](voxel.md) | typed values, `Scene` + `Voxels` | NBT, SNBT, `.schem` / `.schematic` / `.litematic`, Anvil `.mca`, Qubicle `.qb` |
| [Vector](vector.md) | `Vector` | SVG |
| [Layered images](layered.md) | `Layered` | PSD, Aseprite |
| [Tile maps](tilemap.md) | `TileMap` | Tiled TMX / TMJ |
+2 -1
View File
@@ -3,7 +3,8 @@
The data formats (JSON, XML, YAML, TOML, CSV, INI, MessagePack, CBOR, plist) decode to plain Luau values: tables,
strings, numbers, booleans. Three helpers fill the gaps Luau tables leave: `F.data.null` (a null that can sit in a
table), ordered objects (`F.Types.object`: key order, and `{}` that stays an object), and `F.Types.Date` (TOML,
YAML, plist, CBOR and MessagePack dates). XML decodes to a tree of `XmlNode`s.
YAML, plist, CBOR and MessagePack dates). XML decodes to a tree of `XmlNode`s. Minecraft's NBT and SNBT (typed
numbers kept) are on the [Minecraft and voxels](voxel.md) page.
```luau
local v = assert(F.data.load('{"name": "ada", "tags": ["x", "y"], "boss": null}'))
+94
View File
@@ -0,0 +1,94 @@
# Roblox files
Roblox models and places (`.rbxm` / `.rbxl` binary, `.rbxmx` / `.rbxlx` XML) load as an **`RbxTree`**: instances
with a class name, a name, typed properties and children. Roblox meshes (`.mesh`) load as an ordinary
[`Scene`](scene.md). This is a file library, not a Roblox runtime. It never creates Instances. A Roblox game that
wants Instances walks the tree itself, and the tree works the same under LuaJIT and the luau CLI.
```luau
local place = assert(F.load(placeBytes)) -- binary .rbxl -> RbxTree
assert(place.kind == "rbxtree" and place.place) -- a place: the roots are services
for inst, depth in F.Rbx.descendants(place) do
print(string.rep(" ", depth - 1) .. inst.className .. " " .. inst.name)
end
local step = assert(F.Rbx.find(place, "Workspace/Course/Step2"))
local size = F.Rbx.get(step, "size") -- { 4, 1, 4 } (the binary name of Part.Size)
assert(size[1] == 4 and size[2] == 1)
local xml = assert(F.convert(placeBytes, "rbxlx")) -- binary -> XML: both read and write the same tree
assert(F.detect(xml) == "rbxlx" and F.detect(placeBytes) == "rbxl")
```
## The tree
`F.Rbx` (`codecs/model/Rbx`) holds the type and its helpers:
| Field / call | Meaning |
|---|---|
| `tree.roots` | the top-level instances (the services of a place) |
| `tree.place` | true for `.rbxl` / `.rbxlx` (services); saving to `rbxl` sets it |
| `tree.metadata` | the file's META entries (`ExplicitAutoJoints`, ...) |
| `inst.className`, `inst.name`, `inst.children`, `inst.parent` | the hierarchy. `Name` is `inst.name`, not a property |
| `inst.properties[name]` | `{ type = "Vector3", value = { x, y, z } }` |
| `F.Rbx.tree()`, `instance(class, name)`, `add(parent, child)` | build trees |
| `set(inst, name, type, value)`, `get(inst, name)` | properties |
| `find(root, "A/B/C")`, `descendants(root)`, `list(tree)`, `fullName(inst)` | lookups |
Property values keep the file's type, because a number alone could be an `Int32`, a `Float32` or an `Enum`. Arrays
follow the argument order of the Roblox constructors, so `Vector3.new(table.unpack(v.value))` and
`CFrame.new(table.unpack(v.value))` rebuild them in a game. The full list is in the header of
`src/Formats/codecs/model/Rbx/init.luau`:
- **Text and numbers:** `String`, `BinaryString`, `ProtectedString`, `ContentId`, `SharedString` are strings.
`Bool`, `Int32`, `Int64`, `Float32`, `Float64`, `Enum`, `BrickColor`, `Faces` and `Axes` are numbers and booleans.
- **Arrays:** `Vector2`, `Vector3` and `Color3` (0..1) are arrays. `CFrame` is 12 numbers: the position, then the
rotation row by row.
- **References:** `Ref` and the object form of `Content` hold the instance itself. `Content` is otherwise a URI string,
or nil.
- **Unknown data** is kept, not dropped: properties of unknown types (`Raw` in binary files, `XmlRaw` in XML) and unknown
chunks are written back unchanged.
Property names are the ones the file stores. Binary files use a few serialized names, for example `size` for
`Part.Size` and `Color3uint8` for `Part.Color`. Without Roblox's reflection database, the library does not rename
them.
```luau
local tree = F.Rbx.tree()
local model = F.Rbx.add(tree, F.Rbx.instance("Model", "Tower"))
for i = 1, 3 do
local part = F.Rbx.add(model, F.Rbx.instance("Part", "Floor" .. i))
F.Rbx.set(part, "size", "Vector3", { 8, 1, 8 })
F.Rbx.set(part, "CFrame", "CFrame", { 0, i * 4, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 })
F.Rbx.set(part, "Anchored", "Bool", true)
end
F.Rbx.set(model, "PrimaryPart", "Ref", model.children[1])
local rbxm = assert(F.save(tree, nil, { format = "rbxm" })) -- LZ4 chunks; { compression = "none" } writes them raw
local back = assert(F.load(rbxm))
assert(F.Rbx.get(back.roots[1], "PrimaryPart") == back.roots[1].children[1])
local text = buffer.tostring(assert(F.save(back, nil, { format = "rbxmx" })))
assert(string.find(text, '<Item class="Part"', 1, true))
```
Binary files store one value per instance of a class. When only some Parts have a property, the writer fills in the
type's default for the rest, as Roblox does.
## Meshes
A `.mesh` of any version from 1.00 to 7.00 loads as a one-mesh `Scene`:
- **Attributes:** `POSITION`, `NORMAL`, `TEXCOORD_0`, `TANGENT` and `COLOR_0`.
- **LODs:** LOD 0 is the primitive. The other LODs are in `mesh.extras.lods`.
- **Skinning:** bones become a skin with joint nodes, and the vertices get `JOINTS_0` / `WEIGHTS_0`.
- **Not decoded yet:** Draco-compressed meshes (7.00) return `UNSUPPORTED`.
```luau
local scene = assert(F.load(meshBytes, { format = "robloxmesh" }))
local prim = scene.meshes[1].primitives[1]
assert(prim.attributes.JOINTS_0 and #scene.skins[1].joints == 4)
local glb = assert(F.save(scene, nil, { format = "glb" })) -- to glTF, skin included
local v2 = assert(F.save(scene, nil, { format = "robloxmesh" })) -- version 2.00: geometry only
local v4 = assert(F.save(scene, nil, { format = "robloxmesh", version = "4.00" })) -- bones, skinning, LODs
assert(buffer.readstring(v4, 0, 12) == "version 4.00")
```
Any scene can be saved as a mesh, for example a glTF: every primitive goes in, in world space. Version 4.00 also
writes the scene's first skin, splitting it into subsets of at most 26 bones as Roblox requires.
+5
View File
@@ -349,6 +349,8 @@ node that shows a model has `node.voxels` (an index into `scene.voxels`) and no
| `data` | `buffer` | one byte per cell, `0` = empty, `1..255` = palette index; cell `(x, y, z)` (0-based) at byte `x + sx * (y + sy * z)` |
| `palette` | `{ { r, g, b, a } }` | 255 entries, 0..255 **sRGB**, `palette[i]` for index `i`, shared by a file's models |
| `materials` | `{ [index]: { type, ... } }?` | MATL: `"diffuse"`, `"metal"`, `"glass"`, `"emit"`, ... with their properties |
| `blocks` | `{ palette, data, blockEntities?, entities? }?` | Minecraft grids: the exact block state of every cell ([voxel.md](voxel.md)) |
| `colors` | `buffer?` | true-colour grids (Qubicle): r, g, b, a bytes per cell |
```luau
local V = F.Types.Voxels
@@ -628,6 +630,9 @@ assert(back.meshes[1].primitives[1].indices.count == 3)
| LightWave LWO (LWO2, LWOB, Modo LXOB) | yes | | layers, vertex maps, surfaces; see below |
| DirectX .x (text, binary, MSZIP) | yes | | frames, materials, skins, animation |
| IQM (Inter-Quake Model) | yes | yes | skeleton, skin, sampled animations, bounds |
| Minecraft `.schem` / `.schematic` / `.litematic` | yes | yes | block grids, see [voxel.md](voxel.md) |
| Minecraft region `.mca` | yes | | block grids of chosen chunks, see [voxel.md](voxel.md) |
| Qubicle `.qb` | yes | yes | true-colour grids, see [voxel.md](voxel.md) |
| STEP | via the CAD plug-in | | see [cad.md](cad.md) |
Capabilities per format: [FORMATS.md](../FORMATS.md).
+145
View File
@@ -0,0 +1,145 @@
# Minecraft and voxel files
Minecraft's NBT data, its schematics (`.schem`, `.schematic`, `.litematic`) and region files (`.mca`), and Qubicle
`.qb` models. NBT and SNBT load as plain values (the [Data](data.md) category); schematics, regions and Qubicle files
load as a `Scene` whose `scene.voxels` holds `Voxels` grids (see [3D scenes](scene.md#voxels)), so they mesh and save
like a `.vox`.
| Format | Read | Write | Value |
|---|---|---|---|
| NBT (`.nbt`, `.dat`, `.mcstructure`) | yes | yes | typed plain values; Java big-endian, Bedrock little-endian, gzip / zlib / raw |
| SNBT (`.snbt`) | yes | yes | the same values as text |
| Sponge `.schem` v1 / v2 / v3 | yes | yes | Scene, one grid with block states |
| MCEdit / WorldEdit `.schematic` | yes | yes | Scene; pre-1.13 numeric ids |
| Litematica `.litematic` | yes | yes | Scene, one grid per region |
| Anvil region `.mca` | yes | | Scene, the chosen chunks as one grid, plus each chunk's NBT |
| Qubicle `.qb` | yes | yes | Scene, one grid per matrix, exact colours |
## NBT and SNBT
NBT values are plain Luau with their tag type kept, so what you load saves back the same:
| NBT tag | Luau value |
|---|---|
| int | number |
| string | string |
| byte array | buffer |
| compound | ordered table (`F.Types.object`, keys in file order) |
| list | array (its element type: `Nbt.listType(list)`) |
| byte, short, long, float, double | a tag `{ type = "byte", value = 1 }` (`tostring` gives SNBT: `1b`); longs past 2^53 hold their exact decimal text |
| int array, long array | a tag with `value` = numbers / a buffer of 8-byte little-endian longs |
```luau
local level = assert(F.load(levelDatBytes, { name = "level.dat" })) -- gzip NBT
local data = level.Data
assert(data.LevelName == "My World" and data.SpawnY == 64) -- ints and strings are plain
assert(data.Difficulty.type == "byte" and data.Difficulty.value == 2)
assert(data.RandomSeed.value == "-4011880356862312345") -- past 2^53: exact text
assert(tostring(data.Player.Health) == "20.0f")
local Nbt = F.format("nbt").Nbt -- the engine: codecs/text/Nbt
data.Difficulty = Nbt.byte(3)
data.Tags = Nbt.list("string", { "a", "b" })
local saved = assert(F.save(level, nil, { format = "nbt" })) -- gzip again, like the source
assert(F.load(saved, { format = "nbt" }).Data.Difficulty.value == 3)
local info = F.format("nbt").info(level) -- how it was stored
assert(info.compression == "gzip" and info.endian == "big" and info.name == "")
```
Plain inputs work too: a whole number writes as an int, other numbers as a double, `true` / `false` as bytes, a table
with string keys as a compound and an array as a list. Bedrock files (little-endian, with or without the `level.dat`
header) are detected; `endian = "little"`, `varint = true` (network NBT) and `compression` force a layout when saving.
```luau
local text = assert(F.convert(levelDatBytes, "snbt", { format = "nbt" })) -- NBT -> SNBT text
assert(string.find(buffer.tostring(text), 'LevelName:"My World"', 1, true))
local v = assert(F.load("{pos:[I;1,2,3],name:'x',scale:1.5f,big:9007199254740993L}", { format = "snbt" }))
assert(v.pos.value[2] == 2 and v.scale.type == "float" and v.big.value == "9007199254740993")
assert(F.saveString(v, { format = "snbt" }) == '{pos:[I;1,2,3],name:"x",scale:1.5f,big:9007199254740993L}')
local pretty = assert(F.saveString(v, { format = "snbt", indent = 2 }))
local bedrock = assert(F.save(v, nil, { format = "nbt", endian = "little", compression = "none" }))
```
## Schematics
A schematic loads as a Scene with `meta.up = "y"` and one unit per block. Each grid has its usual colour view
(`data` / `palette`, from a built-in table of block colours) and `voxels.blocks` with the exact blocks:
| `voxels.blocks` field | Meaning |
|---|---|
| `palette` | block states (`"minecraft:oak_log[axis=y]"`), entry 1 is index 0 |
| `data` | a buffer, one u16 per cell (same cell order as `voxels.data`): the 0-based palette index |
| `blockEntities` | `{ { pos = { x, y, z }, id, data } }`: chests, signs, ... (`data` is their NBT) |
| `entities` | entity NBT records |
```luau
local scene = assert(F.load(schemBytes)) -- detected by content: F.detect gives "schem"
local grid = scene.voxels[1]
assert(grid.size[1] == 5 and grid.size[2] == 4) -- x, y (up), z
local blocks = grid.blocks
local function blockAt(x: number, y: number, z: number): string
local i = x + grid.size[1] * (y + grid.size[2] * z)
return blocks.palette[buffer.readu16(blocks.data, i * 2) + 1]
end
assert(blockAt(0, 0, 0) == "minecraft:stone" and blockAt(2, 2, 0) == "minecraft:glass")
assert(F.Types.Voxels.get(grid, 1, 1, 1) == 0) -- air is empty in the colour view
local lite = assert(F.load(litematicBytes))
assert(#lite.voxels == 2 and lite.nodes[2].name == "pillar") -- a node per region, placed by translation
local legacy = assert(F.save(lite, nil, { format = "schematic", variant = "schematic" })) -- regions merged
local schem = assert(F.save(lite, nil, { format = "schem" })) -- Sponge v3
assert(F.detect(schem) == "schem")
```
`F.save` picks the flavour from `variant`, the destination's extension (`"out.litematic"`), `format = "schem"` /
`"litematic"`, or the loaded file's. A grid without `blocks` (a `.vox`, a `.qb`) gets the block nearest in colour for
each palette colour, so converting voxel art works:
```luau
local vox = assert(F.load(voxBytes))
local schem = assert(F.save(vox, nil, { format = "schem" }))
local back = assert(F.load(schem))
assert(back.voxels[1].blocks.palette[1] == "minecraft:air")
```
## Region files
An Anvil region holds 32 x 32 chunks. Loading it builds one grid over the chunks you pick (`chunks = { { x, z } }`,
local 0..31), or the blocks inside `area = { minX, minY, minZ, maxX, maxY, maxZ }` (world coordinates), between the
lowest and highest sections holding blocks; `maxCells` (default 2^25) guards against loading a whole world.
```luau
local Mca = F.format("mca")
local region = assert(F.load(regionBytes, { name = "r.0.0.mca", chunks = { { 0, 0 }, { 1, 0 } } }))
local grid = region.voxels[1]
assert(grid.size[1] == 32 and grid.size[3] == 16)
local corner = region.nodes[1].translation -- the grid's world position
assert(corner[1] == 0 and corner[2] == -64)
local chunk = region.meta.source.chunks[1]
assert(chunk.dataVersion == 3953 and chunk.nbt.Status == "minecraft:full") -- the chunk's whole NBT
local list = assert(Mca.list(F.Bytes.reader(regionBytes))) -- the chunks present, with timestamps
local nbt = assert(Mca.chunk(F.Bytes.reader(regionBytes), 3, 2))
assert(nbt.xPos == 3)
```
All chunk layouts read: 1.18+ sections, 1.13 - 1.17 palettes and pre-1.13 numeric ids (as state names such as
`minecraft:red_wool`, with `[data=N]` for the rest of a data value). Chunk payloads may be gzip, zlib, LZ4 or stored;
chunks in external `.mcc` files load through `opts.resolve` (filled in when loading by path). Regions are read-only.
## Qubicle
Each matrix becomes a grid with `voxels.colors`, the exact colour of every cell (`r, g, b, a` bytes; `a = 0` is
empty), next to the indexed `data` / `palette` view. Left-handed files are mirrored into the scene's right-handed
axes; saving writes the source's settings unless `compressed`, `colorFormat` (`"rgba"` / `"bgra"`), `rightHanded` or
`visibilityMask` say otherwise.
```luau
local box = assert(F.load(qbBytes))
local grid = box.voxels[1]
local first = buffer.readu32(grid.colors, 0) -- r + g * 256 + b * 65536 + a * 2^24
assert(first % 256 == 200 and first // 16777216 == 255)
assert(box.nodes[1].name == "box")
local again = assert(F.save(box, nil, { format = "qb", compressed = false }))
local vox = assert(F.save(box, nil, { format = "vox" })) -- or .schem, .glb after F.ops.mesh.meshVoxels
```