# Coastal house — parametric Three.js model

A vanilla JavaScript ES-module conceptual model, revised September 30, 2026 against the supplied first- and second-floor architectural plan images and exterior construction photograph. No framework, textures, hosted services, or identifying property information. Export coordinates are **meters, +Y up, +X east, +Z south**. North/street is −Z, so the west garage appears on the right when viewed from the street.

## Enhanced edition

- Standing seams on every hip face, ridge/hip caps, downspouts, garage panel reveals, entry pull, sconces and porch light lenses.
- Individual driveway and pool-deck pavers, stepping stones, three schematic palms, low planting beds and a pool ladder. These are new visual assumptions, editable in `house.landscape` and `house.details`.
- Procedural environment reflections, a sunlight slider, slow orbit, labeled room plans, footprint dimension overlays and a slider that separates the floors and roofs.
- Mesh selection outlines with bounding-box dimensions, collapsible controls, and **Save image** for a PNG of the current 3D view. PNGs capture the rendered model, not the HTML room labels or control panel.
- This revision replaces the incorrect narrow garage with two side-by-side bays, aligns major room zones with the drawings, and preserves the private rear primary-suite balcony. Original source files remain archived separately.

The separated view is for inspection only. The GLB is always exported in its assembled position, without labels, dimension lines or viewer controls. Changing sunlight is a visual lighting study, not a geolocated solar calculation.

## Run

Requires Node.js 20 or later and npm. From this directory:

```sh
npm ci
npm start
```

Open **http://localhost:5173**. Use `PORT=5174 npm start` if that port is occupied. Serve the project over HTTP; opening `index.html` directly as a file will not load the modules reliably. Dependencies are pinned in `package-lock.json`; internet access is needed for the initial installation only.

```sh
npm run export  # rebuild house.glb and model-report.json
npm run check   # geometry checks, Khronos validator, and Three.js GLB re-import
```

The delivered GLB already exists. Import it using Blender's **File → Import → glTF 2.0**. It contains the complete model, independent of the viewer's current visibility settings. Viewer lighting and camera are intentionally separate from the exported asset.

## Viewer

- Drag to orbit; scroll to zoom; right-drag to pan.
- **R:** roof assemblies, standing seams and brackets.
- **1 / 2:** first / second ceiling assemblies.
- **U:** second-story walls, floor slab, fixtures and balcony. Hide this in addition to ceilings and roofs to see downstairs from above.
- **L:** lot, street, driveway and pool.
- **First-floor plan / Second-floor plan:** configure the cutaway and move overhead, north at the top.
- **Street / Rear:** move the camera without changing selected layers. **Reset** restores every layer and the street view.
- Click a surface to read its editable mesh name.

## Files

| File | Purpose |
|---|---|
| `house.js` | Single exported house design configuration, in feet, including editable room and facade schedules |
| `model.js` | Shared deterministic geometry builder and feet-to-meters conversion |
| `enhancements.js` | Named architectural details, paving and landscape geometry |
| `index.html`, `viewer.js` | Responsive viewer, OrbitControls, sun and sky lighting, shadows, layer controls and picking |
| `scripts/export.mjs` | Node-based binary GLTFExporter, with a small FileReader adapter |
| `scripts/check.mjs` | Named-mesh, numeric, size, validator and import checks |
| `scripts/serve.mjs` | Local HTTP server with no additional server dependencies |
| `house.glb` | Complete exported model |
| `model-report.json`, `validation-report.json` | Measured gross areas, file size and machine-readable validation |

## Configuration guide

All dimensions in `house.js` are feet; express inches as fractions, e.g. `39 + 10/12`. `buildHouse(customConfig)` accepts a complete alternative configuration. The plan is driven by coordinates, not an automatic space-planning system: when changing the footprint, also adjust room and facade schedules to fit. An out-of-bounds exterior opening raises an error.

| Config section | Controls |
|---|---|
| `footprint.width / depth` | Nominal exterior envelope, including entry projection and rear porch; excludes trim, eaves and railings |
| `site.width / depth` | Lot dimensions |
| `site.frontSetback / grade / streetDepth` | Front boundary relative to house origin, assumed ground datum and street representation |
| `site.drivewayWidth / pool / equipment` | Driveway width; pool width, length, rear gap and water level; equipment-pad dimensions |
| `heights.first / slab` | First finished floor datum and slab thickness |
| `heights.garageDrop / porchDrop` | Six-inch drops relative to the house floor |
| `heights.ceiling / floorToFloor / porchCeiling` | Story clear height, second-floor level and special porch soffit height |
| `walls.exterior / interior` | 8-inch exterior walls and 4-inch simple partitions |
| `garage` | Stepped external outline, plan-noted clear dimensions and area, two door positions, one-story portion and recess |
| `entry` | Bay position, 3-foot projection, covered depth, door, upper louvers and shade width |
| `porch` | Rear-east cutout width/depth and column size |
| `balcony` | Rear-west inset width/depth and rail height |
| `roof` | Pitch, overhang, seam spacing/height and bracket spacing; `thickness` is reserved for future solid roof construction |
| `trim` | Belt/cornice height and projection |
| `openings` | Default windows, frames, glass thickness, interior passage dimensions and sliders |
| `facades` | Named exterior opening schedules. `at` is an eastward or southward coordinate, `w/h/sill` are opening dimensions; `kind` can be window, slider or door |
| `stairs` | Position, width, complete run, riser count and landing depth |
| `fixtures` | Island and great-room tray positions/sizes; counter dimensions reserved for further detailing |
| `rooms.first / second` | Schematic rectangular room partitions: name, x/y, width/depth and door side |
| `details` | Paver size/joints, pool deck width, garage panel count, downspout radius and ridge cap width |
| `landscape` | Palm positions, sizes and frond count; shrub beds and landscape colors |
| `presentation` | Initial sunlight, maximum floor separation and room-label coordinates |
| `colors` | Flat stucco, trim, bronze metal, frames, glass, tile, wood, pavers, grass, water and concrete colors |
| `targets` | Supplied comparison areas; these do not stretch the model to force a match |

The builder derives slabs, porch, balcony and major roof extents from the massing configuration. Facade rhythms, fixture placements and construction-detail offsets use schematic defaults in the builder; editable exterior schedules in `facades` override the corresponding defaults. For a new facade, add a schedule keyed by its `wall.*` name.

## September 30 correction and source review

The supplied architectural images are included in `references/`. They take priority over the older text-only description for layout. The exterior construction photograph corroborates the two front garage bays and two upper entry windows. No architectural elevation sheets, roof framing plan, site survey, or CAD files were available. The model remains conceptual; no claim is made that it is an as-built tour.

- **Garage:** The first-floor drawing shows two 9-foot vehicle openings side by side, a 3-foot step between the front faces, 20′8″ clear width and depths of approximately 23 feet and 20 feet. Its note gives 476 SF. The former 42-foot tandem interpretation was wrong and has been removed. The model uses an approximate external outline of 21′10″ × 24′ with the stepped corner; this gross slab outline is 492.5 SF, not the plan's stated interior area.
- **First floor:** Office / optional bedroom remains at the front, with closet and adjacent full bath. Pantry and switchback stair are behind the garage. Kitchen, dining, great room and covered porch follow the drawing's major zones. This study does not certify the office as a legal bedroom.
- **Second floor:** The plan identifies Primary, Bedroom 3, Bedroom 4, Bedroom 5 / Playroom, and Bedroom 6. Those five upstairs rooms retain the drawing's labels. The model does not rename the downstairs office Bedroom 6.
- **Balcony:** One private rear-west balcony connects to the primary suite. There is no front-hall balcony. The plan notes 82 SF; the approximate model includes wall/perimeter thickness and must not be used to measure its net area.
- **Porch:** The former narrow porch approximation has been widened to the main plan division. The model's approximate gross outline is 235.5 SF; the source note is 235 SF.

## Remaining limitations and conflicts

1. **Area conventions:** The source notes are 1,606 SF first-floor air-conditioned area, 2,082 SF second-floor air-conditioned area, 476 SF garage, 235 SF porch, and 82 SF balcony. Approximate model outlines have different wall/void conventions. Do not quote model-computed gross areas as certified living areas or use them to change listing areas.
2. **Exact interior geometry:** Major rooms and circulation were reconciled visually to the raster plans. Some stepped room boundaries, closets, plumbing fixture positions, and stair details remain simplified. The 19-riser switchback stair is illustrative, not an engineered/code-checked staircase.
3. **Roof and elevations:** Hip pitch, intersections, eaves, bands, door heights and secondary window dimensions remain conceptual where no elevation dimensions were provided. The compound roofs use overlapping planes, not watertight engineered junctions. The street rendering preserves the source photograph's general composition, including the lower roof over one garage bay.
4. **Heights and site:** Prior assumed story heights, flat grade, setbacks, driveway, pool size/placement and landscape remain illustrative. No survey or verified pool/site plan was supplied. Cardinal orientation is the model's convention, not a surveyed bearing.
5. **Materials and interior previews:** Neutral model colors and symbolic fixtures do not specify final finishes. The new interior images are presentation previews; they are not used as dimensioned construction evidence. No address, completion date or availability is implied.

## Verification

Run `npm run export`, `npm run check`, and `npm run build`. The checks independently verify the two garage door openings, the stepped garage slab, plan-noted garage dimensions, five named upstairs sleeping zones, rear-primary balcony access, finite geometry, export contents, Khronos glTF validation, and GLB re-import. Desktop and mobile UI checks cover the plan views, layers, sunlight, floor separation, reset and GLB download. See the JSON reports for measured results. Blender itself is not tested.

All export coordinates remain meters, +Y up, +X east, +Z south. Existing viewer controls and relative `house.glb` download path are preserved. The corrected website embed will use `/models/coastal/index.html` on dougrichman.com. The older `coastal-house-3d-study.vercel.app` address remains unchanged because the current account cannot access its original Vercel scope.
