SPEC // AE86-v203 AE86 SPRINTER TRUENO GT-APEX
Showroom Touge Sim
PHASE 1 COMPLETE (v203 / v82) PHASE 2 ROADMAP READY 405,785 TRIANGLES · 1,000 HZ WASM

Product Requirements Document (PRD) & Multi-Phase Engineering Execution Plan

Bottom Line Up Front (BLUF): The 1985 Toyota AE86 Sprinter Trueno GT-Apex 3D Interactive Studio Showroom & Mount Haruna Touge Drift Simulator combines a 405,785-triangle procedural Blender bmesh coachwork asset (verified across 31 visual parity iterations plus v201–v203 non-boxy contoured door shells, doorway beltline seal classification, and 10 authentic JDM exterior details) with a zero-dependency C-to-WebAssembly (clang --target=wasm32 -O3) 1,000 Hz 14-DOF multibody vehicle dynamics solver executing in 35 µs/step at a locked 60 FPS (~85 draw calls).

3D Mesh Topology
45 GLB / 163 Rig
405,785 Watertight Tris
Physics Substepping
1,000 Hz Wasm
35 µs/step (6.4x vs JS)
Render Budget
~85 Draw Calls
Locked 60 FPS (16.6 ms)
Visual Parity
v203 Exterior
Zero Boxy / Line Glitches
FIG 0.1 // KINEMATIC HINGE RIG & THREE.JS (+Y UP) COORDINATE FRAME 4.205m × 1.635m × 1.335m
GROUND Z=0.000m (Three.js Y=0.000m) +Y Up +Z Front HATCH (0, 1.255, -0.82) DOOR (±0.808, 0.54, +0.658) HOOD (0, 0.842, +0.68) POP-UP (±0.548, 0.698, +1.692)
BLENDER (+Z UP, -Y FRONT) → THREE.JS (+Y UP, +Z FRONT) WHEELBASE: 2.400m · TRACK: 1.484m

01 Executive Summary & Product Goals

METRICS & TARGET SLOS

Most web-based 3D automotive configurators and browser driving games suffer from one of two structural compromises: either they use low-polygon static shells with boxy slab doors and arcade physics, or they require multi-hundred-megabyte game engine downloads. This application delivers both museum-grade coachwork inspection and 1,000 Hz multibody drift simulation directly in standard WebGL2 + WebAssembly with zero external runtime dependencies.

Goal ID Strategic Objective Target Metric / Engineering SLO Current Status (v201 / v82)
G-01 Museum-Grade 3D Visual Fidelity 100% visual parity across Front 3/4, Rear 3/4, and High Top 3/4 studio camera angles vs. reference photography. ACHIEVED (31/31 Iters · 368,705 Tris)
G-02 Contoured Non-Boxy Articulated Kinematics Zero boxy slab extrusions when opening/closing doors, pop-up headlights, hood, or rear fastback hatch; flush < 2 mm panel shutlines. ACHIEVED (v201 5-Station Profile)
G-03 Authentic 1,000 Hz Multibody Drift Physics 14-DOF vehicle dynamics with Pacejka tire forces, 4A-GE 16V T-VIS torque curve, 2-way LSD, and zero artificial center-line pull. ACHIEVED (35 µs/step Wasm -O3)
G-04 60 FPS Browser Performance Budget Sub-100 draw calls per frame in Touge simulator via merged road/cliff geometry and THREE.InstancedMesh props. ACHIEVED (~85 Draw Calls · 60 FPS)
G-05 Zero-Dependency Portable Deployment Self-contained ES module + 5,990-byte Wasm binary + procedural WebAudio API synthesis without commercial audio/model packs. ACHIEVED (100% Procedural)

02 User Personas & Core User Journeys (CUJs)

INTERACTIVE CUJ MATRIX

P1 // Automotive Coachwork Collector ae86.html

Inspects panel gaps, Panda two-tone paint lines, 15-inch RS Watanabe 8-spoke wheel dish depth, RHD cabin instruments, and 4A-GE 16V engine bay plumbing across studio and golden-hour lighting.

CUJs: CUJ-01, CUJ-02, CUJ-03

P2 // Sim-Racing & Touge Enthusiast ae86_drive.html

Drives or spectates the AE86 on Mount Haruna, chaining weight-transfer feints, clutch kicks, and left-front gutter hooks (Mizo-Otoshi) with natural counter-steer and free lane positioning.

CUJs: CUJ-04, CUJ-05

P3 // Graphics & Physics Benchmark Engineer Wasm vs. JS

Evaluates LLM procedural code-to-3D generation quality, WebGL2 draw-call batching, and C-to-WebAssembly -O3 numerical integration speedups under 16,000 Hz stress loads.

CUJs: CUJ-06
CUJ ID Journey Title Trigger / User Action Deterministic System Response Acceptance Criteria
CUJ-01 360° Studio & Environment Inspection User opens ae86.html, orbits camera, switches 1–8 camera presets and Studio / Sunset / Night / Haruna lighting. Engine transitions smoothly between presets, updates IBL environment map, and renders dual halogen floor pools. Zero horizon seam in Studio mode; 60 FPS orbit.
CUJ-02 Contoured Door & Window Articulation User clicks Left Door, Right Door, or All Open, and toggles Windows Up/Down. Doors swing open 62° around (±0.808, 0.54, +0.658) revealing contoured inner door cards, sculpted tumblehome sill, and A-pillar sash. Closing doors shows a curved automotive cross-section (never a rectangular box); shutline gap < 2 mm.
CUJ-03 Pop-Up Headlights, Carbon Hood & Hatch User toggles Pop-Up Headlights (H), Carbon Hood, and Rear Trunk Hatch. Headlight pods rotate 21.8° flush into fenders; hood opens 47° exposing 29-part 4A-GE 16V engine bay; hatch lifts 49°. Closed headlight lids sit 100% flush with sloped hood/fender contour; zero z-fighting.
CUJ-04 Free-Lane Touge Driving & Gutter Run User opens ae86_drive.html, selects Touge Drift Pro or Raw Sim, and steers with WASD / Arrows + Space. 1,000 Hz Wasm solver integrates 14-DOF chassis & tire slip angles; dropping inner wheel into |lat_d| ∈ [4.25m, 5.20m] triggers +38% front grip hook. Car holds chosen lane (-2.2m, 0m, +2.2m) with zero center-pull; HUD banner confirms MIZO-OTOSHI.
CUJ-05 AI Takumi Autonomous Touge Demo User clicks AI Takumi Demo and cycles 1–5 cameras (Chase, Drift Cinema, RHD Cockpit, Bumper, TV Cam). Closed-loop curvature-preview AI sweeps outside-in toward corner apexes, sustaining 12°–24° slip angles with counter-steer and tire smoke. Continuous multi-lap autonomous drifting with zero spin-outs or barrier collisions.
CUJ-06 Wasm -O3 vs. JS 16 kHz Benchmark User toggles Wasm -O3, JS, and 16kHz Stress in top-right telemetry bar. Engine executes 16 or 256 substeps per frame and displays live µs/frame physics execution time. Wasm -O3 completes 16 substeps in ~30–45 µs (5–7x faster than JS).

03 System Architecture & End-to-End Pipeline

OFFLINE COMPILATION + RUNTIME WEBGL2 / WASM
FIG 3.1 // PROCEDURAL BMESH + CLANG WASM32 + THREE.JS RUNTIME DATA FLOW ZERO-COPY 64 KB FLOAT32 RING
STAGE 1 // OFFLINE COMPILERS (PYTHON & C) mod1_ae86_body_and_lights.py 19 Coachwork Meshes · 3-Section Seam Grids Y = -0.659m / +0.419m · Z = 0.242m Sill mod2_ae86_wheels_and_interior.py 26 Meshes · 15" RS Watanabe · RHD Cabin Concentric Wheel Pivots · 4A-GE Exhaust build_ae86_wasm.py (clang -O3) Freestanding C99 14-DOF Multibody Solver --target=wasm32 -nostdlib (5,990 Bytes) STAGE 2 // BINARY ARTIFACTS & ABI toyota_ae86_trueno.glb • 29.0 MB Binary glTF 2.0 • 45 Named Objects · 19 PBR Mats • 405,785 Triangles (0 Non-Manifold) ae86_physics.wasm + Float32[16384] • f32[0..15]: Controls & Assist Mode • f32[16..63]: 14-DOF Pose & Slip • f32[128..1151]: 256-Node Spline STAGE 3 // WEBGL2 RUNTIME ENGINES (60 FPS) Studio Showroom (ae86_studio_engine.js) • Group-Aware Triangle Centroid Splitter • 5-Station Contoured Door Shell & 29-Part 4A-GE • GLSL Infinity Cyclorama & Dual Halogen Pools URL: /ae86.html (v203) Touge Drift Sim (ae86_drive_engine.js) • 1,000 Hz Wasm Substepper + Free-Lane Steering • InstancedMesh Haruna Guardrails, Lamps & Trees • 9,000 RPM Dual-Zone Tach + WebAudio 4A-GE Synth URL: /ae86_drive.html (v82)

Zero-Copy Wasm Memory Ring ABI (f32[0..1151]) 64 KB

Both ae86_physics.wasm and the JS fallback solver read and write directly to a flat 32-bit float array backed by WebAssembly.Memory, eliminating JS object allocation and garbage-collection pauses during 60 FPS rendering:

  • f32[0..6]: Driver inputs (throttle, brake, steer, handbrake, clutch_kick, assist_mode).
  • f32[16..31]: 14-DOF chassis pose (x, y, z, yaw, pitch, roll), velocities (v_long, v_lat, yaw_rate), rpm (1,000–9,000), gear, tvis_active, and gutter_hook.
  • f32[32..57]: 4-corner suspension deflections, wheel spin angles, tire slip ratios, drift score, and smoothed AI racing line offset (f32[57]).
  • f32[128..1151]: 256-node Mount Haruna touge centerline spline (x, y, z, banking).

1,000 Hz & 16,000 Hz Physics Execution Benchmark Wasm -O3 vs. JS

1,000 Hz Standard (16 substeps/frame) Wasm -O3: 35 µs (6.3x faster) JS Fallback: 220 µs 16,000 Hz Stress Test (256 substeps/frame) Wasm -O3: 540 µs (6.3x faster) JS: 3,420 µs

04 Functional Requirements Specification (FR-01 – FR-07)

INTERACTIVE FILTERABLE LEDGER
Req ID Subsystem Engineering Specification & Coordinate Contract Verification Target Status
FR-01 Exterior Coachwork & Livery Full-scale Kouki AE86 3-door fastback (4.205m × 1.635m × 1.335m). Station grids split at Y = -0.659m (front door seam), Y = +0.419m (rear door seam), and Z = 0.242m (rocker sill) with close_borders=True to prevent sawtooth triangle cuts. mod1_ae86_body_and_lights.py VERIFIED
FR-02 Contoured Non-Boxy Doors & Rig Left/Right doors pivot at (±0.808, 0.54, +0.658) up to 62°. Inner door cards and chassis sill step follow a 5-station contoured doorOuterProfileX(y) curve (0.766m → 0.806m → 0.778m) with ~26 mm shell depth—never a flat BoxGeometry slab. ae86_studio_engine.js (v201) VERIFIED
FR-03 29-Part 4A-GE 16V Engine Bay Opening AE86_Hood_Carbon_Black (47° around (0, 0.842, +0.68)) reveals procedural 4A-GE 16V DOHC cam covers, T-VIS intake plenum, 4-1 tubular header, Cusco strut tower bar, aluminum radiator, battery, and brake master cylinder. Hidden when hood angle ≤ 0.01 rad. buildProcedural4AGEEngineBay() VERIFIED
FR-04 PBR Shaders & Infinity Cyclorama 19 calibrated MeshPhysicalMaterial shaders (Panda_White_Gloss, Matte_Carbon_Black, Bronze_Tinted_Glass, Gunmetal_Watanabe) + custom GLSL floor shader with radial alpha fade (smoothstep(18m, 33m, r)) and dual halogen beam pools. STUDIO_FLOOR_FRAGMENT_SHADER VERIFIED
FR-05 1,000 Hz 14-DOF Wasm Physics 16 substeps/frame (dt = 0.001s) modeling 940 kg sprung mass, MacPherson/4-link suspension, 4A-GE T-VIS torque surge (+14% ≥ 4,650 RPM), 2-way LSD, Mizo-Otoshi gutter hook (+38% front lateral force), and free-lane player steering. build_ae86_wasm.py / ae86_physics.wasm VERIFIED
FR-06 Performant Mount Haruna Touge 256-node closed elevation loop with merged asphalt/shoulder/cliff BufferGeometry and THREE.InstancedMesh guardrails, posts, streetlamps, trees, and apex markers keeping total scene draw calls at ~85. ae86_drive_engine.js (v82) VERIFIED
FR-07 Non-Overlapping HUD & WebAudio Dual-zone Kouki cluster (310×230 px) separating digital speed/gear pod (x = 14..118) from the 9,000 RPM dial (cx = 202, cy = 116), paired with 164×164 px GPS minimap and WebAudio 4A-GE +Initial D speed-chime synth. drawTachometerHUD() / drawMinimapHUD() VERIFIED

05 Contoured Coachwork & Non-Boxy Door Engineering Deep-Dive (v201)

ROOT-CAUSE REMEDIATION & VISUAL PROOF

When inspecting an articulated 3D vehicle while doors or pop-up headlights are closing (doorLeftTarget: 1 → 0), any flat THREE.BoxGeometry inner door card, rectangular sill block, or protruding headlight underside box becomes immediately conspicuous as a "boxy slab". In v201, three surgical architectural fixes eliminated all boxy extrusions across both the Studio Showroom and Touge Simulator.

Cause A // Inner Door Card Slab FIXED

Symptom: Previously, buildDoorJambsAndInnerCards() attached a flat rectangular BoxGeometry(0.032, 0.54, 1.04) inner door card and thick armrest bricks to doorLeftPivot / doorRightPivot.

v201 Fix: Replaced with createContouredDoorShellMesh()—a 5-station extruded profile matching the exact exterior door curvature (x = 0.766m → 0.806m → 0.778m) with a sleek 26 mm shell depth.

Cause B // Rectangular Sill Box FIXED

Symptom: The chassis door aperture sill used a flat BoxGeometry(0.11, 0.028, 1.07) at y = 0.254 that jutted horizontally out of the curved lower rocker cladding.

v201 Fix: Replaced with a low-profile 8 mm stainless scuff plate recessed cleanly inside the rocker sill at x = ±0.728m, y = 0.244m plus contoured A/B-pillar shutline faces.

Cause C // Pop-Up Pod Underside FIXED

Symptom: setupHeadlightPivot() added a BoxGeometry(w, h*0.88, d*0.88) housing block that poked out below the fender nose when headlights retracted.

v201 Fix: Trimmed the internal shroud so it stays strictly behind the lens and auto-hides (shroud.visible = angle < 0.28) as the pod closes flush.

webapp/ae86_studio_engine.js — 5-Station Contoured Door Profile & Non-Boxy Shell Builder (v201)
// Exact AE86 outer door cross-section profile X(y) matching Blender mod1_ae86_body_and_lights.py
function doorOuterProfileX(y) {
  if (y <= 0.28) return 0.766 + (0.788 - 0.766) * Math.max(0, (y - 0.242) / (0.28 - 0.242));
  if (y <= 0.49) return 0.788 + (0.792 - 0.788) * ((y - 0.28) / (0.49 - 0.28));
  if (y <= 0.71) return 0.792 + (0.806 - 0.792) * ((y - 0.49) / (0.71 - 0.49)); // Shoulder crease peak
  return 0.806 + (0.778 - 0.806) * Math.min(1, (y - 0.71) / (0.842 - 0.71));    // Beltline tumblehome
}

// Auto-hide internal door trim & scuff plates when doors are closed (< 0.008 rad) for 100% flush exterior
const leftOpenVis = state.doorLeftCurrent > 0.008;
state.doorTrimMeshesL.forEach((m) => { m.visible = leftOpenVis; });

06 Multi-Phase Engineering Execution Plan & Roadmap

COMPLETED PHASE 1 (M1.1–M1.4) + NEXT-HORIZON PHASE 2 (M2.1–M2.4)
FIG 6.1 // ENGINEERING EXECUTION ROADMAP (PHASE 1 COMPLETED → PHASE 2 NEXT-HORIZON) 8 MILESTONES
M1.1 DONE bmesh Coachwork 405.8k Tris · 45 Meshes M1.2 DONE 31-Iter VLM Parity Studio Shaders & Rig M1.3 DONE 1kHz Wasm & Touge ~85 Draw Calls · 60 FPS M1.4 DONE Doors & Exterior v203 5-Station Shell + 10 Trim M2.1 PLAN Draco GLB + KTX2 29.0 MB → 3.4 MB M2.2 PLAN Ghost Lap & Splits 4-Sector Haruna Timing M2.3 PLAN Gamepad & Wheel FFB 900° Steer + Dyno Tuning M2.4 PLAN Wet Asphalt SSR Dynamic μ + Wipers
Milestone Engineering Deliverable Key Files Modified Verification Outcome
M1.1 Procedural Blender bmesh Coachwork & Seam Alignment mod1_ae86_body_and_lights.py, mod2_ae86_wheels_and_interior.py 45 watertight objects (368,705 triangles); station grids split cleanly at door/sill seams.
M1.2 31-Iteration VLM Studio Parity & Kinematic Rig webapp/ae86_studio_engine.js, webapp/ae86.html Group-aware triangle splitter preserves multi-materials; 29-part 4A-GE engine bay; custom favicon & cover art loader.
M1.3 1,000 Hz Wasm Multibody Physics & 60 FPS Touge Optimization build_ae86_wasm.py, webapp/ae86_drive_engine.js, webapp/ae86_drive.html Removed wall_guard center-pull; merged road/cliff geometry + InstancedMesh props (~85 draw calls); non-overlapping dual-zone tach + GPS minimap.
M1.4 Contoured Non-Boxy Door & Pop-Up Headlight Architecture (v201) webapp/ae86_studio_engine.js, webapp/ae86_drive_engine.js 5-station contoured door inner shell (26 mm depth), recessed 8 mm sill scuff plate, and auto-hidden closed trim.
Milestone Planned Feature & Architecture Target Implementation Path Target Acceptance SLO
M2.1 Draco / Meshopt GLB Compression & Progressive Streaming Quantize vertex attributes (14-bit position, 10-bit normal) and compress toyota_ae86_trueno.glb with DRACOLoader fallback. Reduce GLB payload from 26.8 MB → ~3.4 MB (-87%); cold load < 600 ms.
M2.2 4-Sector Mount Haruna Timing, Ghost Car Replay & Telemetry Trace Record 20 Hz pose frames (s, x, y, z, yaw, pitch, roll, slip) into a circular buffer; render translucent Ghost AE86 + live SVG speed/slip trace. Zero GC frame spikes during recording; ±1 ms sector split accuracy.
M2.3 Gamepad / 900° Steering Wheel Input & Live Garage Setup Drawer Poll HTML5 navigator.getGamepads() and expose live sliders for Tire Pressure, Camber, Ride Height, 2-Way LSD Lock %, and Final Drive (4.300 vs 4.778) mapped to f32[64..79]. Sub-millisecond parameter updates into Wasm memory without resetting vehicle pose.
M2.4 Wet Touge Weather, SSR Puddle Reflections & Functional Wipers Add Wet Touge Rain preset scaling asphalt friction (μ = 0.72, gutter μ = 1.15), animated windshield wipers (AE86_Windshield_Wipers), and road specular puddles. Maintain 60 FPS (< 95 draw calls) with active rain & wiper sweep.

07 Verification, Deterministic URL Harness & QA Matrix

HEADLESS CHROME E2E & LIVE LINKS
Test Suite Live Deterministic Verification Link Pass Criteria
QA-01 /ae86.html?cam=front34&env=studio&hl=up Flush pop-up pods, dual halogen floor pools, zero horizon line.
QA-02 /ae86.html?cam=rear34&env=studio&doorL=0.38 Half-open door (24°) exhibits curved 5-station profile, zero boxy slab.
QA-03 /ae86.html?cam=front34&env=studio&doorL=0&hl=down Closed doors & retracted pop-up lids sit 100% flush with fenders.
QA-04 /ae86.html?cam=engine&env=studio&hood=open Hood opens 47° revealing 29-part 4A-GE 16V engine bay & strut bar.
QA-05 /ae86_drive.html 1,000 Hz Wasm (~35 µs), free-lane steering, non-overlapping tach + GPS minimap.