Buildings
@voxolith/gen-building: cottages, farmhouses, townhouses, towers and barns from a shape grammar, with textured walls, furnished openings and coursed roofs.
@voxolith/gen-building makes houses. A small shape grammar lays out the mass (a plinth, hollow
storeys with floor slabs, a gable, hip or flat roof), then detail passes work over it at roughly 2.5
voxels to the foot, so a storey is about 24 voxels and a cottage sits in proportion beside a
190-voxel tree.
import { seededRandom } from "@voxolith/renderer/core";
import { generateBuilding, PRESETS } from "@voxolith/gen-building";
const { entity } = generateBuilding(PRESETS.farmhouse, seededRandom(42));
// rooms are hollow and closed; the front door faces +zHow it works
Mass. A plinth that stands a voxel proud of the walls, storeys hollow shells of
storeyHeight with floor slabs, and the roof shell as a stack of slabs each inset by the pitch
(roofPitch is run per unit rise, 1 being 45 degrees), with gables. The ridge runs along the longer
side.
Layout. Where every window and the door go is decided before any texture, on a rhythm of
windowSpacing with windowFraction of the slots actually cut, so a timber frame can frame them.
The door takes a ground-floor slot at the front; 14 voxels and wider makes a pair of boarded barn
doors.
Walls. Brick in running bond, ashlar courses of varying height, plaster that spalls to show brick
(spalling), or a timber frame with posts at every jamb and braced end bays. Mortar joints are
recessed and timbers stand proud (relief), so walls have relief rather than just colour. Walls are
addressed in face-local coordinates: along the face, up it, and depth into it from the outer skin.
Trim. Quoins at the corners, string courses at each floor line, a projecting plinth with a water table, a corniced parapet with dentils under a flat roof.
Openings. Windows are set back in a reveal, framed, with glazing bars, a proud sill, a lintel or
soldier course, slatted shutters and flower boxes. The glass is real glass to the renderer and a
fraction of it (lit) glows. Doors get a panelled leaf with a glazed transom, a handle and a door
case, or boarded barn doors with Z braces; a hood on brackets, a lamp, and stone steps up the plinth.
Roof. Tile, slate or shingle laid in staggered courses with per-tile tone, or thatch with streaks, ragged eaves and a ligger ridge. Ridge cap, barge boards, rafter tails, gutters and downpipes; brick chimneys with a corbelled cap and hollow pots.
Weather. Streaks under sills, rising damp and tonal variation (weathering), moss on the roofs,
heavier low down and on the back slope, and on the plinth (moss).
Everything random comes from the injected rng or from hashes of positions. shape and openings
decide which voxels exist and look mostly decides which role each gets. The four wall styles and
four roofings are separate from the geometry, and colours come from 32 roles (walls, mortar, trim,
beams, glass, lit glass, frames, doors, shutters, roof tones, ridge, chimney, soot, pots, foundation,
floor, moss, gutters, flowers and leaves), so a house restyles by palette. Four roles carry material
hints: glass is glass, lit glass emits, and the handle and rainwater goods are metal.
Presets
| preset | walls and roof | shape |
|---|---|---|
cottage | plaster, thatch | one storey, gable, one chimney, shutters and flower boxes |
farmhouse | timber frame, tile | two storeys, two chimneys, gutters, a door hood |
townhouse | brick with quoins, flat roof behind a corniced parapet | three storeys, tall narrow windows |
tower | stone with quoins, slate | four storeys on a small square footprint, a steep hip roof |
barn | timber frame, shingle | two tall storeys, few small windows, boarded double doors |
Finer scales
At 20, 50 and 100 voxels per metre a building stays crisp (walls flat, corners sharp) and is refined on its outside faces only; the rooms are skipped. What the finer grid adds is masonry and joinery at their real size, which the coarse building can only suggest (its bricks are 80 cm long and its joints 10 cm wide): bricks in running bond with one-voxel joints set back, ashlar courses of blocks of varying length, fine plaster mottling, grain along timbers, tile, slate or shingle courses with a shadowed lower edge, streaky ragged thatch, boards on doors and shutters and planks on floors. The coarse building is generated without its relief first, since the joints are drawn at their own scale. At 20 voxels per metre (5 cm) a course or a slate row at real size would be under two voxels, so there the courses, tiles and boards have minimum sizes and come out at about twice their real size (at 20 voxels per metre). Door panels and handles are tied to their frames after refinement, so nothing on a door floats at any fine scale. Flowers and leaves are loose roles. See scales and refinement.
Development
bun run --cwd generators/building verify # connectivity, hollowness, openings, determinism, share codes
bun run --cwd generators/building preview species # contact sheets into previews/ (also: roofs, walls, seeds, closeup)
bun run --cwd generators/building gen # bake .vox files into out/House
voxolith/house starts from the cottage preset; every other preset is reachable through its
parameters.
- Id
voxolith/house- Version
- 0.2.0
- Scales
- 10, 20, 50, 100 voxels per metre
Parameters
Shape
| Parameter | Path | Range | Default |
|---|---|---|---|
Width length of the front wall in voxels (10 per metre); the ridge runs along the longer side | shape.width | 24 to 140 | 78 |
Depth length of the side walls in voxels, front to back | shape.depth | 24 to 120 | 50 |
Storeys number of floors below the roof | shape.storeys | 1 to 5 | 1 |
Storey height floor-to-floor height in voxels, including the slab | shape.storeyHeight | 18 to 32 | 26 |
Wall thickness thickness of the outer walls in voxels | shape.wallThickness | 2 to 4 | 3 |
Plinth height of the stone plinth the walls stand on, in voxels; the front door is reached by steps | shape.plinth | 0 to 8 | 4 |
Roof
| Parameter | Path | Range | Default |
|---|---|---|---|
Roof gable has two slopes and end gables, hip slopes on all four sides, flat is a parapet roof | shape.roof | gable, hip, flat | gable |
Roof pitch run per rise: 1 is 45° | shape.roofPitch | 0.5 to 2.5, step 0.05 | 1 |
Eaves how far the eaves stand out past the walls, in voxels; gutters need at least 2 | shape.overhang | 0 to 6 | 3 |
Chimneys number of brick chimney stacks on the roof | shape.chimneys | 0 to 3 | 1 |
Openings
| Parameter | Path | Range | Default |
|---|---|---|---|
Window width window opening width in voxels | openings.windowWidth | 3 to 13 | 9 |
Window height window opening height in voxels | openings.windowHeight | 4 to 16 | 11 |
Window spacing distance between neighbouring windows along a wall, in voxels; higher gives fewer windows | openings.windowSpacing | 10 to 36 | 21 |
Window fill fraction of window positions actually cut; the rest stay blank wall | openings.windowFraction | 0 to 1, step 0.05 | 0.95 |
Glazing bars divide each window into panes | openings.glazingBars | yes / no | yes |
Shutters fraction of windows with a pair of shutters | openings.shutters | 0 to 1, step 0.05 | 0.7 |
Flower boxes fraction of windows with a flower box under the sill | openings.flowerBoxes | 0 to 1, step 0.05 | 0.5 |
Door width 14 and over is a pair of boarded barn doors | openings.doorWidth | 6 to 22 | 10 |
Door hood a small hood on brackets over the front door | openings.doorHood | yes / no | no |
Gable windows windows in the attic gable ends (gable roofs only) | openings.gableWindows | yes / no | yes |
Look
| Parameter | Path | Range | Default |
|---|---|---|---|
Walls wall material and its texture: plaster, brick, stone or timber framing | look.wall | plaster, brick, stone, timber | plaster |
Roofing roof covering: tile, slate, thatch or shingle | look.roofStyle | tile, slate, thatch, shingle | thatch |
Relief recessed joints and proud trim | look.relief | yes / no | yes |
Quoins dressed stone corner quoins and storey bands | look.quoins | yes / no | no |
Spalling plaster fallen away to show brick | look.spalling | 0 to 1, step 0.05 | 0.35 |
Gutters gutters and downpipes along the eaves (needs eaves of 2 or more, not on thatch) | look.gutters | yes / no | no |
Lit windows fraction of windows glowing, as at dusk | look.lit | 0 to 1, step 0.05 | 0.3 |
Weathering rain streaks, rising damp and tonal variation on the walls | look.weathering | 0 to 1, step 0.05 | 0.5 |
Moss moss on the roof, heavier on the shaded slope | look.moss | 0 to 1, step 0.05 | 0.35 |
Presets
| Parameter | cottage | farmhouse | townhouse | tower | barn |
|---|---|---|---|---|---|
| Width | 78 | 100 | 58 | 38 | 118 |
| Depth | 50 | 56 | 62 | 38 | 66 |
| Storeys | 1 | 2 | 3 | 4 | 2 |
| Storey height | 26 | 24 | 23 | 22 | 22 |
| Wall thickness | 3 | 3 | 3 | 3 | 3 |
| Plinth | 4 | 4 | 5 | 3 | 2 |
| Roof | gable | gable | flat | hip | gable |
| Roof pitch | 1 | 1 | 1 | 0.65 | 0.85 |
| Eaves | 3 | 3 | 0 | 2 | 2 |
| Chimneys | 1 | 2 | 1 | 0 | 0 |
| Window width | 9 | 9 | 8 | 5 | 6 |
| Window height | 11 | 11 | 13 | 10 | 6 |
| Window spacing | 21 | 21 | 15 | 14 | 26 |
| Window fill | 0.95 | 0.95 | 0.95 | 0.8 | 0.6 |
| Glazing bars | yes | yes | yes | no | no |
| Shutters | 0.7 | 0.2 | 0 | 0 | 0.5 |
| Flower boxes | 0.5 | 0.3 | 0.25 | 0 | 0 |
| Door width | 10 | 10 | 10 | 10 | 18 |
| Door hood | no | yes | yes | no | no |
| Gable windows | yes | yes | no | yes | yes |
| Walls | plaster | timber | brick | stone | timber |
| Roofing | thatch | tile | slate | slate | shingle |
| Relief | yes | yes | yes | yes | yes |
| Quoins | no | no | yes | yes | no |
| Spalling | 0.35 | 0 | 0 | 0 | 0 |
| Gutters | no | yes | no | no | yes |
| Lit windows | 0.3 | 0.3 | 0.45 | 0.2 | 0 |
| Weathering | 0.5 | 0.5 | 0.5 | 0.7 | 0.7 |
| Moss | 0.35 | 0.25 | 0 | 0.45 | 0.35 |
Roles
Voxel values are these roles, in this order (value 1 is the first). The colours are the defaults; a host maps each role to a palette slot and can restyle it.
- 1Wall
wall - 2Wall dark
wall.dark - 3Wall light
wall.light - 4Mortar
mortar - 5Exposed brick
brick.exposed - 6Stone trim
trim - 7Stone trim dark
trim.dark - 8Timber
beam - 9Glass
glass(glass) - 10Lit window
glass.lit(emit) - 11Window frame
frame - 12Door
door - 13Door panel
door.dark - 14Door handle
handle(metal) - 15Shutter
shutter - 16Shutter slat
shutter.dark - 17Roof
roof - 18Roof dark
roof.dark - 19Roof light
roof.light - 20Ridge
ridge - 21Chimney
chimney - 22Chimney dark
chimney.dark - 23Soot
soot - 24Chimney pot
pot - 25Foundation
foundation - 26Foundation dark
foundation.dark - 27Floor
floor - 28Moss
moss - 29Gutter
gutter(metal) - 30Flower
flower.a· may float when refined - 31Flower alt
flower.b· may float when refined - 32Leaf
leaf· may float when refined
Townhouse
voxolith/townhouse is the same generator starting from the townhouse preset, with the brick and
slate skin as its default roles.
- Id
voxolith/townhouse- Version
- 0.2.0
- Scales
- 10, 20, 50, 100 voxels per metre
Parameters
Shape
| Parameter | Path | Range | Default |
|---|---|---|---|
Width length of the front wall in voxels (10 per metre); the ridge runs along the longer side | shape.width | 24 to 140 | 58 |
Depth length of the side walls in voxels, front to back | shape.depth | 24 to 120 | 62 |
Storeys number of floors below the roof | shape.storeys | 1 to 5 | 3 |
Storey height floor-to-floor height in voxels, including the slab | shape.storeyHeight | 18 to 32 | 23 |
Wall thickness thickness of the outer walls in voxels | shape.wallThickness | 2 to 4 | 3 |
Plinth height of the stone plinth the walls stand on, in voxels; the front door is reached by steps | shape.plinth | 0 to 8 | 5 |
Roof
| Parameter | Path | Range | Default |
|---|---|---|---|
Roof gable has two slopes and end gables, hip slopes on all four sides, flat is a parapet roof | shape.roof | gable, hip, flat | flat |
Roof pitch run per rise: 1 is 45° | shape.roofPitch | 0.5 to 2.5, step 0.05 | 1 |
Eaves how far the eaves stand out past the walls, in voxels; gutters need at least 2 | shape.overhang | 0 to 6 | 0 |
Chimneys number of brick chimney stacks on the roof | shape.chimneys | 0 to 3 | 1 |
Openings
| Parameter | Path | Range | Default |
|---|---|---|---|
Window width window opening width in voxels | openings.windowWidth | 3 to 13 | 8 |
Window height window opening height in voxels | openings.windowHeight | 4 to 16 | 13 |
Window spacing distance between neighbouring windows along a wall, in voxels; higher gives fewer windows | openings.windowSpacing | 10 to 36 | 15 |
Window fill fraction of window positions actually cut; the rest stay blank wall | openings.windowFraction | 0 to 1, step 0.05 | 0.95 |
Glazing bars divide each window into panes | openings.glazingBars | yes / no | yes |
Shutters fraction of windows with a pair of shutters | openings.shutters | 0 to 1, step 0.05 | 0 |
Flower boxes fraction of windows with a flower box under the sill | openings.flowerBoxes | 0 to 1, step 0.05 | 0.25 |
Door width 14 and over is a pair of boarded barn doors | openings.doorWidth | 6 to 22 | 10 |
Door hood a small hood on brackets over the front door | openings.doorHood | yes / no | yes |
Gable windows windows in the attic gable ends (gable roofs only) | openings.gableWindows | yes / no | no |
Look
| Parameter | Path | Range | Default |
|---|---|---|---|
Walls wall material and its texture: plaster, brick, stone or timber framing | look.wall | plaster, brick, stone, timber | brick |
Roofing roof covering: tile, slate, thatch or shingle | look.roofStyle | tile, slate, thatch, shingle | slate |
Relief recessed joints and proud trim | look.relief | yes / no | yes |
Quoins dressed stone corner quoins and storey bands | look.quoins | yes / no | yes |
Spalling plaster fallen away to show brick | look.spalling | 0 to 1, step 0.05 | 0 |
Gutters gutters and downpipes along the eaves (needs eaves of 2 or more, not on thatch) | look.gutters | yes / no | no |
Lit windows fraction of windows glowing, as at dusk | look.lit | 0 to 1, step 0.05 | 0.45 |
Weathering rain streaks, rising damp and tonal variation on the walls | look.weathering | 0 to 1, step 0.05 | 0.5 |
Moss moss on the roof, heavier on the shaded slope | look.moss | 0 to 1, step 0.05 | 0 |
Presets
| Parameter | cottage | farmhouse | townhouse | tower | barn |
|---|---|---|---|---|---|
| Width | 78 | 100 | 58 | 38 | 118 |
| Depth | 50 | 56 | 62 | 38 | 66 |
| Storeys | 1 | 2 | 3 | 4 | 2 |
| Storey height | 26 | 24 | 23 | 22 | 22 |
| Wall thickness | 3 | 3 | 3 | 3 | 3 |
| Plinth | 4 | 4 | 5 | 3 | 2 |
| Roof | gable | gable | flat | hip | gable |
| Roof pitch | 1 | 1 | 1 | 0.65 | 0.85 |
| Eaves | 3 | 3 | 0 | 2 | 2 |
| Chimneys | 1 | 2 | 1 | 0 | 0 |
| Window width | 9 | 9 | 8 | 5 | 6 |
| Window height | 11 | 11 | 13 | 10 | 6 |
| Window spacing | 21 | 21 | 15 | 14 | 26 |
| Window fill | 0.95 | 0.95 | 0.95 | 0.8 | 0.6 |
| Glazing bars | yes | yes | yes | no | no |
| Shutters | 0.7 | 0.2 | 0 | 0 | 0.5 |
| Flower boxes | 0.5 | 0.3 | 0.25 | 0 | 0 |
| Door width | 10 | 10 | 10 | 10 | 18 |
| Door hood | no | yes | yes | no | no |
| Gable windows | yes | yes | no | yes | yes |
| Walls | plaster | timber | brick | stone | timber |
| Roofing | thatch | tile | slate | slate | shingle |
| Relief | yes | yes | yes | yes | yes |
| Quoins | no | no | yes | yes | no |
| Spalling | 0.35 | 0 | 0 | 0 | 0 |
| Gutters | no | yes | no | no | yes |
| Lit windows | 0.3 | 0.3 | 0.45 | 0.2 | 0 |
| Weathering | 0.5 | 0.5 | 0.5 | 0.7 | 0.7 |
| Moss | 0.35 | 0.25 | 0 | 0.45 | 0.35 |
Roles
Voxel values are these roles, in this order (value 1 is the first). The colours are the defaults; a host maps each role to a palette slot and can restyle it.
- 1Wall
wall - 2Wall dark
wall.dark - 3Wall light
wall.light - 4Mortar
mortar - 5Exposed brick
brick.exposed - 6Stone trim
trim - 7Stone trim dark
trim.dark - 8Timber
beam - 9Glass
glass(glass) - 10Lit window
glass.lit(emit) - 11Window frame
frame - 12Door
door - 13Door panel
door.dark - 14Door handle
handle(metal) - 15Shutter
shutter - 16Shutter slat
shutter.dark - 17Roof
roof - 18Roof dark
roof.dark - 19Roof light
roof.light - 20Ridge
ridge - 21Chimney
chimney - 22Chimney dark
chimney.dark - 23Soot
soot - 24Chimney pot
pot - 25Foundation
foundation - 26Foundation dark
foundation.dark - 27Floor
floor - 28Moss
moss - 29Gutter
gutter(metal) - 30Flower
flower.a· may float when refined - 31Flower alt
flower.b· may float when refined - 32Leaf
leaf· may float when refined
See the API reference for generateBuilding and the parameter
types.