[re-implement] InstancedMesh optimizations for repeated geometry #482

Closed
opened 2026-03-25 02:56:29 +00:00 by Rockachopa · 1 comment
Owner

Context

This feature existed in the reference/v2-modular branch but main has been reset to v0-golden baseline.
See the reference branch for implementation details.

Original issue: #425, 415

Acceptance Criteria

  • Screenshot BEFORE changes (showing golden baseline state)
  • Screenshot AFTER changes (showing the feature working)
  • WASD movement still works
  • Batcave terminal still renders
  • Portal rings still visible and functional
  • Loading screen still transitions properly
  • node --check app.js passes

Screenshot Requirement

No PR will be merged without before/after screenshots proving no regression from v0-golden.

## Context This feature existed in the `reference/v2-modular` branch but main has been reset to `v0-golden` baseline. See the reference branch for implementation details. ## Original issue: #425, 415 ## Acceptance Criteria - [ ] Screenshot BEFORE changes (showing golden baseline state) - [ ] Screenshot AFTER changes (showing the feature working) - [ ] WASD movement still works - [ ] Batcave terminal still renders - [ ] Portal rings still visible and functional - [ ] Loading screen still transitions properly - [ ] `node --check app.js` passes ## Screenshot Requirement **No PR will be merged without before/after screenshots proving no regression from v0-golden.**
Rockachopa added the performance3d-worldp1-important labels 2026-03-25 02:56:29 +00:00
claude self-assigned this 2026-03-25 02:56:59 +00:00
Member

PR created: #503

Implemented InstancedMesh optimizations for two repeated-geometry groups in app.js:

  1. Portal tori (3 → 1 draw call): Replaced per-portal TorusGeometry + MeshStandardMaterial + Mesh with a single InstancedMesh using MeshBasicMaterial + AdditiveBlending. Per-instance colors encode each portal's tint. Animation loop writes instance matrices each frame. Raycasting uses intersectObject(portalRingIM) + instanceId.

  2. Ambient runestones (5 → 1 draw call): Replaced 5 individual octahedron meshes with a single InstancedMesh. Eliminated 5 scene.getObjectByName() traversals per frame.

Total: 8 draw calls reduced to 2. node --check app.js passes.

PR created: #503 Implemented InstancedMesh optimizations for two repeated-geometry groups in `app.js`: 1. **Portal tori** (3 → 1 draw call): Replaced per-portal `TorusGeometry + MeshStandardMaterial + Mesh` with a single `InstancedMesh` using `MeshBasicMaterial + AdditiveBlending`. Per-instance colors encode each portal's tint. Animation loop writes instance matrices each frame. Raycasting uses `intersectObject(portalRingIM)` + `instanceId`. 2. **Ambient runestones** (5 → 1 draw call): Replaced 5 individual octahedron meshes with a single `InstancedMesh`. Eliminated 5 `scene.getObjectByName()` traversals per frame. Total: 8 draw calls reduced to 2. `node --check app.js` passes.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/the-nexus#482