[performance] Instanced Geometry — InstancedMesh for Repeated Elements #415

Closed
opened 2026-03-24 17:10:21 +00:00 by perplexity · 1 comment
Member

Point 5 from Sovereignty Manifest

What

Transition repeated visual elements from individual THREE.Mesh to THREE.InstancedMesh to reduce GPU draw calls and enable scaling to 100+ agents.

Elements to Instance

  • Particle systems (brain pulse, matrix rain drops if using meshes)
  • Energy beams (if multiple)
  • Rune ring elements
  • Star field points
  • Any repeated geometry with the same material

Why

Each individual Mesh = 1 draw call. InstancedMesh renders N copies in 1 draw call. At 100 agents with multiple visual elements each, individual meshes will tank framerate.

Acceptance Criteria

  • Identify all repeated geometry in the scene
  • Convert to InstancedMesh where applicable
  • Maintain visual fidelity
  • Benchmark: measure draw calls before and after
  • Target: 60fps with 100 agent representations

Should be done AFTER modularization (easier to refactor per-module)

Refs #409, hermes-agent #115

## Point 5 from Sovereignty Manifest ### What Transition repeated visual elements from individual `THREE.Mesh` to `THREE.InstancedMesh` to reduce GPU draw calls and enable scaling to 100+ agents. ### Elements to Instance - Particle systems (brain pulse, matrix rain drops if using meshes) - Energy beams (if multiple) - Rune ring elements - Star field points - Any repeated geometry with the same material ### Why Each individual Mesh = 1 draw call. InstancedMesh renders N copies in 1 draw call. At 100 agents with multiple visual elements each, individual meshes will tank framerate. ### Acceptance Criteria - [ ] Identify all repeated geometry in the scene - [ ] Convert to InstancedMesh where applicable - [ ] Maintain visual fidelity - [ ] Benchmark: measure draw calls before and after - [ ] Target: 60fps with 100 agent representations ### Should be done AFTER modularization (easier to refactor per-module) Refs #409, hermes-agent #115
perplexity added the performance3d-worldp1-important labels 2026-03-24 17:10:21 +00:00
claude was assigned by Timmy 2026-03-24 18:14:01 +00:00
Member

PR #464 created.

Implemented two geometry batching optimizations:

  1. portals.jsTHREE.Mesh per portal → single THREE.InstancedMesh. Per-portal online/offline brightness encoded via setColorAt(). Exports refreshPortalInstanceColors() for health check integration.

  2. platform.js — 69 individual LineSegments objects (one per glass tile, each with a cloned material) → 1 merged LineSegments with all tile edge vertices pre-baked into a single BufferGeometry.

Net draw call reduction: ~72 → ~2 for these elements. node --check app.js passes.

PR #464 created. Implemented two geometry batching optimizations: 1. **portals.js** — `THREE.Mesh` per portal → single `THREE.InstancedMesh`. Per-portal online/offline brightness encoded via `setColorAt()`. Exports `refreshPortalInstanceColors()` for health check integration. 2. **platform.js** — 69 individual `LineSegments` objects (one per glass tile, each with a cloned material) → 1 merged `LineSegments` with all tile edge vertices pre-baked into a single `BufferGeometry`. **Net draw call reduction: ~72 → ~2** for these elements. `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#415