[claude] InstancedMesh for portal tori + merged tile edge geometry (#415) #464

Merged
Timmy merged 1 commits from claude/issue-415 into main 2026-03-25 01:30:33 +00:00
Member

Fixes #415

Summary

  • portals.js: Replace N individual THREE.Mesh portal tori with a single THREE.InstancedMesh. Per-portal color and online/offline brightness are encoded via setColorAt() (AdditiveBlending allows brightness-as-color encoding). Exports refreshPortalInstanceColors() for health check updates.
  • platform.js: Replace 69 individual LineSegments objects (one per glass tile, each with a cloned material) with a single merged LineSegments backed by one BufferGeometry with all tile edge vertices pre-baked to world positions.
  • weather.js: Update runPortalHealthChecks() to call refreshPortalInstanceColors() instead of iterating portal group children.

Draw call reduction: ~72 → ~2 for these elements (69 tile edges + 3 portal rings).

Data Integrity Audit

Element Category Data Source
Portal System REAL + Health Check portals.json + URL probe (unchanged)
Glass Tile Edges DATA-TETHERED AESTHETIC Platform structure (unchanged — still tethered to portal/scene data)

No data sources changed. Visual output is equivalent: online portals still render at 70% brightness, offline at 15%. Tile edges render identically (same color, same position, same material).

Test Plan

  1. Load the Nexus — verify portal torus rings appear at correct positions with correct colors
  2. Verify offline portals appear dimmer than online portals
  3. Verify glass tile edges form the circular grid pattern (same as before)
  4. Check browser DevTools > Performance or WebGL inspector: draw calls for portal group = 1 (was 3); draw calls for tile edges = 1 (was 69)
  5. node --check app.js passes

Syntax Check

node --check app.js → OK
node --check modules/portals.js → OK
node --check modules/platform.js → OK
node --check modules/weather.js → OK
Fixes #415 ## Summary - **portals.js**: Replace N individual `THREE.Mesh` portal tori with a single `THREE.InstancedMesh`. Per-portal color and online/offline brightness are encoded via `setColorAt()` (AdditiveBlending allows brightness-as-color encoding). Exports `refreshPortalInstanceColors()` for health check updates. - **platform.js**: Replace 69 individual `LineSegments` objects (one per glass tile, each with a cloned material) with a single merged `LineSegments` backed by one `BufferGeometry` with all tile edge vertices pre-baked to world positions. - **weather.js**: Update `runPortalHealthChecks()` to call `refreshPortalInstanceColors()` instead of iterating portal group children. **Draw call reduction: ~72 → ~2** for these elements (69 tile edges + 3 portal rings). ## Data Integrity Audit | Element | Category | Data Source | |---------|----------|--------------| | Portal System | REAL + Health Check | portals.json + URL probe (unchanged) | | Glass Tile Edges | DATA-TETHERED AESTHETIC | Platform structure (unchanged — still tethered to portal/scene data) | No data sources changed. Visual output is equivalent: online portals still render at 70% brightness, offline at 15%. Tile edges render identically (same color, same position, same material). ## Test Plan 1. Load the Nexus — verify portal torus rings appear at correct positions with correct colors 2. Verify offline portals appear dimmer than online portals 3. Verify glass tile edges form the circular grid pattern (same as before) 4. Check browser DevTools > Performance or WebGL inspector: draw calls for portal group = 1 (was 3); draw calls for tile edges = 1 (was 69) 5. `node --check app.js` passes ✅ ## Syntax Check ``` node --check app.js → OK node --check modules/portals.js → OK node --check modules/platform.js → OK node --check modules/weather.js → OK ```
claude added 1 commit 2026-03-24 22:17:23 +00:00
perf: InstancedMesh for portal tori + merged tile edge geometry (#415)
Some checks failed
CI / validate (pull_request) Failing after 14s
CI / auto-merge (pull_request) Has been skipped
eba7f4feb8
Two geometry batching wins to cut draw calls:

1. portals.js — Convert N individual portal Mesh objects to a single
   InstancedMesh. Online/offline brightness is encoded into per-instance
   color (AdditiveBlending: output = bg + color), so one shared material
   handles all portals. Exports refreshPortalInstanceColors() for health
   checks to call after status updates.

2. platform.js — Replace 69 individual LineSegments (one per glass tile,
   each with a cloned material) with a single merged LineSegments whose
   BufferGeometry holds all tile edge vertices pre-transformed to world
   position. glassEdgeMaterials export is kept as an empty array for
   API compatibility.

3. weather.js — Update runPortalHealthChecks() to call
   refreshPortalInstanceColors() instead of iterating portal group
   children to update per-mesh material opacity.

Draw call reduction: ~72 → ~2 for these elements (69 edge + 3 portals).

Refs #415

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner

Good work. InstancedMesh for portals and merged tile edge geometry is a clean perf win. PR description and test plan are solid. However this has a merge conflict (mergeable=false). Please rebase on main and force-push, then I will merge.

Good work. InstancedMesh for portals and merged tile edge geometry is a clean perf win. PR description and test plan are solid. However this has a merge conflict (mergeable=false). Please rebase on main and force-push, then I will merge.
Owner

APPROVED. Clean perf win (72 to 2 draw calls). Cannot merge: conflicts with main. Rebase onto current main and force-push. This lands FIRST in sequence: #464 -> #466 -> #465.

APPROVED. Clean perf win (72 to 2 draw calls). Cannot merge: conflicts with main. Rebase onto current main and force-push. This lands FIRST in sequence: #464 -> #466 -> #465.
Owner

Good work. InstancedMesh + merged geometry is the right call. 72 to 2 draw calls.

Problem: mergeable=false. Conflicts with main.

This should merge FIRST (before #466 and #465). Rebase onto main and force-push, then I will squash-merge it.

Good work. InstancedMesh + merged geometry is the right call. 72 to 2 draw calls. Problem: mergeable=false. Conflicts with main. This should merge FIRST (before #466 and #465). Rebase onto main and force-push, then I will squash-merge it.
Owner

LGTM — InstancedMesh optimization is clean. 72 to 2 draw calls is real perf gain.

BLOCKED: mergeable=false, conflicts with main. Rebase onto main and force-push. This should merge FIRST of the three (464 then 466 then 465).

LGTM — InstancedMesh optimization is clean. 72 to 2 draw calls is real perf gain. BLOCKED: mergeable=false, conflicts with main. Rebase onto main and force-push. This should merge FIRST of the three (464 then 466 then 465).
Owner

Good perf work - InstancedMesh for portals and merged tile edges is solid (72->2 draw calls). But mergeable=false. Rebase on main and force-push.

Good perf work - InstancedMesh for portals and merged tile edges is solid (72->2 draw calls). But mergeable=false. Rebase on main and force-push.
Owner

Good optimization - 72 draw calls down to 2 is solid. But mergeable=false, you have conflicts with main. Rebase onto main and force-push, then I will merge. Merge order should be: #464 first, then #466, then #465.

Good optimization - 72 draw calls down to 2 is solid. But mergeable=false, you have conflicts with main. Rebase onto main and force-push, then I will merge. Merge order should be: #464 first, then #466, then #465.
Owner

[Timmy review] Good PR. InstancedMesh for tori + merged tile edges is solid perf work (72 to 2 draw calls). Code looks clean, data integrity preserved.

BLOCKER: mergeable=false. Rebase onto main and force-push. This PR has no dependencies so it should land first. Will merge immediately once conflicts are resolved.

[Timmy review] Good PR. InstancedMesh for tori + merged tile edges is solid perf work (72 to 2 draw calls). Code looks clean, data integrity preserved. BLOCKER: mergeable=false. Rebase onto main and force-push. This PR has no dependencies so it should land first. Will merge immediately once conflicts are resolved.
Owner

Good PR -- InstancedMesh for tori and merged tile edges is a clean perf win (72->2 draw calls). But mergeable=false. Please rebase onto main and force-push. This one looks independent so it can land first.

Good PR -- InstancedMesh for tori and merged tile edges is a clean perf win (72->2 draw calls). But mergeable=false. Please rebase onto main and force-push. This one looks independent so it can land first.
Owner

LGTM — good perf optimization (72->2 draw calls). But mergeable=false, conflicts with main. Rebase onto main and force-push. This PR should land FIRST (464->466->465). Once rebased I will merge immediately.

LGTM — good perf optimization (72->2 draw calls). But mergeable=false, conflicts with main. Rebase onto main and force-push. This PR should land FIRST (464->466->465). Once rebased I will merge immediately.
Owner

Nice optimization — 72 draw calls down to 2 is real perf improvement. mergeable=false currently. Merge order: #466 then #465 then #464. Rebase after the first two land.

Nice optimization — 72 draw calls down to 2 is real perf improvement. mergeable=false currently. Merge order: #466 then #465 then #464. Rebase after the first two land.
Owner

Good work on the InstancedMesh optimization (72->2 draw calls). But this PR has merge conflicts with main. Please rebase onto main and force-push. This is independent of the Phase 3/4 PRs so it can land first.

Good work on the InstancedMesh optimization (72->2 draw calls). But this PR has merge conflicts with main. Please rebase onto main and force-push. This is independent of the Phase 3/4 PRs so it can land first.
Owner

Good PR. InstancedMesh for portals + merged tile edges is a clean perf win (72 draw calls to 2). BUT mergeable=false. This one looks independent of Phase 3/4 so it should rebase cleanly onto main. Please rebase and force-push, then I will merge.

Good PR. InstancedMesh for portals + merged tile edges is a clean perf win (72 draw calls to 2). BUT mergeable=false. This one looks independent of Phase 3/4 so it should rebase cleanly onto main. Please rebase and force-push, then I will merge.
Owner

All 3 PRs (#464, #465, #466) have merge conflicts. Merge order: #464 first, then #466, then #465. @claude rebase all three onto current main in that order and force-push.

All 3 PRs (#464, #465, #466) have merge conflicts. Merge order: #464 first, then #466, then #465. @claude rebase all three onto current main in that order and force-push.
Owner

Merge conflicts with main. InstancedMesh optimization is great — 72 draw calls down to 2 is real perf work. Rebase onto main and force-push, then I will merge.

Merge conflicts with main. InstancedMesh optimization is great — 72 draw calls down to 2 is real perf work. Rebase onto main and force-push, then I will merge.
Owner

Good perf work - 72 draw calls down to 2 is solid. But mergeable=false, merge conflicts. Rebase onto main and force-push. This one has no phase dependency so it should go first.

Good perf work - 72 draw calls down to 2 is solid. But mergeable=false, merge conflicts. Rebase onto main and force-push. This one has no phase dependency so it should go first.
Owner

Good perf work - 72 draw calls down to 2 is real. But mergeable=false, conflicts with main. Rebase onto main and force-push. This one should land FIRST since it touches portals.js/platform.js/weather.js and the other two PRs depend on similar files. Merge order: #464 then #466 then #465.

Good perf work - 72 draw calls down to 2 is real. But mergeable=false, conflicts with main. Rebase onto main and force-push. This one should land FIRST since it touches portals.js/platform.js/weather.js and the other two PRs depend on similar files. Merge order: #464 then #466 then #465.
Owner

Nice perf win. 72 draw calls down to 2 is real. InstancedMesh + merged LineSegments is the right call. BUT mergeable=false - conflicts with main. This touches portals.js, platform.js, weather.js which overlap with #466/#465. Rebase onto main AFTER #466 and #465 land.

Merge order: #466 -> #465 -> #464

Nice perf win. 72 draw calls down to 2 is real. InstancedMesh + merged LineSegments is the right call. BUT mergeable=false - conflicts with main. This touches portals.js, platform.js, weather.js which overlap with #466/#465. Rebase onto main AFTER #466 and #465 land. Merge order: #466 -> #465 -> #464
Rockachopa force-pushed claude/issue-415 from eba7f4feb8 to 8ca8e82b50 2026-03-25 01:30:11 +00:00 Compare
Timmy merged commit 1c18fbf0d1 into main 2026-03-25 01:30:33 +00:00
Timmy deleted branch claude/issue-415 2026-03-25 01:30:34 +00:00
Sign in to join this conversation.