Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Block Models

Block models define the visible geometry of a block.

Block models live under: namespace:models/block

NOTE: texture names are not part of the model. The model only declares named slots that it needs. These names are arbitrary: top, north, nwse, or any other string. Block definitions supply the actual texture filenames. See Blocks API.

NOTE: if a slot is missing, the engine uses the default slot.

NOTE: namespaced IDs inside block models must include a namespace. The engine resource manager resolves paths only with namespaced IDs. Raw C++ load and free functions do not receive a namespace argument.

Top-level fields

FieldTypeRequiredDefaultDescription
texturesstring[]yesN/DList of texture slot names
elementsobject[]yesN/DList of cuboids that form the model

Cuboid object

The figure shows a cuboid between min and max inside a cell. One grid line is 1/16 of a block.

FieldTypeRequiredDefaultDescription
minnumber[3]yesN/DCuboid start in 1/16ths of a block
maxnumber[3]yesN/DCuboid end in 1/16ths of a block
originnumber[3]no[0, 0, 0]Pivot point in 1/16ths of a block, used when rotation is present
rotationnumber[3]no[0, 0, 0]Euler rotation in degrees about X, Y and Z. The engine clamps each axis to [-180, 180] and snaps it to the nearest multiple of 15 degrees
rescaleboolnotrueIf false, a face without an explicit uv maps the whole texture over the cuboid’s extent. It does not move or clamp the cuboid
shadeboolnotrueIf true, the engine applies basic fake-light shading to the cuboid
facesobjectno{}Per-direction face definitions. A direction that is absent gives the cuboid no quad there

Face object

FieldTypeRequiredDefaultDescription
texturestringyesN/DTexture slot name
uvnumber[4]nodynamicLets a face sample a sub-rectangle of the texture, in 1/16ths of the image. [0, 0, 16, 16] is the whole texture
uv_rotationnumberno0UV rotation: 0, 90, 180, or 270
cullfacestringnoN/DA flag in the shape of a face name. The face key already gives the direction; the value is validated and then ignored, and the neighbour’s covered faces decide the cull
tintstringnonullNamespaced tint id

UV resolution

  • If a face has no explicit uv rectangle, UV coordinates come from the world-space side the face points to after facing rotation. See Blocks API.
  • If a face has an explicit uv rectangle, orientation stays locked. Facing rotation does not change it.

Example

{
  "textures": ["top", "bottom", "east", "west", "north", "south"],
  "elements": [
    {
      "min": [0, 0, 0],
      "max": [16, 16, 16],
      "faces": {
        "top":      { "texture": "top",     "cullface": "bottom"    },
        "bottom":   { "texture": "bottom",  "cullface": "top"       },
        "north":    { "texture": "north",   "cullface": "south"     },
        "south":    { "texture": "south",   "cullface": "north"     },
        "east":     { "texture": "east",    "cullface": "west"      },
        "west":     { "texture": "west",    "cullface": "east"      }
      }
    }
  ]
}