Semen Klenov

Home / Journal / 3D & CGI

Procedural Systems: a practical CGI guide

A generator is inputs → rules → modules → placement → variation → output.

CGIBy Semen Klenov26 November 2026

Procedural Systems: a practical CGI guide

A procedural system is more than a tool: it is a set of rules that produces many valid results. A city block, a forest, a shelf of products, a pattern of tiles, a stack of crates — a client asks for ten variations, and a system gives them in minutes. this article shows how to design such a system and walks through a building generator as a worked example.

Key points

  • A generator is inputs → rules → modules → placement → variation → output.
  • Lay out points first, check them with colors, and create real geometry only at the end.
  • A seed makes every random result reproducible.
  • Node graphs read left to right: points decide where, instances decide what.

Thinking in Rules

  • Input: What the user controls: a footprint curve, a height, a style, a seed.
  • Rules: Decisions based on data: “a ground floor gets a door”, “every third bay has a balcony”, “corners get a pillar”.
  • Modules: The small hand-made building blocks (a window, a door, a cornice) that the rules place.
  • Placement: Points with attributes (position, orientation, scale, module ID) where modules are copied.
  • Variation: A seed drives choices; the same seed gives the same result so a design can be reproduced and approved.
  • Output: Clean geometry with UVs, groups and material IDs ready for rendering.
  • Separation of concerns: Keep layout (where) separate from content (what). You can then change modules without changing layouts.

Worked Example: A Building Generator

  1. Footprint: A closed curve defines the plan. Resample it so edges are straight segments.
  2. Floors: Divide the height into floors; mark each floor level on the wall with an attribute floor_index.
  3. Bays: Divide each wall segment into bays of a target width; compute bay_count = round(length / bay_width) and adjust the bay width to fit exactly (no half windows).
  4. Rules: Assign a module ID per bay: ground floor = shop or door; upper floors = window; every N-th bay = balcony; wall ends = corner pillar; top floor = cornice. Use attributes and conditions.
  5. Instance: Copy modules to points. Orientation comes from the wall normal and the up vector.
  6. Variation: Randomize window types, colors and details with the seed; control randomness with sliders.
  7. Roof and details: Roof shapes, chimneys, antennas; optional damage and dirt.
  8. Output: Merge, assign groups per material, generate UVs, export or instance in the scene.

A minimal bay rule in VEX:

// run over points that sit at the center of each bay
int top = chi("floors") - 1;
int f = i@floor_index;
int b = i@bay_index;
if (f == 0)
    s@module = (b % 3 == 1) ? "door" : "shopfront";
else if (f == top)
    s@module = "cornice_window";
else if (b % chi("balcony_every") == 0)
    s@module = "balcony";
else
    s@module = "window";
  • Layout vs. geometry: Generate the layout as points first; check it visually with colors; create real geometry only at the end.
  • Real scale: Floor height, door height and window sill height are physical measurements; use reference.

Scattering and Distribution

  • Random scatter: Simple but clumpy and overlapping.
  • Relaxation / Poisson-disk: Points keep a minimum distance: natural-looking spacing (blue noise).
  • Density maps: A grayscale mask controls how many points appear where (grass thicker near a path).
  • Collision avoidance: Delete points too close to another object; or push them apart.
  • Alignment: Align instances to the surface normal, then add controlled random rotation around it.
  • Weighted variants: Choose module A 60 %, B 30 %, C 10 %.
  • Packing: Pack objects without overlap (shelves of bottles, coins, crates) via simulation or a packing algorithm.

Variation, Seeds and Control

  • Seed: One integer drives all randomness; keep it exposed.
  • Hash by identity: Use stable IDs (@ptnum, a position hash) so adding an element does not reshuffle everything.
  • Wedging: Render many seeds or parameter combinations automatically (TOPs, Wedge) and pick the best, like contact-sheet photography.
  • Constraint: Variation must stay inside style limits. A generator that produces ugly results 30 % of the time is worse than a manual model.
  • Art direction: Expose controls the art director understands (“more windows”, “older”) rather than internal numbers.

Procedural Materials and Surface Detail

  • Per-instance data: Pass random values and IDs to the shader so each instance has its own color or wear.
  • Procedural facade textures: Bricks, tiles and planks as procedural patterns or Substance Designer materials.
  • Wear from geometry: Edge masks and AO from the generated mesh feed the shader.
  • Proxies and render modes: A fast preview with boxes, and a full-detail render mode via packed primitives or instances.

In the tools

  • Houdini: Resample, PolyExtrude, Divide, Copy to Points, Attribute Wrangle, For-Each loops, Scatter and Align, Attribute Randomize, Labs Building Generator and Edit for manual adjustments, HDA to package; TOPs for batch generation.
  • Blender: Geometry Nodes: Curve to Mesh, Instance on Points, Pick Instance, Random Value, Realize Instances, Switch, Repeat Zone for loops.
  • Reference tools: CityEngine and other rule-based software use the same principle; the grammar idea transfers.

Common mistakes

  • Building real geometry before the layout works.
  • Modules that do not fit exact bay widths (cut windows).
  • A seed that reshuffles everything when one parameter changes.
  • Dozens of exposed parameters nobody understands.
  • Ignoring real scale.