Skip to content

San Francisco Building Template Pipeline #266

Description

@nigel-hall-codes

Captured from design doc: San Francisco Building Template Pipeline — Final Design Document (v1) (~/Downloads/San Francisco Building Template Pipeline.pdf).

Objective

A complete asset-authoring pipeline where architectural pieces are authored on an iPad and automatically integrated into a procedural San Francisco city generator in Unity. The goal is not to model every building — it's a growing reusable architectural library that generates thousands of believable SF buildings.

Built around: OSM building footprints · low-poly architecture · reusable facade components · AI-generated signage/storefront graphics · neighborhood-aware procedural generation · building-specific overrides for important locations.

Core architecture (data flow)

OSM Data → Unity Building Importer → Building Classification → Procedural Generator → Generated City
                                                  ↑
                                       Home PC Asset Server
                                                  ↑
                                          iPad Editor

Major components

  1. iPad Editor — primary authoring tool (not a city generator). Browse buildings, load footprints/templates, view 3D, import screenshots, trace facade elements, create meshes, assign material roles, generate AI signs, create placement rules, save back to home PC.
  2. Home PC Asset Server — central source of truth. FastAPI / Python / SQLite or Postgres / local asset storage / optional Blender. Handles asset storage, versioning, building metadata, template management, AI generation requests, Unity exports, neighborhood definitions, material palettes.
  3. Unity Import Pipeline — assembly + runtime generation. Import templates/meshes/metadata, generate prefabs, create ScriptableObjects, build procedural buildings, generate final city.

Asset categories

  • Building Parts (reusable geometry): window, door, garage door, bay window, storefront, awning, stairs, balcony, fire escape, roof trim, cornice, vent, utility box, chimney.
  • Sign Assets: store signs, window decals, billboards, posters, murals, menus, street advertising.
  • Building Templates (architectural styles): Sunset Single Family, Sunset Row House, Mission Mixed Use, Mission Corner Store, Richmond Apartment, Marina Bay Window House, SOMA Warehouse, Financial District Midrise.
  • Building-Specific Designs (non-procedural, important buildings): unique corner store, recognizable restaurant, landmark building, special event location, Mission Street hero building.

Key subsystems

  • Geometry authoring: vertex/polygon/rectangle/line/extrude/mirror/duplicate/snap tools. Output glTF / GLB. Real-world scale in meters (door 2.1m, floor 3.0m, garage 2.4–3.0m); calibration by selecting two points + entering real distance.
  • Material system: iPad assigns roles (Base, Accent 1, Accent 2, Glass, Metal, Sign) — never final colors. Unity chooses final colors via neighborhood palettes (e.g. Sunset = warm beige/cream/muted yellow/soft gray; Mission = colorful/bold/high contrast; Financial District = glass/steel/dark gray/concrete), randomized within neighborhood constraints.
  • AI Sign Generator: integrated in iPad editor (UI only). Inputs: business type, neighborhood, sign text, aspect ratio, style preset. Output PNG + metadata + thumbnail, reusable. Backend abstracts providers (ChatGPT image gen, Nano Banana, future). iPad never talks to AI directly — only the home PC server does.
  • Placement system (3 modes): (1) Exact Layout — precise placement/dims/orientation, reproduced exactly; (2) Procedural Rule — zones, probabilities, repeat behavior, constraints, adapts to building dims; (3) Building-Specific — keyed by OSM building ID + footprint hash, applied only to that building.
  • Placement metadata per object: part type, facade, floor, normalized position (0.0 left / 0.5 center / 1.0 right), scale, rotation, material roles, placement mode, randomization rules.
  • Building classification: neighborhood, building type, footprint shape, width, depth, height, floor count → determines compatible templates.
  • Template selection: Unity searches compatible templates/windows/doors/signs/roof elements, then assembles.

API & Unity structure

Home PC API: GET /neighborhoods, GET /building-types, GET /templates, GET /parts, POST /parts, POST /templates, POST /building-specific, POST /ai/signs/generate, POST /export/unity.

Unity: Assets/SFBuildingTemplates/{Parts,Signs,BuildingStyles,Materials,GeneratedPrefabs,BuildingSpecific}/.

Procedural generation order: create mass → apply roof → place doors → garages → windows → bay windows → storefronts → signs → apply palette → finalize prefab.

MVP scope

Minimal end-to-end loop: Load OSM building → import screenshot → trace window → assign material roles → save GLB → upload to API → import into Unity → place window on building. Then expand to doors, garages, bay windows, storefronts, signs, roof elements, procedural rules, neighborhood templates.

Future phases

  • Phase 2: perspective correction, auto UV generation, material painting, version history, Google Drive backup, asset review system.
  • Phase 3: AI-assisted facade recognition, screenshot feature/window/storefront detection, template suggestions.
  • Phase 4: one-click building style extraction, neighborhood training sets, procedural rule learning, semi-automatic template creation.

Philosophy: create a small number of high-quality reusable architectural pieces and let Unity generate thousands of believable San Francisco buildings from them.

Captured via /sdlc capture. Next: /sdlc work #N (sysdesign → drafting).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions