Documentation

Using the ProGen3D live site

This guide focuses on the actual site workflow: authoring grammars, managing private materials, planning camera movement, using the live viewer, and publishing pieces into the public gallery.

Quick start workflow

Create an account with your email address, verify it with the emailed 6-digit code, then open the editor and write a grammar into the input panel. Save drafts privately while you iterate. When a piece is ready, publish it to the gallery so it becomes browsable in the live viewer.

The PHP shell does not replace the original grammar runtime. It wraps the working modular editor so the same scene engine, SmartEditor, syntax highlighting, STL export, grid, axis widget, and orbit navigation remain available inside a proper site workflow.

  • Email-verified accounts with code-based confirmation
  • Login-protected editor and file storage
  • Public gallery for published grammars
  • Read-only public viewer pages
  • Copy-to-editor flow for remixing gallery work

Account and recovery

Registration now stores an email address and requires email verification before normal login is allowed. If an unverified user tries to sign in, the site resends a verification code and routes them back to the verification page.

The login screen also exposes a password reset flow. Users can request a 6-digit login code by username or email, choose a new password on the reset page, confirm it, and be logged in automatically after the reset succeeds.

  • 6-digit verification codes expire after 15 minutes
  • Password reset uses a separate emailed login code
  • Successful publish events send an admin notification email
  • New registrations also send an admin notification email

Grammar authoring tips

Keep operators readable, but spaces around brackets are optional. The parser accepts forms such as `Tower(h)` and `[T(0 1 0)Part]` as long as the token boundaries stay unambiguous. Expressions may also contain spaces, tabs, newlines, and carriage returns, so multiline math is valid inside transforms and conditionals.

Build from the simplest valid scene first. Start with a single instance, then add parameters, calls, transforms, grouped blocks, and conditionals one layer at a time. That makes scene debugging far easier than writing a large grammar and trying to reason about multiple changes at once.

Use grouped blocks when you want scoped deformation behavior. Local DS*/DT* state and global GDS*/GDT* subset state both clone on group entry and restore on exit.

  • Start from one visible primitive
  • Add transforms incrementally
  • Use brackets to compose multi-part scenes
  • Add parameters and conditional calls only after the base form renders correctly
  • Use GDS*/GDT* inside groups when you want several cubes to deform together without affecting the whole scene

Publishing and storage

This build now runs against Firebase-only storage at runtime. Firebase Auth signs users in, Firestore stores account and grammar metadata, and Cloud Storage stores the grammar source blobs.

Because the site keeps authored grammar text rather than only baked geometry, published works can be previewed, opened in the public viewer, or copied back into a private editor session for further iteration.

  • Firebase Auth for account sign-in and verification
  • Firestore for canonical user profiles and file metadata
  • Cloud Storage for grammar source blobs
  • Legacy JSON files remain offline migration input only
  • Runtime storage now lives outside the public web root

Materials and private texture slots

The Materials page adds a private texture workspace on top of the renderer. Each account gets 20 user texture slots, and every active slot stores both a human-readable label and a grammar-safe material name.

Use the grammar-safe material name directly inside instance calls, for example `I ( Cube moss_wall 1 )`. The older slot tokens such as `usertexture4` still work, but named materials are easier to read and maintain when a grammar grows beyond a quick test scene.

Uploads and AI-generated textures both flow through the same pipeline: the image is normalized to a 1024x1024 PNG, stored privately under your account, and then exposed to the editor and materials manager through that slot and material-name mapping.

  • 20 private user texture slots per account
  • Separate display label and grammar material name per slot
  • Direct grammar usage such as `I ( Cube moss_wall 1 )`
  • AI texture generation and manual uploads share the same normalized storage path
  • Texture records stay private to the signed-in account

Render settings page and WebGL2 rollout planning

The Render Settings page is the renderer-planning workbench for the WebGL2 upgrade. It exposes the live renderer capability probe, the current settings API surface, and a target draft for skybox, world-space lighting, shadows, and anti-aliasing.

Use it when you want a concrete implementation checklist and a copyable settings contract before those later pipeline passes are fully live.

  • Run a live preview scene against the shared browser renderer
  • Inspect capability blockers such as offscreen pass, cubemap, and shadow support
  • Keep a future scene settings draft for skybox, shadows, and AA while the passes are still being implemented

Video page and camera path authoring

The Video page is a camera-authoring surface built on the same browser renderer as the editor. Run grammar into the live scene, orbit or frame the view, capture that camera into timed shots, and preview the movement path before exporting it.

The page emits two outputs: a proposed cinema camera script and a JSON render-job contract. The script is intended as the future grammar surface for cinematic camera movement, while the JSON block is the cleaner machine-facing contract for a headless capture worker.

Shot timing is absolute. Each shot stores a name, a time on the timeline, an eye position, a target position, and an easing preset that drives interpolation into the next shot.

  • Capture current renderer framing into named timeline shots
  • Preview interpolated camera movement inside the live WebGL scene
  • Export a draft `cinema path_name { ... }` script
  • Export a structured headless render job for future automation
  • Use explicit eye and target coordinates for deterministic replay

Headless video rendering path

The current renderer is browser-first, so the practical video pipeline is headless Chromium plus Puppeteer frame stepping rather than a separate Node-only OpenGL port. That keeps authoring, preview, and final capture on the same rendering stack.

The intended automation flow is: open `video.php`, load the grammar and camera path, call `window.PG3DVideoPage.applyCameraAtTime(seconds)` for each frame time, capture the canvas output as PNG frames, then assemble the sequence with ffmpeg.

This means the Video page is already useful as an authoring and planning tool today, even before a full queue-driven video worker exists on the server.

  • Recommended driver: headless Chromium with Puppeteer
  • Deterministic frame stepping through `window.PG3DVideoPage.applyCameraAtTime(seconds)`
  • Canvas frame export first, ffmpeg assembly second
  • No need to fork the renderer into a separate headless graphics stack yet

Scene viewer controls

The integrated viewer uses the custom SVEC orbit style that was patched into the project. Drag to orbit, use the wheel to zoom, and use the fit/reset controls to reframe the current grammar output. The XZ grid and orientation axis widget are always visible inside the active scene viewer.

Published gallery pieces use the same viewer engine in read-only mode. That gives the live site a consistent visual language between authoring, browsing, and public presentation.

  • Drag to orbit
  • Ctrl-drag or secondary drag to pan
  • Wheel to zoom
  • Fit View and Reset View for framing
Design vocabulary

Structural archetypes reference

These archetypes turn common structural patterns into reusable ProGen3D motif families. Each motif is axis-aware, parameterized, and designed to compose cleanly with transforms, symmetry, recursion, and material presets.

Conventions

  • Axis mapping: 0 = X, 1 = Y, 2 = Z.
  • Shared variables usually include N (count), R (radius), H (levels), step (spacing), taper, twist, depth, primitive, and material.
  • The pseudocode below is template-oriented rather than strict final parser syntax, so it can guide implementation, prompts, and copy-ready examples.
Archetype family

Foundational motifs

These are the core arrangement logics. Most higher-order motifs can be built from this layer.

Spokes

Instances radiate around a central axis at equal angular intervals.

N:int R:float axis:int elementScale:float jitterAngle:float primitive:symbol material:symbol
Typical uses
  • hubs
  • antennas
  • petals
  • radial bracing
  • canopies
Grammar-template pseudocode
Spokes(N R axis elementScale jitterAngle primitive material) 1 ->
    SpokesIter(0 N R axis elementScale jitterAngle primitive material)

SpokesIter(i N R axis elementScale jitterAngle primitive material) ?(i < int(N)) ->
    [
        RotateAroundAxis(axis, 360*i/N + Rand(-jitterAngle,jitterAngle))
        TranslateRadial(axis, R)
        OrientRadially(axis, 360*i/N)
        S(elementScale elementScale elementScale)
        I(primitive material 1)
    ]
    SpokesIter(i+1 N R axis elementScale jitterAngle primitive material)

Ring

A closed loop of repeated instances arranged around an axis.

N:int R:float axis:int thickness:float primitive:symbol material:symbol
Typical uses
  • collars
  • wheels
  • stadium edges
  • circular tiers
  • mechanical loops
Grammar-template pseudocode
Ring(N R axis thickness primitive material) 1 ->
    RingSeg(0 N R axis thickness primitive material)

RingSeg(i N R axis thickness primitive material) ?(i < int(N)) ->
    [
        RotateAroundAxis(axis, 360*i/N)
        TranslateRadial(axis, R)
        OrientRadially(axis, 360*i/N)
        S(thickness thickness thickness)
        I(primitive material 1)
    ]
    RingSeg(i+1 N R axis thickness primitive material)

Band

A linear sequence of repeated instances distributed along a span.

N:int span:float axis:int taper:float primitive:symbol material:symbol
Typical uses
  • facades
  • decks
  • ribs
  • beams
  • tracks
Grammar-template pseudocode
Band(N span axis taper primitive material) 1 ->
    BandSeg(0 N span axis taper primitive material)

BandSeg(i N span axis taper primitive material) ?(i < int(N)) ->
    [
        t F(i N) InvLerp(i,N)
        s F(t taper) Lerp(1,taper,t)
        TranslateAlongAxis(axis, -span*0.5 + span*t)
        S(s s s)
        I(primitive material 1)
    ]
    BandSeg(i+1 N span axis taper primitive material)

Stack

Repeating instances ascending along an axis.

H:int step:float axis:int taper:float twist:float primitive:symbol material:symbol
Typical uses
  • towers
  • pagodas
  • pillars
  • segmented masts
Grammar-template pseudocode
Stack(H step axis taper twist primitive material) 1 ->
    StackLevel(0 H step axis taper twist primitive material)

StackLevel(i H step axis taper twist primitive material) ?(i < int(H)) ->
    [
        t F(i H) InvLerp(i,H)
        s F(t taper) Lerp(1,taper,t)
        TranslateAlongAxis(axis, i*step)
        RotateAroundAxis(axis, i*twist)
        S(s s s)
        I(primitive material 1)
    ]
    StackLevel(i+1 H step axis taper twist primitive material)

Grid

A 2D lattice of repeated elements on a plane.

Gx:int Gy:int cellSpanX:float cellSpanY:float planeAxis:int primitive:symbol material:symbol
Typical uses
  • floors
  • facades
  • shelving
  • structural lattice fields
Grammar-template pseudocode
Grid(Gx Gy cellSpanX cellSpanY planeAxis primitive material) 1 ->
    GridRow(0 Gx Gy cellSpanX cellSpanY planeAxis primitive material)

GridRow(ix Gx Gy cellSpanX cellSpanY planeAxis primitive material) ?(ix < int(Gx)) ->
    GridCol(ix 0 Gx Gy cellSpanX cellSpanY planeAxis primitive material)
    GridRow(ix+1 Gx Gy cellSpanX cellSpanY planeAxis primitive material)

GridCol(ix iy Gx Gy cellSpanX cellSpanY planeAxis primitive material) ?(iy < int(Gy)) ->
    [
        PlaneTranslate(planeAxis, (ix-(Gx-1)/2)*cellSpanX, (iy-(Gy-1)/2)*cellSpanY)
        I(primitive material 1)
    ]
    GridCol(ix iy+1 Gx Gy cellSpanX cellSpanY planeAxis primitive material)
Archetype family

Derived and compound motifs

These motifs combine or deform foundational patterns into richer structural families.

RingStack

Multiple rings stacked along an axis with optional scale ramping.

rings:int perRingN:int R:float ringStep:float axis:int scaleRamp:float primitive:symbol material:symbol
Typical uses
  • turbine cages
  • amphitheaters
  • ring towers
  • canopies
Grammar-template pseudocode
RingStack(rings perRingN R ringStep axis scaleRamp primitive material) 1 ->
    RingStackIter(0 rings perRingN R ringStep axis scaleRamp primitive material)

RingStackIter(i rings perRingN R ringStep axis scaleRamp primitive material) ?(i < int(rings)) ->
    [
        t F(i rings) InvLerp(i,rings)
        s F(t scaleRamp) Lerp(1,scaleRamp,t)
        TranslateAlongAxis(axis, i*ringStep)
        S(s s s)
        Ring(perRingN R axis 1 primitive material)
    ]
    RingStackIter(i+1 rings perRingN R ringStep axis scaleRamp primitive material)

Spiral

A helical band winding around an axis with pitch and radius control.

N:int turns:float pitch:float R0:float dR:float axis:int primitive:symbol material:symbol
Typical uses
  • stairs
  • ramps
  • helix towers
  • DNA-like structures
Grammar-template pseudocode
Spiral(N turns pitch R0 dR axis primitive material) 1 ->
    SpiralSeg(0 N turns pitch R0 dR axis primitive material)

SpiralSeg(i N turns pitch R0 dR axis primitive material) ?(i < int(N)) ->
    [
        t F(i N) InvLerp(i,N)
        ang F(t turns) 360*turns*t
        r F(t R0 dR) R0 + dR*t
        RotateAroundAxis(axis, ang)
        TranslateRadial(axis, r)
        TranslateAlongAxis(axis, pitch*turns*t)
        OrientRadially(axis, ang)
        I(primitive material 1)
    ]
    SpiralSeg(i+1 N turns pitch R0 dR axis primitive material)

Fork

A branching motif that splits a line or stack into multiple offspring.

depth:int branching:int splitAngle:float step:float childScale:float axis:int primitive:symbol material:symbol
Typical uses
  • trees
  • branching frames
  • vascular systems
  • support bifurcations
Grammar-template pseudocode
Fork(depth branching splitAngle step childScale axis primitive material) 1 ->
    ForkNode(depth branching splitAngle step childScale axis primitive material)

ForkNode(depth branching splitAngle step childScale axis primitive material) 1 ->
    [ I(primitive material 1) ]
    ?(depth > 0) ForkChildren(depth branching splitAngle step childScale axis primitive material)

ForkChildren(depth branching splitAngle step childScale axis primitive material) 1 ->
    ForkBranch(0 depth branching splitAngle step childScale axis primitive material)

ForkBranch(i depth branching splitAngle step childScale axis primitive material) ?(i < int(branching)) ->
    [
        RotateAroundPerpAxes(axis, SpreadAngle(i,branching,splitAngle))
        TranslateAlongAxis(axis, step)
        S(childScale childScale childScale)
        ForkNode(depth-1 branching splitAngle step childScale axis primitive material)
    ]
    ForkBranch(i+1 depth branching splitAngle step childScale axis primitive material)

RadialGrid

A polar lattice made from concentric rings crossed by spokes.

ringCount:int spokesCount:int ringSpacing:float axis:int primitive:symbol material:symbol
Typical uses
  • plazas
  • stadium plans
  • solar layouts
  • radial truss networks
Grammar-template pseudocode
RadialGrid(ringCount spokesCount ringSpacing axis primitive material) 1 ->
    [ Spokes(spokesCount ringCount*ringSpacing axis 1 0 primitive material) ]
    RadialRingIter(1 ringCount spokesCount ringSpacing axis primitive material)

RadialRingIter(i ringCount spokesCount ringSpacing axis primitive material) ?(i <= int(ringCount)) ->
    [ Ring(spokesCount i*ringSpacing axis 1 primitive material) ]
    RadialRingIter(i+1 ringCount spokesCount ringSpacing axis primitive material)

Ribbon

A band sampled along a curve or spline, suitable for skins and bridges.

N:int thickness:float twist:float curveFn:symbol axis:int primitive:symbol material:symbol
Typical uses
  • bridges
  • skins
  • ornament
  • aerodynamic strips
Grammar-template pseudocode
Ribbon(N thickness twist curveFn axis primitive material) 1 ->
    RibbonSeg(0 N thickness twist curveFn axis primitive material)

RibbonSeg(i N thickness twist curveFn axis primitive material) ?(i < int(N)) ->
    [
        t F(i N) InvLerp(i,N)
        CurveSample(curveFn, t)
        CurveOrient(curveFn, t, axis)
        RotateAroundLocalTangent(twist*t)
        S(thickness thickness thickness)
        I(primitive material 1)
    ]
    RibbonSeg(i+1 N thickness twist curveFn axis primitive material)
Archetype family

Architectural and system motifs

These motifs encode built-form intent on top of the simpler arrangement families.

TerracedStack

A stepped stack with progressive setbacks and shrinkage.

floors:int floorHeight:float shrinkFactor:float axis:int primitive:symbol material:symbol
Typical uses
  • ziggurats
  • setback towers
  • layered massing studies
Grammar-template pseudocode
TerracedStack(floors floorHeight shrinkFactor axis primitive material) 1 ->
    TerraceLevel(0 floors floorHeight shrinkFactor axis primitive material)

TerraceLevel(i floors floorHeight shrinkFactor axis primitive material) ?(i < int(floors)) ->
    [
        s F(i shrinkFactor) pow(shrinkFactor,i)
        TranslateAlongAxis(axis, i*floorHeight)
        S(s 1 s)
        I(primitive material 1)
    ]
    TerraceLevel(i+1 floors floorHeight shrinkFactor axis primitive material)

FaçadeBandGrid

A facade system combining horizontal bands and a vertical grid of panels or mullions.

rows:int cols:int rowStep:float colStep:float mullionThick:float panelScale:float planeAxis:int panelPrimitive:symbol mullionPrimitive:symbol material:symbol
Typical uses
  • curtain walls
  • window rows
  • facade studies
  • modular wall systems
Grammar-template pseudocode
FacadeBandGrid(rows cols rowStep colStep mullionThick panelScale planeAxis panelPrimitive mullionPrimitive material) 1 ->
    [ Grid(cols rows colStep rowStep planeAxis panelPrimitive material) ]
    [ FacadeMullions(rows cols rowStep colStep mullionThick planeAxis mullionPrimitive material) ]

VaultedRingGrid

A ring or grid field with an arch lift or vault deformation.

span:float archHeight:float N:int axis:int mode:symbol primitive:symbol material:symbol
Typical uses
  • halls
  • canopies
  • arched roofs
  • vaulted pavilions
Grammar-template pseudocode
VaultedRingGrid(span archHeight N axis mode primitive material) 1 ->
    ?(mode==ring) VaultedRing(span archHeight N axis primitive material) : VaultedGrid(span archHeight N axis primitive material)

RadialCanopy

Spokes and rings bent upward toward a canopy profile.

spokes:int rings:int radius:float ringStep:float curvature:float axis:int primitive:symbol material:symbol
Typical uses
  • umbrella forms
  • pavilions
  • roof canopies
  • radial shelters
Grammar-template pseudocode
RadialCanopy(spokes rings radius ringStep curvature axis primitive material) 1 ->
    CanopyRing(0 rings spokes radius ringStep curvature axis primitive material)

CanopyRing(i rings spokes radius ringStep curvature axis primitive material) ?(i < int(rings)) ->
    [
        t F(i rings) InvLerp(i,rings)
        lift F(t curvature) curvature*t*t
        TranslateAlongAxis(axis, lift)
        Ring(spokes radius*(t+1/rings) axis 1 primitive material)
    ]
    CanopyRing(i+1 rings spokes radius ringStep curvature axis primitive material)
Archetype family

Fractal and recursive motifs

These motifs add repetition across depth, ornament, and growth patterns. They should always be bounded by depth and scale damping.

RecursiveRing

A ring in which each element emits a smaller child ring.

depth:int N:int R:float childScale:float axis:int primitive:symbol material:symbol
Typical uses
  • filigree
  • ornaments
  • recursive frames
  • decorative lattices
Grammar-template pseudocode
RecursiveRing(depth N R childScale axis primitive material) 1 ->
    RecursiveRingNode(depth N R childScale axis primitive material)

RecursiveRingNode(depth N R childScale axis primitive material) 1 ->
    [ Ring(N R axis 1 primitive material) ]
    ?(depth > 0) RecursiveRingChildren(0 depth N R childScale axis primitive material)

RecursiveRingChildren(i depth N R childScale axis primitive material) ?(i < int(N)) ->
    [
        RotateAroundAxis(axis, 360*i/N)
        TranslateRadial(axis, R)
        S(childScale childScale childScale)
        RecursiveRingNode(depth-1 N R*childScale childScale axis primitive material)
    ]
    RecursiveRingChildren(i+1 depth N R childScale axis primitive material)

L-system Hybrid

An L-system path mapped to repeated ProGen3D instances.

axiom:string rules:symbol iterations:int segScale:float turnAngle:float axis:int primitive:symbol material:symbol
Typical uses
  • botanical structures
  • branching ornament
  • recursive skeletal systems
  • procedural vines
Grammar-template pseudocode
LSystemHybrid(axiom rules iterations segScale turnAngle axis primitive material) 1 ->
    seq F(axiom rules iterations) ExpandLSystem(axiom,rules,iterations)
    InterpretLSystem(seq segScale turnAngle axis primitive material)
Archetype family

Symmetry, modulation, and composition

These controls adapt any motif family and are especially useful when composing architectural systems from smaller parts.

Mirror / Dihedral controls

Attach symmetry logic to any motif to create bilateral, radial, or paired-lobe structure without rewriting the base rule.

mirrorX:int mirrorY:int mirrorZ:int lobes:int axis:int
Typical uses
  • paired canopies
  • bilateral frames
  • dihedral lobes
  • symmetry studies
Grammar-template pseudocode
MirrorX(rule) -> [ Mx ] rule
MirrorY(rule) -> [ My ] rule
MirrorZ(rule) -> [ Mz ] rule

Dihedral(rule axis lobes) ->
    DihedralIter(0 lobes rule axis)

DihedralIter(i lobes rule axis) ?(i < int(lobes)) ->
    [ RotateAroundAxis(axis, 360*i/lobes) rule ]
    [ RotateAroundAxis(axis, 360*i/lobes + 180/lobes) MirrorPerpToAxis(axis) rule ]
    DihedralIter(i+1 lobes rule axis)

Example compositions

Use one foundational motif as the primary structure, then layer one or two supporting motifs for system-level results.

primaryArchetype:symbol secondaryArchetype:symbol axis:int taper:float twist:float
Typical uses
  • tower pavilion
  • bridge
  • stadium
  • hybrid systems
Grammar-template pseudocode
TowerPavilion(axis) 1 ->
    [ Stack(12 1.2 axis 0.92 4 Column stone) ]
    [ TranslateAlongAxis(axis, 14.4) RingStack(4 18 4.0 0.7 axis 0.94 Beam brushedAluminum) ]
    [ TranslateAlongAxis(axis, 14.4) RadialCanopy(12 4 3.8 0.6 2.0 axis Rib clearGlass) ]

Bridge(axis) 1 ->
    [ Band(24 18 axis 1 Deck smoothConcrete) ]
    [ VaultedRingGrid(18 4 14 axis ring Arch shinySteel) ]
    [ Grid(18 4 1.0 1.2 2 Truss brushedAluminum) ]