voxolith

Buildings

@voxolith/gen-building: cottages, farmhouses, townhouses, towers and barns from a shape grammar, with textured walls, furnished openings and coursed roofs.

The five building presets: cottage, farmhouse, townhouse, tower and barn

@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 +z

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

Close-ups of each preset's front door, windows and wall texture

Presets

presetwalls and roofshape
cottageplaster, thatchone storey, gable, one chimney, shutters and flower boxes
farmhousetimber frame, tiletwo storeys, two chimneys, gutters, a door hood
townhousebrick with quoins, flat roof behind a corniced parapetthree storeys, tall narrow windows
towerstone with quoins, slatefour storeys on a small square footprint, a steep hip roof
barntimber frame, shingletwo 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

ParameterPathRangeDefault
Width
length of the front wall in voxels (10 per metre); the ridge runs along the longer side
shape.width24 to 14078
Depth
length of the side walls in voxels, front to back
shape.depth24 to 12050
Storeys
number of floors below the roof
shape.storeys1 to 51
Storey height
floor-to-floor height in voxels, including the slab
shape.storeyHeight18 to 3226
Wall thickness
thickness of the outer walls in voxels
shape.wallThickness2 to 43
Plinth
height of the stone plinth the walls stand on, in voxels; the front door is reached by steps
shape.plinth0 to 84

Roof

ParameterPathRangeDefault
Roof
gable has two slopes and end gables, hip slopes on all four sides, flat is a parapet roof
shape.roofgable, hip, flatgable
Roof pitch
run per rise: 1 is 45°
shape.roofPitch0.5 to 2.5, step 0.051
Eaves
how far the eaves stand out past the walls, in voxels; gutters need at least 2
shape.overhang0 to 63
Chimneys
number of brick chimney stacks on the roof
shape.chimneys0 to 31

Openings

ParameterPathRangeDefault
Window width
window opening width in voxels
openings.windowWidth3 to 139
Window height
window opening height in voxels
openings.windowHeight4 to 1611
Window spacing
distance between neighbouring windows along a wall, in voxels; higher gives fewer windows
openings.windowSpacing10 to 3621
Window fill
fraction of window positions actually cut; the rest stay blank wall
openings.windowFraction0 to 1, step 0.050.95
Glazing bars
divide each window into panes
openings.glazingBarsyes / noyes
Shutters
fraction of windows with a pair of shutters
openings.shutters0 to 1, step 0.050.7
Flower boxes
fraction of windows with a flower box under the sill
openings.flowerBoxes0 to 1, step 0.050.5
Door width
14 and over is a pair of boarded barn doors
openings.doorWidth6 to 2210
Door hood
a small hood on brackets over the front door
openings.doorHoodyes / nono
Gable windows
windows in the attic gable ends (gable roofs only)
openings.gableWindowsyes / noyes

Look

ParameterPathRangeDefault
Walls
wall material and its texture: plaster, brick, stone or timber framing
look.wallplaster, brick, stone, timberplaster
Roofing
roof covering: tile, slate, thatch or shingle
look.roofStyletile, slate, thatch, shinglethatch
Relief
recessed joints and proud trim
look.reliefyes / noyes
Quoins
dressed stone corner quoins and storey bands
look.quoinsyes / nono
Spalling
plaster fallen away to show brick
look.spalling0 to 1, step 0.050.35
Gutters
gutters and downpipes along the eaves (needs eaves of 2 or more, not on thatch)
look.guttersyes / nono
Lit windows
fraction of windows glowing, as at dusk
look.lit0 to 1, step 0.050.3
Weathering
rain streaks, rising damp and tonal variation on the walls
look.weathering0 to 1, step 0.050.5
Moss
moss on the roof, heavier on the shaded slope
look.moss0 to 1, step 0.050.35

Presets

Parametercottagefarmhousetownhousetowerbarn
Width781005838118
Depth5056623866
Storeys12342
Storey height2624232222
Wall thickness33333
Plinth44532
Roofgablegableflathipgable
Roof pitch1110.650.85
Eaves33022
Chimneys12100
Window width99856
Window height111113106
Window spacing2121151426
Window fill0.950.950.950.80.6
Glazing barsyesyesyesnono
Shutters0.70.2000.5
Flower boxes0.50.30.2500
Door width1010101018
Door hoodnoyesyesnono
Gable windowsyesyesnoyesyes
Wallsplastertimberbrickstonetimber
Roofingthatchtileslateslateshingle
Reliefyesyesyesyesyes
Quoinsnonoyesyesno
Spalling0.350000
Guttersnoyesnonoyes
Lit windows0.30.30.450.20
Weathering0.50.50.50.70.7
Moss0.350.2500.450.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

ParameterPathRangeDefault
Width
length of the front wall in voxels (10 per metre); the ridge runs along the longer side
shape.width24 to 14058
Depth
length of the side walls in voxels, front to back
shape.depth24 to 12062
Storeys
number of floors below the roof
shape.storeys1 to 53
Storey height
floor-to-floor height in voxels, including the slab
shape.storeyHeight18 to 3223
Wall thickness
thickness of the outer walls in voxels
shape.wallThickness2 to 43
Plinth
height of the stone plinth the walls stand on, in voxels; the front door is reached by steps
shape.plinth0 to 85

Roof

ParameterPathRangeDefault
Roof
gable has two slopes and end gables, hip slopes on all four sides, flat is a parapet roof
shape.roofgable, hip, flatflat
Roof pitch
run per rise: 1 is 45°
shape.roofPitch0.5 to 2.5, step 0.051
Eaves
how far the eaves stand out past the walls, in voxels; gutters need at least 2
shape.overhang0 to 60
Chimneys
number of brick chimney stacks on the roof
shape.chimneys0 to 31

Openings

ParameterPathRangeDefault
Window width
window opening width in voxels
openings.windowWidth3 to 138
Window height
window opening height in voxels
openings.windowHeight4 to 1613
Window spacing
distance between neighbouring windows along a wall, in voxels; higher gives fewer windows
openings.windowSpacing10 to 3615
Window fill
fraction of window positions actually cut; the rest stay blank wall
openings.windowFraction0 to 1, step 0.050.95
Glazing bars
divide each window into panes
openings.glazingBarsyes / noyes
Shutters
fraction of windows with a pair of shutters
openings.shutters0 to 1, step 0.050
Flower boxes
fraction of windows with a flower box under the sill
openings.flowerBoxes0 to 1, step 0.050.25
Door width
14 and over is a pair of boarded barn doors
openings.doorWidth6 to 2210
Door hood
a small hood on brackets over the front door
openings.doorHoodyes / noyes
Gable windows
windows in the attic gable ends (gable roofs only)
openings.gableWindowsyes / nono

Look

ParameterPathRangeDefault
Walls
wall material and its texture: plaster, brick, stone or timber framing
look.wallplaster, brick, stone, timberbrick
Roofing
roof covering: tile, slate, thatch or shingle
look.roofStyletile, slate, thatch, shingleslate
Relief
recessed joints and proud trim
look.reliefyes / noyes
Quoins
dressed stone corner quoins and storey bands
look.quoinsyes / noyes
Spalling
plaster fallen away to show brick
look.spalling0 to 1, step 0.050
Gutters
gutters and downpipes along the eaves (needs eaves of 2 or more, not on thatch)
look.guttersyes / nono
Lit windows
fraction of windows glowing, as at dusk
look.lit0 to 1, step 0.050.45
Weathering
rain streaks, rising damp and tonal variation on the walls
look.weathering0 to 1, step 0.050.5
Moss
moss on the roof, heavier on the shaded slope
look.moss0 to 1, step 0.050

Presets

Parametercottagefarmhousetownhousetowerbarn
Width781005838118
Depth5056623866
Storeys12342
Storey height2624232222
Wall thickness33333
Plinth44532
Roofgablegableflathipgable
Roof pitch1110.650.85
Eaves33022
Chimneys12100
Window width99856
Window height111113106
Window spacing2121151426
Window fill0.950.950.950.80.6
Glazing barsyesyesyesnono
Shutters0.70.2000.5
Flower boxes0.50.30.2500
Door width1010101018
Door hoodnoyesyesnono
Gable windowsyesyesnoyesyes
Wallsplastertimberbrickstonetimber
Roofingthatchtileslateslateshingle
Reliefyesyesyesyesyes
Quoinsnonoyesyesno
Spalling0.350000
Guttersnoyesnonoyes
Lit windows0.30.30.450.20
Weathering0.50.50.50.70.7
Moss0.350.2500.450.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.

On this page