# Architecture and shading research — revision 2

Inspected 17 October 2026. Brief: retain the Thai four-stop boat story and Three.js 0.180.0 / WebGL2; improve physically informed water/light and low-polygon architectural massing. All geometry remains an interpretation, not a survey.

## Research questions and stopping criteria

1. Which visible details distinguish this canal-market setting? Stop when directly inspected government/operator images establish useful structural layers, boat construction and material families. Do not infer exact dimensions, ownership or current conditions from photos.
2. Which reflection/light pipeline works in the pinned Three.js version? Inspect release-matched source and official rendering references; stop when API, color-space, clipping, shadow and disposal behavior are understood.
3. Which choices remain assumptions? Record palette, dimensions, weather, roughness, wind, turbidity, water depth proxy, sun position and terrain layers separately. No water chemistry, bathymetry or real-world lighting measurements are claimed.

## Inspected sources and findings

### V1 — ONEP cultural-environment record: ชุมชนตลาดน้ำดำเนินสะดวก
https://culturalenvi.onep.go.th/site/detail/3636

Government record, page says last edited 2021-08-23. Browser inspection recovered the dynamic text that the text fetch missed: a community in the canal-market area, wooden row-shop buildings along both banks. Its description refers to the older community around the Ratchaburi canal mouth/หลักแปด. It is contextual architectural evidence, not proof of the precise footprint of current Ton Khem shops.

Inspected gallery image directly:
https://culturalenvi.onep.go.th/storage/pictures/2021/8/23/PmAF4WswGXMD5imlcxcQNNXpIoiUTQgAFxRApvDL.jpg

View: oblique view along the narrow market canal. Visible: layered sloping/corrugated roof sheets, deep shaded eaves, repeated exposed timber posts and braces, merchandise packed under the overhangs, umbrellas above boats, exposed inner boat ribs, dark water broken by ripples and reflections. Another gallery thumbnail shows a raised waterside frontage, rail, stairs and planted pots. File path and edit date do not establish capture date; photographer/capture date not stated. Rights not established for redistribution: use observations only; do not package photo or use it as texture.

Model consequence: varied roof modules and lean-to canopies, timber bays, beam/rafter layers, low-poly baskets, crates, folded shutters, pots and umbrellas. Avoid a repetitive row of identical tiled gables. Apply contextual form language while retaining explicit illustrative layout.

### V2 — Floating Market Thai, boat operator
https://floatingmarketthai.com/en/floating-market-damnoen-saduak/

Primary operator site; publication and photo capture dates unknown. Inspected hero and boat-type photo cards in browser. Two visible oblique boat views show long narrow timber hulls, cross benches, internal ribs, timber finish, and a long low cloth canopy on slender supports for the motorboat. Water varies between dark green-grey and brown/olive under differing lighting. These are image appearances, not measured albedo, chemistry or current water-quality evidence. Do not copy booking offers, brand artwork or prices into the model.

Model consequence: gunwales, ribs and benches; a light canopy on one moored passenger craft; small crates and fruit baskets; desaturated opaque canal water. The photographed lengths/capacities do not calibrate our scene dimensions. Rights unconfirmed; no redistributed assets.

### T1 — Three.js r180 Reflector source
https://raw.githubusercontent.com/mrdoob/three.js/r180/examples/jsm/objects/Reflector.js

Official release-matched implementation. Inspected constructor, onBeforeRender, clipping and disposal. Reflector mirrors a perspective camera about its local +Z plane; uses a HalfFloat render target, oblique clip plane, hides itself during the secondary render and restores render-target/XR/shadow-auto-update state. Shader needs tDiffuse, color and textureMatrix. Must orient local plane correctly and avoid reflection recursion. A custom shader can sample the actual reflected scene; a tinted sine pattern alone is not scene reflection.

### T2 — Three.js r180 Water source
https://raw.githubusercontent.com/mrdoob/three.js/r180/examples/jsm/objects/Water.js

Official release-matched source. Inspected water reflection/normal and lighting structure. Used as algorithmic context; no downloaded water-normal texture. Implement analytic waves with a custom shader and the Reflector helper in the same WebGL backend.

### T3 — Filament, Physically Based Rendering
https://google.github.io/filament/main/filament.html

Google's rendering-engine reference. Inspected §§4.4.1–4.4.3 (GGX distribution, geometric visibility, Fresnel), §4.8.1 and Table 4 (water IOR 1.33, normal reflectance about 2%), §5.3 (image-based light), and imaging discussion. F0=((IOR−1)/(IOR+1))², and Schlick varies reflectance with the view angle. Roughness controls highlight shape. Water scattering/absorption, wave spectrum, reflectance enhancement and turbidity remain authored approximations here. We do not claim implementation of all Filament features or a fully energy-conserving spectral water model.

### T4 — Three.js r180 Sky, PMREM and standard materials
https://raw.githubusercontent.com/mrdoob/three.js/r180/examples/jsm/objects/Sky.js
https://raw.githubusercontent.com/mrdoob/three.js/r180/docs/api/en/extras/PMREMGenerator.html
https://raw.githubusercontent.com/mrdoob/three.js/r180/docs/api/en/materials/MeshStandardMaterial.html

Sky is an analytic daylight model usable with WebGLRenderer; PMREM can prefilter an environment scene; MeshStandardMaterial supports roughness/metalness/environment lighting. Use a generated daylight environment for material illumination, one coordinated directional sun for direct lighting and shadows, restrained hemisphere fill, linear lighting and final tone mapping. Rebuild/dispose the environment when the lighting preset changes, not each frame.

## Rendering-route decision

Keep three-webgl + GLSL, as requested. Three WebGPU + TSL/WGSL, native WebGL2 + GLSL and native WebGPU + WGSL are other available authoring routes but would add a separate backend, shader integration and compatibility work without serving this revision. No unsupported fallback is advertised.

## Visual direction and assumptions

Architectural landscape maquette: composed strata in the cut base, interlocking timber/roof/awning volumes, faceted vegetation and crisp silhouettes. The cut-face strata are a presentation device, not a claim about local geology. Weathered timber and corrugated/terracotta roofs use procedural material variation. No photographs are copied as textures.

Water: opaque olive/brown scattering color, multiscale analytic wave normals, actual planar scene reflection with roughness filtering and Schlick Fresnel, directional GGX-style sun response, light/shadow coupling and a localized illustrative wake. No transparent tropical-blue water, fake bottom caustics or invented water readings. Depth/color falloff is a visual proxy; not bathymetry. Sun presets are art direction, not a local date/time calculation.

Stop condition for this revision: evidence covers feature families and the selected shader route; unknown dimensions/physical parameters are explicit. Browser compilation, reflection orientation, color/exposure, mobile layout, low-sun stability, material selection restoration and boat clearance must pass before delivery.

## Implemented result and evidence

Built with the selected Three.js r180 WebGL2 route. Architectural features are contextual reinterpretations of V1/V2. Real scene reflection uses T1's camera/clip/target lifecycle; daylight environment uses T4; angular reflectance and direct sun response follow the principles in T3 with explicit artistic gains/limits. Fine wave normals use authored multi-scale noise derivatives to avoid a repeated sinusoidal highlight pattern.

Final browser inspection: WebGL2, 10 GPU programs, zero shader-error callbacks, 1024² desktop reflection; observed 170,264 scene triangles and a 16.7ms rolling median frame time on the tested machine. See ../../qa/v2/QA.md for scope and limitations. Browser tests do not validate field dimensions or canal optics.
