Authoring Procedural Façades with Shape Grammars
Procedural building generation in large-scale game development relies heavily on shape grammars to translate architectural theory into scalable, non-destructive 3D assets. By utilizing rule-based production systems within tools like SideFX Houdini or custom proprietary engines, technical artists define formal grammars that recursively subdivide building volumes into floors, bays, and individual architectural elements. This article examines the pipeline of how modular mesh kits are governed by shape grammar rules, detailing the subdivision logic, edge handling, context-aware variation, and downstream engine optimization required to populate expansive open-world environments.
Core Principles of Shape Grammars
Shape grammars operate on a system of production rules that iteratively replace geometric shapes with other shapes. In architectural asset authoring, the system uses two primary types of entities:
- Non-Terminal Shapes: Abstract geometric placeholders (such as building footprints, massing volumes, façade planes, and bay rectangles) that undergo further division or transformation.
- Terminal Shapes: The final, physical geometry—typically modular mesh components like windows, doors, cornices, and blank wall sections—that cannot be subdivided further.
The authoring pipeline begins with an initial shape (the building massing model) and evaluates an ordered set of rules until only terminal shapes remain.
Standardizing the Modular Asset Library
Before writing production rules, technical artists establish strict geometric and topological standards for the modular mesh library:
- Metric Grid Alignment: Assets are constructed to exact uniform dimensions (e.g., 3m or 4m bay widths, 3.5m floor heights) to prevent interpenetration or seam gaps during grammar substitutions.
- Normalized Pivots: All terminal assets share consistent origin points (often bottom-center or bottom-left of the bounding box) and uniform surface normal orientations.
- Semantic Metadata: Meshes contain metadata
specifying their architectural role (e.g.,
ground_floor,mid_floor,roof_trim,corner_left,corner_right) and stylistic compatibility tags.
Grammar Execution and Façade Subdivision
The conversion of raw building volumes into decorated architectural surfaces follows a deterministic hierarchical decomposition:
1. Volumetric Extraction and Face Normalization
The grammar identifies vertical exterior surfaces from input massing volumes by evaluating face normals against the world up-vector. Non-vertical faces are assigned to roof or ground grammar paths, while vertical faces are converted into oriented 2D façade planes.
2. Vertical Stratification (Floor Splitting)
A primary vertical split rule divides the façade plane along its local Y-axis into horizontal strips representing functional architectural tiers:
- Ground Tier: Accommodates higher clearance for entryways and storefronts.
- Intermediate Tiers: A repeat rule generates arbitrary numbers of identical or alternating standard residential/office floors.
- Attic/Roof Tier: Terminates the façade with friezes, cornices, or parapets.
3. Horizontal Bay Decomposition
Each horizontal floor strip is subdivided along its local X-axis. Because building footprints rarely match perfect multiples of modular mesh dimensions, technical artists implement dynamic sizing functions:
- Fixed-Width Splits: Edges and corners are assigned static, rigid dimensions.
- Flexible/Adaptive Splits: Intermediate wall bays use fractional expressions that stretch or compress within a defined tolerance, or dynamically adjust spacing through edge padding to avoid asset deformation.
4. Terminal Component Instantiation
Once the subdivision yields bay dimensions matching the modular library's target footprints, a terminal replacement rule swaps the abstract 2D bounds for 3D meshes.
Handling Corners and Non-Planar Topology
Corners present unique challenges in procedural generation due to overlapping geometry and varying angle conditions:
- Angle Classification: The grammar calculates the angle between adjacent façade planes. Angles are categorized into orthogonal (90-degree internal/external) or non-orthogonal conditions.
- Pre-Allocation Splits: Edge-padding rules execute prior to regular bay subdivision, cutting away specialized corner volumes so that standard wall rules only run on the remaining planar surface.
- Custom Corner Brackets: Dedicated corner meshes with baked angle offsets are placed into the pre-allocated volumes, sealing seams between intersecting walls.
Context Awareness and Variation
Large-scale environments require diversity without generating structural chaos. Technical artists maintain architectural coherence through controlled variation logic:
- Attribute Propagation: Properties defined at the
root building volume (e.g.,
wealth_level,architectural_style,damage_index) pass down to individual bays, restricting rule outcomes to specific sub-styles. - Stochastic Selection: Within a given style, terminal swaps utilize weighted probabilities (e.g., 85% standard window, 10% open window with curtains, 5% window with air conditioning unit).
- Adjacency and Occlusion Testing: Grammars cast ray queries against the scene to detect surrounding geometry. Bay spaces intersecting terrain, adjacent buildings, or infrastructure automatically switch to blank wall variants or service conduits rather than primary windows.
Engine Integration and Real-Time Optimization
Directly outputting raw individual meshes from thousands of shape grammar rules causes excessive draw calls that degrade rendering performance. To make grammar outputs viable for real-time game engines, the authoring pipeline implements structural data handoffs:
- Point Cloud Output: Instead of outputting dense polygon geometry, the grammar script outputs single points representing terminal locations, carrying transform matrices and asset ID string attributes.
- Hierarchical Instancing: The game engine ingests these point clouds to populate Hierarchical Instanced Static Mesh (HISM) components, consolidating thousands of modular pieces into single draw-call batches per material.
- Automated LOD and Proxy Generation: For distant rendering, the procedural graph branches into a secondary pass that generates a low-resolution envelope mesh with baked material projections, allowing the runtime engine to seamlessly swap between instanced modular components at close range and simplified shells at long range.