What the .glb holds
PartScript writes glTF 2.0 binary (.glb) itself, with no exporter in between. This page is what is in
it, for anyone importing the models into an engine or writing a viewer.
Axes and units
Files are written Z up with +Y back (Blender's axes). The .glb is glTF's Y up with -Z forward: a point
(x, y, z) is written (x, z, -y). A prop's front, -Y in a file, is +Z in the .glb. Units are metres.
Nodes
- A prop with one mesh is one node, named after its asset id.
- A prop with several meshes (
partlines, snap markers) is a node named after the asset id with a child node per mesh. - With snaps on (
build(..., snaps=True)), the snap markers are a child mesh namedsnaps.
Meshes and materials
Each mesh has a primitive per material. Corners are not shared between faces (flat shading), except in a
part ... smooth=1, whose normals are shared. Every material has:
- a
baseColorTexture, sampled nearest (NEAREST/NEAREST_MIPMAP_NEAREST): hard pixels; metallicFactorandroughnessFactorfrom the material;- for lit materials,
emissiveFactor(withKHR_materials_emissive_strengthabove 1) and an emissive texture for signs; alphaMode: BLENDfor see-through materials (glass),MASKfor cut-outs, anddoubleSidedwhere asked.
Material names are the host's prefix and the material key (zb_steel_dark, x8a6a42_wood for a colour).
Vertex attributes
POSITION, NORMAL | as above, flat or smooth |
TEXCOORD_0 | texture coordinates (box-projected in metres over each material's tile size, or the shape's own) |
COLOR_0 | the baked tone, RGBA (grey), normalized 16-bit, linear: grounded shading, facing, per-face variation, fade= |
TEXCOORD_1 | only with steps=True: x is the source line's step index + .5, y the face's use-chain index + .5 (Built.origins) |
Showing the baked tone. The vertex colour multiplies the texture. For the PSX look, draw unlit:
texture times vertex colour (three.js: MeshBasicMaterial({ map, vertexColors: true })). In a lit
engine, use vertex colour as albedo (Godot's vertex_color_use_as_albedo) so the baked shading shows
under the engine's own lights.
Godot's runtime glTF loader leaves vertex-colour-as-albedo off on a mesh's first primitive, so a mesh can
name a lead_material (kitlib Part.lead_material) to put its least visible material first.
Buildings
A building builds into one model like a prop (its pieces merged), and is also placement data (see the Rust API), for a game that places its own copies of the pieces.