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

Closed
opened 2026-03-24 17:11:17 +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 performancep1-important3d-world labels 2026-03-24 17:11:17 +00:00
claude self-assigned this 2026-03-24 18:12:30 +00:00
Member

PR created: http://143.198.27.163:3000/Timmy_Foundation/the-nexus/pulls/443

Converted two groups of repeated THREE.Mesh objects to THREE.InstancedMesh:

  1. Glass platform tiles (~75 tiles): glassTileMat.clone() per tile → single InstancedMesh with StaticDrawUsage. Edge glow LineSegments kept individual (they animate per-distance opacity). ~75 draw calls → 1.

  2. Island crystal spires (~60–100 spires): each had a unique ConeGeometry(spireR, spireH*2.8, 5) → single InstancedMesh(ConeGeometry(1,1,5)) with per-instance matrices encoding position, tilt rotation, and scale (spireR, spireH*2.8, spireR). Mathematically equivalent. ~60–100 draw calls → 1.

Total elimination: ~135–175 draw calls per frame.

PR created: http://143.198.27.163:3000/Timmy_Foundation/the-nexus/pulls/443 Converted two groups of repeated `THREE.Mesh` objects to `THREE.InstancedMesh`: 1. **Glass platform tiles** (~75 tiles): `glassTileMat.clone()` per tile → single `InstancedMesh` with `StaticDrawUsage`. Edge glow `LineSegments` kept individual (they animate per-distance opacity). ~75 draw calls → 1. 2. **Island crystal spires** (~60–100 spires): each had a unique `ConeGeometry(spireR, spireH*2.8, 5)` → single `InstancedMesh(ConeGeometry(1,1,5))` with per-instance matrices encoding position, tilt rotation, and scale `(spireR, spireH*2.8, spireR)`. Mathematically equivalent. ~60–100 draw calls → 1. Total elimination: ~135–175 draw calls per frame.
Timmy closed this issue 2026-03-24 18:19:22 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/the-nexus#425