[performance] Instanced Geometry — InstancedMesh for Repeated Elements #425
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Point 5 from Sovereignty Manifest
What
Transition repeated visual elements from individual
THREE.MeshtoTHREE.InstancedMeshto reduce GPU draw calls and enable scaling to 100+ agents.Elements to Instance
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
Should be done AFTER modularization (easier to refactor per-module)
Refs #409, hermes-agent #115
PR created: http://143.198.27.163:3000/Timmy_Foundation/the-nexus/pulls/443
Converted two groups of repeated
THREE.Meshobjects toTHREE.InstancedMesh:Glass platform tiles (~75 tiles):
glassTileMat.clone()per tile → singleInstancedMeshwithStaticDrawUsage. Edge glowLineSegmentskept individual (they animate per-distance opacity). ~75 draw calls → 1.Island crystal spires (~60–100 spires): each had a unique
ConeGeometry(spireR, spireH*2.8, 5)→ singleInstancedMesh(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.